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

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