您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

choice-product.vue 11KB

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