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

choice-product.vue 11KB

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