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

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