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

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