You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

choice-product.vue 9.9KB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. <template>
  2. <navBar title="选择产品" :scrollTop="scrollTop"></navBar>
  3. <navBgCar></navBgCar>
  4. <view class="content-value">
  5. <view @click="savaHandle(item)" class="ul-item" v-for="(item, index) in state.dataArray" :key="index">
  6. <image style="width: 100%; height: 170rpx; border-radius: 20rpx"
  7. :src="`${$imgUrl}applyCard/product-bg.png`"></image>
  8. <view class="item-value">
  9. <image class="icon-tip" :src="state.sysType === 'WECHAT'?`${$imgUrl}applyCard/wechat.png` : `${$imgUrl}applyCard/alibaba.png`"></image>
  10. <view class="content">
  11. <view class="title">
  12. {{ item.promoteName }}
  13. </view>
  14. <!-- 1记账卡2储值卡3记存卡 -->
  15. <!-- <view style="margin-top: 15rpx" class="tip" v-if="item.cardType=='1'">
  16. 记账卡
  17. </view> -->
  18. <view style="margin-top: 15rpx" class="tip">
  19. {{ item.cardTypeArr }}
  20. </view>
  21. </view>
  22. <view class="money">
  23. ¥:{{ item.fee * 0.01 }}
  24. </view>
  25. </view>
  26. </view>
  27. <view class="bottomTip"> 到底啦!敬请期待其他产品! </view>
  28. </view>
  29. <u-popup mode="center" v-model="state.choiceCardShow" closeable>
  30. <view class="squire">
  31. <view class="mask-title" :style="{ '--color': color }">选择办理卡类型</view>
  32. <view class="as-layout-horizontal">
  33. <view v-for="(item, index) in state.radiolist1" :key="index" :label="item.disabled" :name="item.name"
  34. @click="radioChange(item.name)"
  35. style="width: 100%;display: flex;align-items: center;margin-bottom: 30rpx;">
  36. <view class="as-layout-vertical as-gravity-center">
  37. <image style="width: 140rpx; height: 100rpx; border-radius: 20rpx;margin-right: 20rpx;"
  38. :src="`${$imgUrl}card2.png`" mode="aspectFill"></image>
  39. <view style="margin-top: 20rpx;">
  40. {{item.name}}
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </u-popup>
  47. </template>
  48. <script setup lang="ts">
  49. import { onLoad, onPageScroll } from "@dcloudio/uni-app";
  50. import { reactive, ref } from "vue";
  51. import { etcQueryProduct, productReCode } from "@/utils/network/api.js";
  52. import { request } from "@/utils/network/request.js";
  53. import { stringToJson } from "@/utils/network/encryption";
  54. import { fileURL } from "@/datas/fileURL.js";
  55. import navBgCar from "./components/nav-bg-car1";
  56. import navBar from "@/components/nav-bar/nav-bar2.vue";
  57. import { getItem, StorageKeys, setItem } from "@/utils/storage.ts";
  58. import { msg } from "@/utils/utils";
  59. const imgURL = `${fileURL}image/`;
  60. // import { setItem } from "@/utils/storage";
  61. const scrollTop = ref(0); //滚动距离
  62. // 单选默认数据
  63. // let flag = ref(true)
  64. // 单选
  65. const radioChange = (n) => {
  66. console.log('radioChange', n);
  67. if (n == '记账卡') {
  68. state.isValueCard = 2
  69. } else if (n == '储值卡') {
  70. state.isValueCard = 1
  71. } else {
  72. state.isValueCard = 3
  73. }
  74. uni.redirectTo({
  75. url: `/subpackage/orders/essential-information?promoteId=${getItem("promoteId")}&userType=${state.userType}&type=${state.type}&isSign=${state.isSign}&isValueCard=${state.isValueCard}`,
  76. });
  77. }
  78. const savaHandle = (val) => {
  79. console.log("vAL", val)
  80. setItem("clientFee", val.clientFee);
  81. setItem("promoteId", val.promoteId);
  82. setItem("isValueCard", val.isValueCard);
  83. state.isSign = val.isSign;
  84. // 判断是几张卡
  85. console.log("val.cardTypeArr.split(", ")", val.cardTypeArr.split(","))
  86. // if (val.promoteName.indexOf('选装') != -1) {
  87. // if (val.cardTypeArr.split(",")[0] == "记账卡") {
  88. // state.isValueCard = 2
  89. // } else if (val.cardTypeArr.split(",")[0] == '储值卡') {
  90. // state.isValueCard = 1
  91. // } else {
  92. // state.isValueCard = 3
  93. // }
  94. // uni.redirectTo({
  95. // url: `/subpackage/orders/verify/verify-phone/verify-phone?promoteId=${getItem("promoteId")}&userType=${state.userType}&type=${state.type}&isValueCard=${state.isValueCard}`,
  96. // });
  97. // return
  98. // }
  99. if (val.cardTypeArr.split(",").length == 1) {
  100. if (val.cardTypeArr.split(",")[0] == "记账卡") {
  101. state.isValueCard = 2
  102. } else if (val.cardTypeArr.split(",")[0] == '储值卡') {
  103. state.isValueCard = 1
  104. } else {
  105. state.isValueCard = 3
  106. }
  107. uni.redirectTo({
  108. url: `/subpackage/orders/essential-information?promoteId=${getItem("promoteId")}&userType=${state.userType}&type=${state.type}&isValueCard=${state.isValueCard}`,
  109. });
  110. } else {
  111. state.radiolist1 = [];
  112. // 处理卡的数据
  113. for (var i = 0; i < val.cardTypeArr.split(",").length; i++) {
  114. const obj = {};
  115. obj["name"] = val.cardTypeArr.split(",")[i];
  116. obj["disabled"] = false;
  117. state.radiolist1.push(obj)
  118. }
  119. state.choiceCardShow = true;
  120. console.log("state.radiolist1", state.radiolist1)
  121. }
  122. };
  123. onLoad((option : any) => {
  124. // #ifdef MP-ALIPAY
  125. state.sysType = 'ALI';
  126. // #endif
  127. // #ifdef MP-WEIXIN
  128. state.sysType = 'WECHAT';
  129. // #endif
  130. // state.orderId = option.orderId;
  131. // state.userType = option.userType;
  132. // state.vehiclePlateColor = option.vehiclePlateColor;
  133. state.userType = option.userType;
  134. state.type = option.type;
  135. var data = {
  136. type: state.type,
  137. source: state.sysType //请求方来源
  138. };
  139. const options = {
  140. type: 2,
  141. data: data,
  142. method: "POST",
  143. showLoading: true,
  144. };
  145. console.log("输出内容", options);
  146. request(etcQueryProduct, options).then((res) => {
  147. // console.log(res.bizContent);
  148. const data = stringToJson(res.bizContent);
  149. console.log(data);
  150. // console.log(typeof(data));
  151. state.dataArray = data.csmsnPromoteDistPro ? data.csmsnPromoteDistPro : [];
  152. for (var i = 0; i < state.dataArray.length; i++) {
  153. const cardTypeArr = []
  154. for (var j = 0; j < state.dataArray[i].cardType.length; j++) {
  155. if (state.dataArray[i].cardType[j] == '1') {
  156. cardTypeArr.push('储值卡')
  157. } else if (state.dataArray[i].cardType[j] == '2') {
  158. cardTypeArr.push('记账卡')
  159. } else if (state.dataArray[i].cardType[j] == '3') {
  160. cardTypeArr.push('预存卡')
  161. }
  162. }
  163. state.dataArray[i].cardTypeArr = cardTypeArr.toString()
  164. }
  165. console.log("state.dataArray", state.dataArray)
  166. });
  167. });
  168. //监听页面滚动
  169. onPageScroll((e) => {
  170. scrollTop.value = e.scrollTop;
  171. });
  172. const productReCodeAction = (id) => {
  173. var data = {
  174. productId: id,
  175. orderId: state.orderId,
  176. };
  177. const options = {
  178. type: 2,
  179. data: data,
  180. method: "POST",
  181. showLoading: true,
  182. };
  183. return new Promise(async (resolve, reject) => {
  184. const res = await request(productReCode, options);
  185. const data = stringToJson(res.bizContent);
  186. resolve(data);
  187. }).catch((error) => {
  188. reject(error);
  189. });
  190. };
  191. const state = reactive({
  192. isValueCard: 1, //卡的类型
  193. radiolist1: [], //选择卡的数据列表
  194. choiceCardShow: false, //选择卡的弹出框
  195. isSign: '',
  196. sysType:"",
  197. orderId: "",
  198. userType: 1, //1 个人 2单位
  199. type: 0, //0 客车 1货车
  200. vehiclePlateColor: "",
  201. data: {
  202. show: false,
  203. src: imgURL + "applyCard/edit.png",
  204. },
  205. dataArray: [],
  206. list: [
  207. {
  208. bg: imgURL + "applyCard/product-bg.png",
  209. icon: imgURL + "applyCard/wechat.png",
  210. title: "【货车】微信车主服务",
  211. tip: "绑定微信支付,无需绑定银行卡",
  212. },
  213. ],
  214. });
  215. </script>
  216. <style lang="scss" scoped>
  217. ::v-deep .u-radio {
  218. display: flex !important;
  219. align-items: center !important;
  220. float: none !important;
  221. }
  222. ::v-deep .u-icon__icon {
  223. top: -4px !important;
  224. }
  225. .bottomTip {
  226. margin-top: 100rpx;
  227. text-align: center;
  228. font-size: 28rpx;
  229. font-family: Microsoft YaHei;
  230. font-weight: 400;
  231. color: #b3b3b3;
  232. }
  233. .content-value {
  234. position: relative;
  235. // margin-top: -50rpx;
  236. padding: 0rpx 30rpx;
  237. position: relative;
  238. .img-pos {
  239. position: absolute;
  240. left: 500rpx;
  241. top: -38rpx;
  242. right: 50rpx;
  243. .img-flex {
  244. display: flex;
  245. justify-content: space-between;
  246. align-items: center;
  247. .car-img {
  248. width: 86rpx;
  249. height: 42rpx;
  250. }
  251. .flag-img {
  252. width: 30rpx;
  253. height: 35rpx;
  254. }
  255. }
  256. }
  257. }
  258. .flex {
  259. display: flex;
  260. align-items: center;
  261. }
  262. .action {
  263. margin-top: 30rpx;
  264. padding-left: 20rpx;
  265. padding-right: 20rpx;
  266. padding-bottom: 30rpx;
  267. .button {
  268. height: 80rpx;
  269. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  270. border-radius: 40rpx;
  271. font-size: 32rpx;
  272. font-weight: 400;
  273. color: #ffffff;
  274. line-height: 80rpx;
  275. }
  276. }
  277. .action-btn {
  278. margin-left: 45rpx;
  279. width: 121rpx;
  280. height: 61rpx;
  281. border: 1px solid rgba(255, 255, 255, 1);
  282. border-radius: 30rpx;
  283. background: rgba(255, 255, 255, 0.2);
  284. text-align: center;
  285. font-size: 30rpx;
  286. font-family: Microsoft YaHei;
  287. font-weight: 400;
  288. color: #ffffff;
  289. line-height: 61rpx;
  290. }
  291. .tag1 {
  292. padding: 5rpx;
  293. background: rgba(0, 179, 139, 0.5);
  294. border-radius: 6rpx;
  295. font-size: 22rpx;
  296. font-family: Microsoft YaHei;
  297. font-weight: 400;
  298. color: #ffffff;
  299. }
  300. .tag3 {
  301. padding: 5rpx;
  302. background: rgba(139, 112, 228, 0.5);
  303. border-radius: 6rpx;
  304. font-size: 22rpx;
  305. font-family: Microsoft YaHei;
  306. font-weight: 400;
  307. color: #ffffff;
  308. }
  309. .tag2 {
  310. padding: 5rpx;
  311. background: rgba(249, 97, 60, 0.5);
  312. border-radius: 6rpx;
  313. font-size: 22rpx;
  314. font-family: Microsoft YaHei;
  315. font-weight: 400;
  316. color: #ffffff;
  317. }
  318. .ul-item {
  319. padding: 5px 20rpx;
  320. display: flex;
  321. align-items: center;
  322. .item-value {
  323. padding: 20rpx;
  324. position: absolute;
  325. display: flex;
  326. align-items: center;
  327. // justify-content: space-around;
  328. width: 80%;
  329. .content {
  330. width: 51%;
  331. .title {
  332. font-size: 32rpx;
  333. font-family: Microsoft YaHei;
  334. font-weight: 400;
  335. color: #ffffff;
  336. }
  337. .tip {
  338. font-size: 24rpx;
  339. font-family: Microsoft YaHei;
  340. font-weight: 400;
  341. color: #ffffff;
  342. }
  343. }
  344. }
  345. .icon-tip {
  346. width: 100rpx;
  347. height: 100rpx;
  348. }
  349. .content {
  350. margin-left: 40rpx;
  351. }
  352. }
  353. .money {
  354. color: white;
  355. // float: right;
  356. }
  357. ::v-deep .u-mode-center-box {
  358. border-radius: 10rpx;
  359. }
  360. .squire {
  361. padding: 30rpx 30rpx 50rpx 50rpx;
  362. }
  363. .mask-close {
  364. text-align: right;
  365. }
  366. .icon-closed {
  367. width: 48rpx;
  368. height: 48rpx;
  369. }
  370. .mask-title {
  371. text-align: center;
  372. font-size: 32rpx;
  373. color: $uni-text-color-black;
  374. margin-bottom: 50rpx;
  375. }
  376. </style>