Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

productSelection.vue 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <view>
  3. <custom-header :back="false" title="选择产品"></custom-header>
  4. <view style="padding: 20rpx 0 30rpx" class="product-content">
  5. <!-- 获取产品展示 -->
  6. <view class="product-car" v-for='(item,index) in productList' @click="handleProduct(item)" :key='index'>
  7. <view class="left-amount">
  8. ¥: {{ item.fee * 0.01 }}
  9. </view>
  10. <view class="r-info">
  11. <view class="goods-name">
  12. {{ item.promoteName }}
  13. </view>
  14. <view class="goods-des">
  15. {{ item.cardTypeArr }}
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. <u-modal v-model="show" :show-confirm-button='false' title='请选择办理车辆类型'>
  21. <view class="slot-content">
  22. <view class="select-content">
  23. <view class="select-item" @click="handleVanType(1)">
  24. <image :src="fileURL + 'image/index/icon-car.png'" mode="aspectFit" class='select-img'></image>
  25. <view>客车办理</view>
  26. </view>
  27. <view class="fen">
  28. </view>
  29. <view class="select-item" @click="handleVanType(2)">
  30. <image :src="fileURL + 'image/index/icon-truck.png'" mode="aspectFit" class='select-img'>
  31. </image>
  32. <view>货车办理</view>
  33. </view>
  34. </view>
  35. </view>
  36. </u-modal>
  37. </view>
  38. </template>
  39. <script setup lang='ts'>
  40. import {
  41. unifyTemplate
  42. } from '@/hooks/unifyTemplate'
  43. import {
  44. nextTick,
  45. ref,
  46. } from 'vue'
  47. import {
  48. onLoad
  49. } from '@dcloudio/uni-app';
  50. import {
  51. request
  52. } from '@/utils/network/request'
  53. import {
  54. fileURL
  55. } from '@/utils/network/api.js';
  56. let config = ref < any > ({
  57. submitName: '下一步',
  58. titleWidth: 160
  59. })
  60. const {
  61. CustomHeader, //头部组件
  62. initData, //初始化数据
  63. qdOrderVal, //qdOrder中数据 ref
  64. cusQdOrderVal
  65. } = unifyTemplate() //初始化数据
  66. let show = ref(false)
  67. //获取页面配置
  68. onLoad((opin) => {
  69. initData(opin, -2).then(data => {
  70. console.log(data);
  71. if (data.qdOrder.vanType === undefined) {
  72. // 不存在客户类型,开启弹窗
  73. setTimeout(() => {
  74. show.value = true
  75. }, 200)
  76. } else {
  77. setTimeout(() => {
  78. show.value = false
  79. }, 200)
  80. getList(data.qdOrder.vanType > 2 ? 2 : data.qdOrder.vanType)
  81. }
  82. // isShow.value = true
  83. delete data.config.tableConfig
  84. config.value = Object.assign(data.config, config.value)
  85. })
  86. })
  87. const productList = ref([])
  88. // 获取产品
  89. function getList(vanType) {
  90. // let data = {
  91. // type: vanType,
  92. // agencyId: qdOrderVal.value.promoterChannelNum
  93. // }
  94. //
  95. // 请求数据
  96. let data = {
  97. type: 1,
  98. agencyId: '52010188919'
  99. }
  100. request('58ac9653fdb24ee08409f94dde70dfa6', {
  101. data
  102. }).then((res) => {
  103. if (res.statusCode === 0) {
  104. const data = JSON.parse(res.bizContent);
  105. console.log(res, data);
  106. let cardTypeArr = ''
  107. let opt = {
  108. 1: '记账卡',
  109. 2: '储值卡',
  110. 3: '记存卡'
  111. }
  112. data.csmsnPromoteDistPro.forEach(ele => {
  113. ele.cardType.forEach(item => {
  114. cardTypeArr = cardTypeArr + ' ' + opt[item]
  115. console.log(opt[item]);
  116. })
  117. ele.cardTypeArr= cardTypeArr
  118. })
  119. productList.value = data.csmsnPromoteDistPro || []
  120. }
  121. })
  122. }
  123. // 客货类型选择
  124. function handleVanType(type) {
  125. console.log(type);
  126. cusQdOrderVal.value.vanType = type
  127. getList(type)
  128. show.value = false
  129. // let {
  130. // jumpPage
  131. // } = config.value
  132. // uni.navigateTo({
  133. // url: '/' + jumpPage,
  134. // animationType: 'pop-in',
  135. // animationDuration: 500
  136. // })
  137. }
  138. // 产品选择
  139. function handleProduct(e) {
  140. cusQdOrderVal.value.promoteId = e.promoteId
  141. let {
  142. jumpPage
  143. } = config.value
  144. uni.navigateTo({
  145. url: '/' + jumpPage,
  146. animationType: 'pop-in',
  147. animationDuration: 500
  148. })
  149. // return
  150. // request(commitInterface || '198172b1858d474fa8e35225d65014d7', {
  151. // data,
  152. // }).then((res) => {
  153. // if (res.statusCode === 0) {
  154. // uni.navigateTo({
  155. // url: '/' + jumpPage,
  156. // animationType: 'pop-in',
  157. // animationDuration: 500
  158. // })
  159. // }
  160. // })
  161. }
  162. </script>
  163. <style lang='scss' scoped>
  164. .product-content {}
  165. .product-car {
  166. margin: 30rpx 30rpx 0;
  167. width: calc(100% - 60rpx);
  168. height: 200rpx;
  169. border-radius: 20rpx;
  170. background-color: #73acf9;
  171. display: flex;
  172. justify-content: space-between;
  173. align-items: center;
  174. .left-amount {
  175. font-size: 70rpx;
  176. color: #fff;
  177. padding-left: 20rpx;
  178. }
  179. .r-info {
  180. padding-right: 20rpx;
  181. text-align: right;
  182. color: #fff;
  183. .goods-name {
  184. margin-bottom: 20rpx;
  185. font-size: 32rpx;
  186. }
  187. .goods-des {
  188. font-size: 26rpx;
  189. }
  190. }
  191. }
  192. .select-content {
  193. display: flex;
  194. align-items: center;
  195. padding: 30rpx;
  196. .fen {
  197. width: 2rpx;
  198. height: 150rpx;
  199. background-color: #eee;
  200. }
  201. .select-item {
  202. flex: 1 1 auto;
  203. text-align: center;
  204. .select-img {
  205. width: 120rpx;
  206. height: 120rpx;
  207. margin-bottom: 20rpx;
  208. }
  209. }
  210. }
  211. </style>