selectProduct.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. <template>
  2. <view class="content">
  3. <image style="width: 35rpx;height: 35rpx;position: absolute;right: 40rpx;top:40rpx" @click="closeSelectProduct"
  4. src="@/static/points/closeIcon.png" mode=""></image>
  5. <view class="addressBox">
  6. <uni-icons class="icon location icon-cuo" type="location" size="20" @tap=""></uni-icons>
  7. <text class="name">张三</text>
  8. <text class="address">山西省太原市小店区营盘街道某某小区</text>
  9. <image style="width: 28rpx;height: 28rpx;position: absolute;right: 0;" @click="addressSelectFun"
  10. src="@/static/points/Keyboard_arrow_rifht.png" mode=""></image>
  11. </view>
  12. <view class="productPrice">
  13. <view style="display:flex;justify-content: space-between;">
  14. <view style="display:flex;">
  15. <view>
  16. <image v-if="selectedObj" style="width: 120rpx;height: 120rpx;"
  17. :src="$globalData.publicUrl + selectedObj.image" mode="">
  18. </image>
  19. <image v-else style="width: 120rpx;height: 120rpx;"
  20. :src="$globalData.publicUrl + params.productMainImage" mode="">
  21. </image>
  22. </view>
  23. <view
  24. style="margin-left: 24rpx;display: flex;flex-direction: column;justify-content: space-between;">
  25. <view class="price" v-if="selectedObj">实付价
  26. {{ params.paymentType == 1 ? selectedObj.pricePoint + '积分' :
  27. params.paymentType == 2 ? '¥' + selectedObj.priceMoney + '元' :
  28. params.paymentType == 3 ? '¥' + selectedObj.priceMoney + '元' + '+' +
  29. selectedObj.pricePoint + '积分' : null }}
  30. </view>
  31. <view class="price" v-else>实付价
  32. {{ params.paymentType == 1 ? params.pricePoint + '积分' :
  33. params.paymentType == 2 ? '¥' + params.priceMoney + '元' :
  34. params.paymentType == 3 ? '¥' + params.priceMoney + '元' + '+' +
  35. params.pricePoint + '积分' : null }}
  36. </view>
  37. <view class="spec" v-if="selectedObj">已选:{{ selectedObj.specValueText }} </view>
  38. </view>
  39. </view>
  40. <view class="deletePrice" v-if="selectedObj">{{ selectedObj.originPrice }}元</view>
  41. </view>
  42. </view>
  43. <!--选择规格 -->
  44. <view class="specClass">
  45. <view v-for="arr in specList">
  46. <view class="title">{{ arr[0] }} ({{ Array.from(arr[1]).length }})</view>
  47. <view style="display: flex;flex-wrap: wrap;">
  48. <view class="specCombination" @click="selectedSpecFun(value, arr[0])"
  49. :class="selectedObj ? selectedObj.specValueText.indexOf(value) != -1 ? 'active' : '' : ''"
  50. v-for="value in Array.from(arr[1])">
  51. {{ value }}
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. <!--运费 -->
  57. <view class="yunFeiClass">
  58. <view class="text">运费</view>
  59. <view class="price">¥{{ params.freight }}</view>
  60. </view>
  61. <!--订单备注 -->
  62. <view class="nodeClass">
  63. <view class="text">订单备注</view>
  64. <input type="text" maxlength="200" v-model="orderRemarks" placeholder="选填,请填写您的备注信息,限200字" />
  65. </view>
  66. <!--支付方式 -->
  67. <u-radio-group class="nodeClass" v-model="selectPayMeth" @change="groupChange">
  68. <view style="width: 100%;">
  69. <view style="display: flex;justify-content: space-between;width: 100%;">
  70. <view style="display: flex;">
  71. <image style="width: 40rpx;height: 40rpx;" src="@/static/points/weiXin.png" mode="">
  72. </image>
  73. <view class="text" style="color: #333;margin-left: 16rpx;">微信支付</view>
  74. </view>
  75. <view>
  76. <u-radio activeColor="#03C1B8 " name='1' style="margin: 0;"></u-radio>
  77. </view>
  78. </view>
  79. <view style="display: flex;justify-content: space-between;width: 100%;margin-top: 24rpx;">
  80. <view style="display: flex;">
  81. <image style="width: 40rpx;height: 40rpx;" src="@/static/points/yue.png" mode="">
  82. </image>
  83. <view class="text" style="color: #333;margin-left: 16rpx;">余额支付</view>
  84. </view>
  85. <u-radio activeColor="#03C1B8 " name='2'></u-radio>
  86. </view>
  87. </view>
  88. </u-radio-group>
  89. <view class="footer-bar">
  90. <u-button v-if="!selectedObj" :customStyle="{
  91. color: '#fff',
  92. background: '#03C1B8'
  93. }">请选择</u-button>
  94. <u-button v-else-if="selectedObj && selectedObj.stock" :customStyle="{
  95. color: '#fff',
  96. background: '#03C1B8'
  97. }" @click="redeemNowFun">实付价 {{ params.paymentType == 1 ? selectedObj.pricePoint + '积分' :
  98. params.paymentType == 2 ? '¥' + selectedObj.priceMoney + '元' :
  99. params.paymentType == 3 ? '¥' + selectedObj.priceMoney + '元' + '+' +
  100. selectedObj.pricePoint + '积分' : null }}</u-button>
  101. <u-button v-else-if="selectedObj.stock === 0" :customStyle="{
  102. color: '#999999 ',
  103. background: '#eee'
  104. }">库存不足</u-button>
  105. </view>
  106. </view>
  107. </template>
  108. <script>
  109. export default {
  110. components: {},
  111. props: {
  112. params: {
  113. type: Object,
  114. default: {}
  115. }
  116. },
  117. data() {
  118. return {
  119. orderRemarks:'',
  120. selectPayMeth: '1',
  121. reasonRefusal: '',
  122. showPopup: false,
  123. specValueText: '',
  124. specValuePrice: '',
  125. specList: [],
  126. selectedObj: null
  127. }
  128. },
  129. onLoad(data) {
  130. console.log('555')
  131. },
  132. onShow() {
  133. console.log('555')
  134. },
  135. onPageScroll() {
  136. },
  137. create() {
  138. console.log('55522')
  139. },
  140. computed: {
  141. // specValuePrice() {
  142. // return ;
  143. // }
  144. },
  145. methods: {
  146. //
  147. onShowFun(selectedObj) {
  148. if (selectedObj) {
  149. this.selectedObj = JSON.parse(JSON.stringify(selectedObj))
  150. } else {
  151. this.selectedObj = this.params.specComboVOList[0]
  152. }
  153. const map = new Map();
  154. this.params.specComboVOList.forEach(item => {
  155. item.specNameValueList.forEach(spec => {
  156. const key = spec.specName;
  157. if (!map.has(key)) {
  158. map.set(key, new Set());
  159. }
  160. map.get(key).add(spec.specValue);
  161. });
  162. })
  163. this.specList = Array.from(map)
  164. },
  165. //立即兑换
  166. redeemNowFun() {
  167. this.$emit('redeemNowFun', this.selectedObj ? JSON.parse(JSON.stringify(this.selectedObj)) : null)
  168. },
  169. //点击选规则
  170. selectedSpecFun(specValue, specName) {
  171. if (this.selectedObj) {
  172. let selectedObj = JSON.parse(JSON.stringify(this.selectedObj))
  173. let specValueT
  174. selectedObj.specNameValueList.forEach((e, i) => {
  175. if (e.specName == specName) {
  176. specValueT = e.specValue
  177. }
  178. })
  179. selectedObj.specValues.forEach((r, n) => {
  180. if (r == specValueT) {
  181. selectedObj.specValues.splice(n, 1)
  182. }
  183. })
  184. this.params.specComboVOList.forEach((item, index) => {
  185. if (item.specValueText.indexOf(specValue) != -1 && item.specValueText.indexOf(selectedObj.specValues.toString()) != -1) {
  186. this.selectedObj = item
  187. }
  188. })
  189. }
  190. //console.log(this.selectedObj, 'this.selectedObj')
  191. //console.log(specValue, specName, 'value,specName')
  192. },
  193. //关闭选择商品页
  194. closeSelectProduct() {
  195. this.$emit('closeSelectProduct', this.selectedObj ? JSON.parse(JSON.stringify(this.selectedObj)) : null)
  196. },
  197. //去我的地址页面
  198. addressSelectFun() {
  199. uni.navigateTo({
  200. url: '/points/productDetails/addressManagement'
  201. });
  202. }
  203. }
  204. }
  205. </script>
  206. <style lang="scss" scoped>
  207. .content {
  208. background-color: #F5F8F8;
  209. padding: 24rpx 32rpx 0 32rpx;
  210. font-family: PingFang SC, PingFang SC;
  211. height: 1350rpx;
  212. border-radius: 20rpx 20rpx 0 0;
  213. .addressBox {
  214. position: relative;
  215. margin-top: 70rpx;
  216. display: flex;
  217. align-items: center;
  218. border-radius: 20rpx 20rpx 20rpx 20rpx;
  219. .name {
  220. margin: 0 24rpx;
  221. font-weight: 500;
  222. font-size: 32rpx;
  223. color: #333333;
  224. line-height: 40rpx;
  225. text-align: left;
  226. font-style: normal;
  227. text-transform: none;
  228. }
  229. .address {
  230. font-weight: 500;
  231. font-size: 28rpx;
  232. color: #333333;
  233. text-align: left;
  234. font-style: normal;
  235. text-transform: none;
  236. }
  237. }
  238. .productPrice {
  239. background-color: #fff;
  240. margin-top: 24rpx;
  241. padding: 24rpx;
  242. border-radius: 20rpx 20rpx 20rpx 20rpx;
  243. .price {
  244. font-weight: bold;
  245. font-size: 28rpx;
  246. color: #03C1B8;
  247. text-align: left;
  248. font-style: normal;
  249. text-transform: none;
  250. }
  251. .spec {
  252. font-weight: 500;
  253. font-size: 26rpx;
  254. color: #999999;
  255. text-align: left;
  256. font-style: normal;
  257. text-transform: none;
  258. }
  259. .deletePrice {
  260. font-weight: 500;
  261. font-size: 32rpx;
  262. color: #666666;
  263. text-align: left;
  264. font-style: normal;
  265. text-decoration-line: line-through;
  266. text-transform: none;
  267. }
  268. }
  269. .specClass {
  270. background-color: #fff;
  271. margin-top: 24rpx;
  272. padding: 0 24rpx 24rpx 24rpx;
  273. border-radius: 20rpx 20rpx 20rpx 20rpx;
  274. .title {
  275. padding-top: 24rpx;
  276. font-weight: bold;
  277. font-size: 28rpx;
  278. color: #333333;
  279. text-align: left;
  280. font-style: normal;
  281. text-transform: none;
  282. }
  283. .specCombination {
  284. font-weight: 500;
  285. font-size: 24rpx;
  286. color: #666666;
  287. text-align: left;
  288. font-style: normal;
  289. text-transform: none;
  290. height: 56rpx;
  291. background: #F0F0F0;
  292. border-radius: 38rpx 38rpx 38rpx 38rpx;
  293. margin-right: 16rpx;
  294. padding: 8rpx 16rpx;
  295. margin-top: 24rpx;
  296. }
  297. .active {
  298. background: #03C1B8;
  299. border-radius: 38rpx 38rpx 38rpx 38rpx;
  300. color: #fff;
  301. }
  302. }
  303. .yunFeiClass {
  304. display: flex;
  305. justify-content: space-between;
  306. height: 92rpx;
  307. background: #FFFFFF;
  308. border-radius: 20rpx 20rpx 20rpx 20rpx;
  309. margin-top: 24rpx;
  310. align-items: center;
  311. padding: 24rpx;
  312. .text {
  313. font-weight: 500;
  314. font-size: 28rpx;
  315. color: #666666;
  316. line-height: 40rpx;
  317. text-align: left;
  318. font-style: normal;
  319. text-transform: none;
  320. }
  321. }
  322. ::v-deep .nodeClass {
  323. margin-top: 24rpx;
  324. padding: 24rpx;
  325. background: #FFFFFF;
  326. border-radius: 20rpx 20rpx 20rpx 20rpx;
  327. display: flex;
  328. align-items: center;
  329. justify-content: space-between;
  330. .u-radio__icon-wrap {
  331. margin: 0;
  332. }
  333. .text {
  334. width: 115rpx;
  335. font-weight: 500;
  336. font-size: 28rpx;
  337. color: #666666;
  338. line-height: 40rpx;
  339. text-align: left;
  340. }
  341. input {
  342. font-weight: 500;
  343. font-size: 26rpx;
  344. color: #999999;
  345. line-height: 40rpx;
  346. text-align: right;
  347. font-style: normal;
  348. text-transform: none;
  349. width: 450rpx;
  350. }
  351. }
  352. }
  353. .footer-bar {
  354. .u-button {
  355. width: 670rpx;
  356. height: 84rpx;
  357. border-radius: 98rpx 98rpx 98rpx 98rpx;
  358. margin: 20rpx 40rpx;
  359. background: '#000';
  360. }
  361. }
  362. </style>