Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

productSelection - 副本.vue 6.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <view>
  3. <custom-header :back="false" title="选择产品"></custom-header>
  4. <view style="padding: 20rpx 0 30rpx" class="product-content">
  5. <view
  6. class="product-car"
  7. v-for="(item, index) in productList"
  8. @click="handleProduct(item)"
  9. :key="index"
  10. :class="{ isWing: item.status === '已支付' }"
  11. >
  12. <view class="l-info">
  13. <view class="goods-name">
  14. {{ item.promoteName }}
  15. </view>
  16. <view class="goods-des">
  17. {{ item.cardTypeArr }}
  18. </view>
  19. </view>
  20. <!-- <view class="r-amount">¥: {{ item.fee * 0.01 }}</view> -->
  21. </view>
  22. </view>
  23. <view class="empty" v-if="!loaing && productList.length === 0">
  24. 暂无办理产品,请敬请期待
  25. </view>
  26. <u-modal
  27. v-model="show"
  28. :show-confirm-button="false"
  29. title="请选择办理车辆类型"
  30. >
  31. <view class="slot-content">
  32. <view class="select-content">
  33. <view class="select-item" @click="handleVanType(1)">
  34. <image
  35. :src="fileURL + 'image/index/icon-car.png'"
  36. mode="aspectFit"
  37. class="select-img"
  38. ></image>
  39. <view>客车办理</view>
  40. </view>
  41. <view class="fen"></view>
  42. <view class="select-item" @click="handleVanType(2)">
  43. <image
  44. :src="fileURL + 'image/index/icon-truck.png'"
  45. mode="aspectFit"
  46. class="select-img"
  47. ></image>
  48. <view>货车办理</view>
  49. </view>
  50. </view>
  51. </view>
  52. </u-modal>
  53. <u-modal
  54. v-model="isUserTypeshow"
  55. :show-confirm-button="false"
  56. title="请选择ETC用户类型"
  57. >
  58. <view class="slot-content">
  59. <view class="select-content">
  60. <view class="select-item" @click="handleUserType(1)">
  61. <image
  62. :src="fileURL + 'image/index/icon-personal.png'"
  63. mode="aspectFit"
  64. class="select-img"
  65. ></image>
  66. <view>个人办理</view>
  67. </view>
  68. <view class="fen"></view>
  69. <view class="select-item" @click="handleUserType(2)">
  70. <image
  71. :src="fileURL + 'image/index/icon-unit.png'"
  72. mode="aspectFit"
  73. class="select-img"
  74. ></image>
  75. <view>单位办理</view>
  76. </view>
  77. </view>
  78. </view>
  79. </u-modal>
  80. </view>
  81. </template>
  82. <script setup lang="ts">
  83. import { unifyTemplate } from '@/hooks/unifyTemplate';
  84. import { ref } from 'vue';
  85. import { onLoad } from '@dcloudio/uni-app';
  86. import { request } from '@/utils/network/request';
  87. import { fileURL } from '@/utils/network/api.js';
  88. let config = ref<any>({
  89. submitName: '下一步',
  90. titleWidth: 160
  91. });
  92. const {
  93. CustomHeader, //头部组件
  94. initData, //初始化数据
  95. qdOrderVal, //qdOrder中数据 ref
  96. cusQdOrderVal
  97. } = unifyTemplate(); //初始化数据
  98. let show = ref(false);
  99. //获取页面配置
  100. onLoad((opin) => {
  101. initData(opin, -2).then((data) => {
  102. console.log(data);
  103. // getLoti()
  104. if (data.qdOrder.vanType === undefined) {
  105. // 不存在客户类型,开启弹窗
  106. setTimeout(() => {
  107. show.value = true;
  108. }, 200);
  109. } else {
  110. setTimeout(() => {
  111. show.value = false;
  112. }, 200);
  113. handleUserTypeShow();
  114. }
  115. // isShow.value = true
  116. delete data.config.tableConfig;
  117. config.value = Object.assign(data.config, config.value);
  118. });
  119. });
  120. const productList = ref([]);
  121. const loaing = ref(true);
  122. // 获取产品
  123. function getList() {
  124. // 请求数据
  125. let data = {
  126. // type: 1,
  127. // agencyId: '52010188919'
  128. agencyId: qdOrderVal.value.promoterChannelNum,
  129. vanType: qdOrderVal.value.vanType || cusQdOrderVal.value.vanType,
  130. userType: qdOrderVal.value.userType || cusQdOrderVal.value.userType
  131. };
  132. // request('58ac9653fdb24ee08409f94dde70dfa6', {
  133. console.log('请求参数', data);
  134. request('f01002fa6ded4162afaec1139e503641', {
  135. data
  136. })
  137. .then((res) => {
  138. if (res.statusCode === 0) {
  139. const data = JSON.parse(res.bizContent);
  140. console.log(res, data, '产品数据');
  141. let opt = {
  142. 1: '记账卡',
  143. 2: '储值卡',
  144. 3: '记存卡'
  145. };
  146. let proList = data.list || [];
  147. proList.forEach((ele) => {
  148. let cardTypeArr = '';
  149. ele.releaseProductStandards.productStandards.cardType.forEach(
  150. (item) => {
  151. cardTypeArr = cardTypeArr + ' ' + opt[item];
  152. console.log(opt[item]);
  153. }
  154. );
  155. ele.cardTypeArr = cardTypeArr;
  156. });
  157. productList.value = proList;
  158. }
  159. })
  160. .finally(() => {
  161. loaing.value = false;
  162. });
  163. }
  164. // 客货类型选择
  165. function handleVanType(type) {
  166. console.log(type);
  167. cusQdOrderVal.value.vanType = type;
  168. handleUserTypeShow();
  169. show.value = false;
  170. }
  171. let isUserTypeshow = ref(false);
  172. function handleUserTypeShow() {
  173. if (!qdOrderVal.value.userType) {
  174. isUserTypeshow.value = true;
  175. } else {
  176. getList();
  177. }
  178. }
  179. // 用户类型选择
  180. function handleUserType(val) {
  181. cusQdOrderVal.value.userType = val;
  182. isUserTypeshow.value = false;
  183. getList();
  184. }
  185. // 产品选择
  186. function handleProduct(e) {
  187. cusQdOrderVal.value.promoteId = e.promoteId;
  188. // let { jumpPage } = config.value;
  189. uni.navigateTo({
  190. url: '/pages/equitySelection/equitySelection?price=' + e.fee,
  191. animationType: 'pop-in',
  192. animationDuration: 500
  193. });
  194. // let userAgent = navigator.userAgent.toLowerCase();
  195. // console.log(userAgent, 'userAgent');
  196. // if (
  197. // userAgent.indexOf('miniprogram') > -1 ||
  198. // userAgent.indexOf('webview') > -1
  199. // ) {
  200. // // 小程序环境
  201. // console.log('小程序环境');
  202. // if (userAgent.indexOf('wechat') > -1 || userAgent.indexOf('wx') > -1) {
  203. // // 微信小程序
  204. // console.log('微信小程序');
  205. // }
  206. // //else{
  207. // // // this.juti = '其他小程序'
  208. // // }
  209. // }
  210. }
  211. function getLoti() {
  212. console.log('获取经纬度111');
  213. uni.getLocation({
  214. type: 'gcj02',
  215. // type: 'wgs84',
  216. accuracy: 'best',
  217. isHighAccuracy: true,
  218. success: function (res) {
  219. console.log('当前位置的经度高德:' + res.longitude);
  220. console.log('当前位置的纬度高德:' + res.latitude);
  221. console.log(res);
  222. },
  223. fail: (error) => {
  224. console.error('err:', error);
  225. }
  226. });
  227. }
  228. </script>
  229. <style lang="scss" scoped>
  230. .product-content {
  231. }
  232. .empty{
  233. text-align: center;
  234. margin-top: 40rpx;
  235. }
  236. .product-car {
  237. margin: 30rpx 30rpx 0;
  238. width: calc(100% - 60rpx);
  239. height: 170rpx;
  240. border-radius: 20rpx;
  241. background-color: #57aef9;
  242. display: flex;
  243. justify-content: space-between;
  244. box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;
  245. align-items: center;
  246. padding: 0 40rpx;
  247. .l-info {
  248. color: #fff;
  249. .goods-name {
  250. margin-bottom: 16rpx;
  251. font-size: 32rpx;
  252. font-weight: bold;
  253. }
  254. .goods-des {
  255. font-size: 26rpx;
  256. }
  257. }
  258. .r-amount {
  259. font-size: 38rpx;
  260. color: #fff;
  261. padding-left: 20rpx;
  262. font-weight: bold;
  263. }
  264. }
  265. .select-content {
  266. display: flex;
  267. align-items: center;
  268. padding: 30rpx;
  269. .fen {
  270. width: 2rpx;
  271. height: 150rpx;
  272. background-color: #eee;
  273. }
  274. .select-item {
  275. flex: 1 1 auto;
  276. text-align: center;
  277. .select-img {
  278. width: 120rpx;
  279. height: 120rpx;
  280. margin-bottom: 20rpx;
  281. }
  282. }
  283. }
  284. </style>