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.4KB

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