選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

choice-product.vue 11KB

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