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 11KB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  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 } 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. var data = {
  147. userType: state.userType,
  148. // source: state.sysType, //请求方来源
  149. agencyId: '52010106004',
  150. vanType: state.type
  151. };
  152. const options = {
  153. type: 2,
  154. data: data,
  155. method: "POST",
  156. showLoading: true,
  157. };
  158. console.log("输出内容", options);
  159. request(etcQueryProduct, options).then((res) => {
  160. // console.log(res.bizContent);
  161. const data = stringToJson(res.bizContent);
  162. console.log(data);
  163. state.dataArray = data.list ? data.list : [];
  164. console.log("state.dataArray", state.dataArray);
  165. for (var i = 0; i < state.dataArray.length; i++) {
  166. const cardTypeArr = []
  167. for (var j = 0; j < state.dataArray[i]['releaseProductStandards']['productStandards'].cardType.length; j++) {
  168. if (state.dataArray[i]['releaseProductStandards']['productStandards'].cardType[j] == '1') {
  169. cardTypeArr.push('储值卡')
  170. } else if (state.dataArray[i]['releaseProductStandards']['productStandards'].cardType[j] == '2') {
  171. cardTypeArr.push('记账卡')
  172. } else if (state.dataArray[i]['releaseProductStandards']['productStandards'].cardType[j] == '3') {
  173. cardTypeArr.push('预存卡')
  174. }
  175. }
  176. state.dataArray[i]['releaseProductStandards']['productStandards']['cardTypeArr'] = cardTypeArr.toString()
  177. }
  178. console.log("state.dataArray", state.dataArray)
  179. });
  180. });
  181. //监听页面滚动
  182. onPageScroll((e) => {
  183. scrollTop.value = e.scrollTop;
  184. });
  185. const productReCodeAction = (id) => {
  186. var data = {
  187. productId: id,
  188. orderId: state.orderId,
  189. };
  190. const options = {
  191. type: 2,
  192. data: data,
  193. method: "POST",
  194. showLoading: true,
  195. };
  196. return new Promise(async (resolve, reject) => {
  197. const res = await request(productReCode, options);
  198. const data = stringToJson(res.bizContent);
  199. resolve(data);
  200. }).catch((error) => {
  201. reject(error);
  202. });
  203. };
  204. const state = reactive({
  205. isValueCard: 1, //卡的类型
  206. radiolist1: [], //选择卡的数据列表
  207. choiceCardShow: false, //选择卡的弹出框
  208. isSign: '',
  209. sysType: "",
  210. orderId: "",
  211. userType: 1, //1 个人 2单位
  212. type: 0, //0 客车 1货车
  213. vehiclePlateColor: "",
  214. data: {
  215. show: false,
  216. src: imgURL + "applyCard/edit.png",
  217. },
  218. dataArray: [],
  219. list: [
  220. {
  221. bg: imgURL + "applyCard/product-bg.png",
  222. icon: imgURL + "applyCard/wechat.png",
  223. title: "【货车】微信车主服务",
  224. tip: "绑定微信支付,无需绑定银行卡",
  225. },
  226. ],
  227. fee: 0 //产品金额
  228. });
  229. </script>
  230. <style lang="scss" scoped>
  231. ::v-deep .u-radio {
  232. display: flex !important;
  233. align-items: center !important;
  234. float: none !important;
  235. }
  236. ::v-deep .u-icon__icon {
  237. top: -4px !important;
  238. }
  239. .bottomTip {
  240. margin-top: 100rpx;
  241. text-align: center;
  242. font-size: 28rpx;
  243. font-family: Microsoft YaHei;
  244. font-weight: 400;
  245. color: #b3b3b3;
  246. }
  247. .content-value {
  248. position: relative;
  249. // margin-top: -50rpx;
  250. padding: 0rpx 30rpx;
  251. position: relative;
  252. .img-pos {
  253. position: absolute;
  254. left: 500rpx;
  255. top: -38rpx;
  256. right: 50rpx;
  257. .img-flex {
  258. display: flex;
  259. justify-content: space-between;
  260. align-items: center;
  261. .car-img {
  262. width: 86rpx;
  263. height: 42rpx;
  264. }
  265. .flag-img {
  266. width: 30rpx;
  267. height: 35rpx;
  268. }
  269. }
  270. }
  271. }
  272. .flex {
  273. display: flex;
  274. align-items: center;
  275. }
  276. .action {
  277. margin-top: 30rpx;
  278. padding-left: 20rpx;
  279. padding-right: 20rpx;
  280. padding-bottom: 30rpx;
  281. .button {
  282. height: 80rpx;
  283. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  284. border-radius: 40rpx;
  285. font-size: 32rpx;
  286. font-weight: 400;
  287. color: #ffffff;
  288. line-height: 80rpx;
  289. }
  290. }
  291. .action-btn {
  292. margin-left: 45rpx;
  293. width: 121rpx;
  294. height: 61rpx;
  295. border: 1px solid rgba(255, 255, 255, 1);
  296. border-radius: 30rpx;
  297. background: rgba(255, 255, 255, 0.2);
  298. text-align: center;
  299. font-size: 30rpx;
  300. font-family: Microsoft YaHei;
  301. font-weight: 400;
  302. color: #ffffff;
  303. line-height: 61rpx;
  304. }
  305. .tag1 {
  306. padding: 5rpx;
  307. background: rgba(0, 179, 139, 0.5);
  308. border-radius: 6rpx;
  309. font-size: 22rpx;
  310. font-family: Microsoft YaHei;
  311. font-weight: 400;
  312. color: #ffffff;
  313. }
  314. .tag3 {
  315. padding: 5rpx;
  316. background: rgba(139, 112, 228, 0.5);
  317. border-radius: 6rpx;
  318. font-size: 22rpx;
  319. font-family: Microsoft YaHei;
  320. font-weight: 400;
  321. color: #ffffff;
  322. }
  323. .tag2 {
  324. padding: 5rpx;
  325. background: rgba(249, 97, 60, 0.5);
  326. border-radius: 6rpx;
  327. font-size: 22rpx;
  328. font-family: Microsoft YaHei;
  329. font-weight: 400;
  330. color: #ffffff;
  331. }
  332. .ul-item {
  333. padding: 5px 20rpx;
  334. display: flex;
  335. align-items: center;
  336. .item-value {
  337. padding: 20rpx;
  338. position: absolute;
  339. display: flex;
  340. align-items: center;
  341. // justify-content: space-around;
  342. width: 80%;
  343. .content {
  344. width: 51%;
  345. .title {
  346. font-size: 32rpx;
  347. font-family: Microsoft YaHei;
  348. font-weight: 400;
  349. color: #ffffff;
  350. }
  351. .tip {
  352. font-size: 24rpx;
  353. font-family: Microsoft YaHei;
  354. font-weight: 400;
  355. color: #ffffff;
  356. }
  357. }
  358. }
  359. .icon-tip {
  360. width: 100rpx;
  361. height: 100rpx;
  362. }
  363. .content {
  364. margin-left: 40rpx;
  365. }
  366. }
  367. .money {
  368. color: white;
  369. // float: right;
  370. }
  371. ::v-deep .u-mode-center-box {
  372. border-radius: 10rpx;
  373. }
  374. .squire {
  375. padding: 30rpx 30rpx 50rpx 50rpx;
  376. }
  377. .mask-close {
  378. text-align: right;
  379. }
  380. .icon-closed {
  381. width: 48rpx;
  382. height: 48rpx;
  383. }
  384. .mask-title {
  385. text-align: center;
  386. font-size: 32rpx;
  387. color: $uni-text-color-black;
  388. margin-bottom: 50rpx;
  389. }
  390. </style>