|
|
@@ -1,15 +1,15 @@
|
|
1
|
1
|
<script setup lang="ts">
|
|
2
|
|
-import {getUserAddressDetail, getUserAddressList, getUserVipInfo} from "~/apis/user";
|
|
3
|
|
-import {reactive} from "vue";
|
|
4
|
|
-import {cartChange, checkProductDaCang, CreateOrderRequest, orderCheck, orderCreate} from "~/apis/order.api";
|
|
|
2
|
+import { getUserAddressDetail, getUserAddressList, getUserVipInfo } from "~/apis/user";
|
|
|
3
|
+import { reactive } from "vue";
|
|
|
4
|
+import { cartChange, checkProductDaCang, CreateOrderRequest, orderCheck, orderCreate } from "~/apis/order.api";
|
|
5
|
5
|
import CXBBasePage from "~/components/CXBBasePage/CXBBasePage.vue";
|
|
6
|
6
|
import FPrice from "~/components/FPrice/FPrice.vue";
|
|
7
|
7
|
import CXBYaojinTag from "~/components/CXBYaojinTag/CXBYaojinTag.vue";
|
|
8
|
8
|
import FCell from "~/components/FCell/FCell.vue";
|
|
9
|
|
-import {encodePhone} from "~/utils";
|
|
10
|
|
-import {CDN_URL} from "~/config/app";
|
|
11
|
|
-import {useAddressStore} from "~/stores/addressStore";
|
|
12
|
|
-import {useThrottle} from "@vueuse/core";
|
|
|
9
|
+import { encodePhone } from "~/utils";
|
|
|
10
|
+import { CDN_URL } from "~/config/app";
|
|
|
11
|
+import { useAddressStore } from "~/stores/addressStore";
|
|
|
12
|
+import { useThrottle } from "@vueuse/core";
|
|
13
|
13
|
import FField from "~/components/FField/FField.vue";
|
|
14
|
14
|
const addressIcon = CDN_URL + '/static/assets/dingwi_220624.png'
|
|
15
|
15
|
// const addressInfo = ref({})
|
|
|
@@ -60,7 +60,7 @@ onLoad(async (options) => {
|
|
60
|
60
|
// })
|
|
61
|
61
|
// }
|
|
62
|
62
|
const res = await getUserAddressList()
|
|
63
|
|
- console.log('我可是res啊',res)
|
|
|
63
|
+ console.log('我可是res啊', res)
|
|
64
|
64
|
if (res.list && res.list.length > 0) {
|
|
65
|
65
|
data.addressInfo = res.list[0]
|
|
66
|
66
|
data.addressId = res.list[0].address_id
|
|
|
@@ -90,7 +90,7 @@ onLoad(async (options) => {
|
|
90
|
90
|
cart_id: data.cartId.split(','),
|
|
91
|
91
|
address_id: data.addressId
|
|
92
|
92
|
}).then(res => {
|
|
93
|
|
- console.log(15999999,res)
|
|
|
93
|
+ console.log(15999999, res)
|
|
94
|
94
|
data.is_dacang_vip_product = res.is_dacang_vip_product
|
|
95
|
95
|
data.cartOrder = res.order
|
|
96
|
96
|
data.totalPrice = res.order_price
|
|
|
@@ -147,9 +147,9 @@ function handleSubmit() {
|
|
147
|
147
|
// 优惠券
|
|
148
|
148
|
// coupon:
|
|
149
|
149
|
// pay_type;//支付方式:0: 余额;1: 微信;2: 小程序;4: 支付宝;5: 特殊商户积分
|
|
150
|
|
- pay_type: data.type && data.type == '3' ? '5' : '2',
|
|
|
150
|
+ pay_type: data.type && data.type == '3' ? '5' : '2',
|
|
151
|
151
|
// pay_type: data.type,
|
|
152
|
|
- mer_id: data.type && data.type == '3' ? '148': '',
|
|
|
152
|
+ mer_id: data.type && data.type == '3' ? '148' : '',
|
|
153
|
153
|
// 用户留言
|
|
154
|
154
|
mark: data.mark,
|
|
155
|
155
|
// take: [],
|
|
|
@@ -189,8 +189,8 @@ function payment(createOrderData: CreateOrderRequest) {
|
|
189
|
189
|
}, 500)
|
|
190
|
190
|
})
|
|
191
|
191
|
// uni.navigateTo({
|
|
192
|
|
- // // url: '/pages/payment/index?' + `cardId=${data.cartId}&type=1&product_id=${data.productId}`
|
|
193
|
|
- // url: '/pages/payment/index?' + `pay_price=${res.groupOrder.pay_price}&order_id=${res.order_id}&OrderList=${JSON.stringify(res.groupOrder)}`
|
|
|
192
|
+ // // url: '/pages/payment/index?' + `cardId=${data.cartId}&type=1&product_id=${data.productId}`
|
|
|
193
|
+ // url: '/pages/payment/index?' + `pay_price=${res.groupOrder.pay_price}&order_id=${res.order_id}&OrderList=${JSON.stringify(res.groupOrder)}`
|
|
194
|
194
|
// })
|
|
195
|
195
|
}
|
|
196
|
196
|
}).catch(err => {
|
|
|
@@ -247,12 +247,12 @@ function reTotal() {
|
|
247
|
247
|
cart_id: data.cartId.split(','),
|
|
248
|
248
|
address_id: data.addressId
|
|
249
|
249
|
}).then(res => {
|
|
250
|
|
- console.log('我可是res啊',res)
|
|
|
250
|
+ console.log('我可是res啊', res)
|
|
251
|
251
|
data.is_dacang_vip_product = res.is_dacang_vip_product
|
|
252
|
252
|
data.cartOrder = res.order
|
|
253
|
|
- console.log('data.cartOrder',data.cartOrder);
|
|
254
|
|
-
|
|
255
|
|
-
|
|
|
253
|
+ console.log('data.cartOrder', data.cartOrder);
|
|
|
254
|
+
|
|
|
255
|
+
|
|
256
|
256
|
data.totalPrice = res.order_price
|
|
257
|
257
|
data.orderStatus = res.status
|
|
258
|
258
|
// data.proPrice = res.proPrice
|
|
|
@@ -287,124 +287,110 @@ function reTotal() {
|
|
287
|
287
|
}
|
|
288
|
288
|
</script>
|
|
289
|
289
|
<template>
|
|
290
|
|
- <div class="p-3 flex flex-col gap-3 pb-safe">
|
|
291
|
|
- <div
|
|
292
|
|
- @click="handleAddressSelect"
|
|
293
|
|
- class="rounded bg-white p-3 flex">
|
|
294
|
|
- <div class="flex flex-col flex-1 gap-2">
|
|
295
|
|
- <div class="flex items-center gap-2">
|
|
296
|
|
- <div class="flex text-sm text-gray-500 justify-between items-center w-full">
|
|
297
|
|
- <div class="flex-1 flex items-center gap-2">
|
|
298
|
|
- <div class="w-fit flex">
|
|
299
|
|
- <image :src="addressIcon" mode="aspectFit" class="w-4 h-4"></image>
|
|
300
|
|
- </div>
|
|
301
|
|
- <div class="flex-1 flex" v-if="data.addressId">
|
|
302
|
|
- {{ data.addressInfo.province + ' ' + data.addressInfo.city + ' ' + data.addressInfo.district + ' ' + data.addressInfo.detail }}
|
|
303
|
|
- </div>
|
|
304
|
|
- <div v-else class="flex-1 flex">
|
|
305
|
|
- 请选择收货地址
|
|
306
|
|
- </div>
|
|
|
290
|
+ <div class="p-3 flex flex-col gap-3 pb-safe">
|
|
|
291
|
+ <div @click="handleAddressSelect" class="rounded bg-white p-3 flex">
|
|
|
292
|
+ <div class="flex flex-col flex-1 gap-2">
|
|
|
293
|
+ <div class="flex items-center gap-2">
|
|
|
294
|
+ <div class="flex text-sm text-gray-500 justify-between items-center w-full">
|
|
|
295
|
+ <div class="flex-1 flex items-center gap-2">
|
|
|
296
|
+ <div class="w-fit flex">
|
|
|
297
|
+ <image :src="addressIcon" mode="aspectFit" class="w-4 h-4"></image>
|
|
|
298
|
+ </div>
|
|
|
299
|
+ <div class="flex-1 flex" v-if="data.addressId">
|
|
|
300
|
+ {{ data.addressInfo.province + ' ' + data.addressInfo.city + ' ' + data.addressInfo.district + ' ' +
|
|
|
301
|
+ data.addressInfo.detail }}
|
|
307
|
302
|
</div>
|
|
|
303
|
+ <div v-else class="flex-1 flex">
|
|
|
304
|
+ 请选择收货地址
|
|
|
305
|
+ </div>
|
|
|
306
|
+ </div>
|
|
308
|
307
|
|
|
309
|
|
- <div class="w-4 flex i-tabler-chevron-right text-gray"></div>
|
|
|
308
|
+ <div class="w-4 flex i-tabler-chevron-right text-gray"></div>
|
|
310
|
309
|
|
|
311
|
|
- </div>
|
|
312
|
310
|
</div>
|
|
313
|
|
-<!-- <div class="flex text-sm font-bold">{{ data.addressInfo.detail }}</div>-->
|
|
314
|
|
- <div class="flex gap-2 items-center text-xs text-gray-500">
|
|
315
|
|
- <div>
|
|
316
|
|
- {{ data.addressInfo.real_name }}
|
|
317
|
|
- </div>
|
|
318
|
|
- <div v-if="data.addressInfo && data.addressInfo.phone">
|
|
319
|
|
- {{ encodePhone(data.addressInfo.phone) }}
|
|
320
|
|
- </div>
|
|
|
311
|
+ </div>
|
|
|
312
|
+ <!-- <div class="flex text-sm font-bold">{{ data.addressInfo.detail }}</div>-->
|
|
|
313
|
+ <div class="flex gap-2 items-center text-xs text-gray-500">
|
|
|
314
|
+ <div>
|
|
|
315
|
+ {{ data.addressInfo.real_name }}
|
|
|
316
|
+ </div>
|
|
|
317
|
+ <div v-if="data.addressInfo && data.addressInfo.phone">
|
|
|
318
|
+ {{ encodePhone(data.addressInfo.phone) }}
|
|
321
|
319
|
</div>
|
|
322
|
320
|
</div>
|
|
323
|
321
|
</div>
|
|
|
322
|
+ </div>
|
|
324
|
323
|
|
|
325
|
|
- <div class="pb-15">
|
|
326
|
|
- <div v-for="(item, index) in data.cartOrder" :key="index"
|
|
327
|
|
- class=" bg-white rounded"
|
|
328
|
|
- >
|
|
329
|
|
- <div class="flex items-center gap-2 text-sm font-bold f-hairline-bottom p-3">
|
|
330
|
|
- <image :src="item.mer_avatar" mode="widthFix" class="w-5 h-5"></image>
|
|
331
|
|
- <div>{{ item.mer_name }}</div>
|
|
332
|
|
-<!-- <div>{{ item.mer_id}}</div>-->
|
|
333
|
|
- </div>
|
|
334
|
|
-
|
|
335
|
|
- <div v-for="(orderProductItem, orderProductItemIndex) in item.list" :key="orderProductItemIndex">
|
|
336
|
|
- <div class="p-3 flex gap-3 f-hairline-bottom">
|
|
337
|
|
- <div>
|
|
338
|
|
- <image :src="orderProductItem.product.image" mode="aspectFit" class="rounded w-20 h-20"></image>
|
|
|
324
|
+ <div class="pb-15">
|
|
|
325
|
+ <div v-for="(item, index) in data.cartOrder" :key="index" class=" bg-white rounded">
|
|
|
326
|
+ <div class="flex items-center gap-2 text-sm font-bold f-hairline-bottom p-3">
|
|
|
327
|
+ <image :src="item.mer_avatar" mode="widthFix" class="w-5 h-5"></image>
|
|
|
328
|
+ <div>{{ item.mer_name }}</div>
|
|
|
329
|
+ <!-- <div>{{ item.mer_id}}</div>-->
|
|
|
330
|
+ </div>
|
|
339
|
331
|
|
|
340
|
|
- </div>
|
|
341
|
|
- <div class="flex flex-col w-full">
|
|
342
|
|
- <div class="flex flex-col ">
|
|
343
|
|
- <div class="line-clamp-1 text-xs">
|
|
344
|
|
- {{ orderProductItem.product.store_name }}
|
|
345
|
|
- </div>
|
|
346
|
|
- <div class="text-[11px] text-gray-500">{{ orderProductItem.productAttr.sku }}</div>
|
|
347
|
|
- </div>
|
|
348
|
|
- <div class="flex">
|
|
349
|
|
- <CXBYaojinTag :amount="orderProductItem.yanglao" v-if="item.mer_id != '148'"/>
|
|
|
332
|
+ <div v-for="(orderProductItem, orderProductItemIndex) in item.list" :key="orderProductItemIndex">
|
|
|
333
|
+ <div class="p-3 flex gap-3 f-hairline-bottom">
|
|
|
334
|
+ <div>
|
|
|
335
|
+ <image :src="orderProductItem.product.image" mode="aspectFit" class="rounded w-20 h-20"></image>
|
|
350
|
336
|
|
|
|
337
|
+ </div>
|
|
|
338
|
+ <div class="flex flex-col w-full">
|
|
|
339
|
+ <div class="flex flex-col ">
|
|
|
340
|
+ <div class="line-clamp-1 text-xs">
|
|
|
341
|
+ {{ orderProductItem.product.store_name }}
|
|
351
|
342
|
</div>
|
|
352
|
|
- <div class="flex justify-between ">
|
|
353
|
|
- <div v-if="item.mer_id != '148'" style="color:#fa4032" >¥{{ orderProductItem.productAttr.price }}</div>
|
|
354
|
|
- <div v-if="item.mer_id == '148'" style="color:#fa4032">{{ orderProductItem.productAttr.price * 30 }}积分</div>
|
|
355
|
|
- <nut-input-number v-model="orderProductItem.cart_num" @change="(num) => handleNumberChange(num, orderProductItem)"/>
|
|
|
343
|
+ <div class="text-[11px] text-gray-500">{{ orderProductItem.productAttr.sku }}</div>
|
|
|
344
|
+ </div>
|
|
|
345
|
+ <div class="flex">
|
|
|
346
|
+ <CXBYaojinTag :amount="orderProductItem.yanglao" v-if="item.mer_id != '148'" />
|
|
356
|
347
|
|
|
357
|
|
- </div>
|
|
358
|
348
|
</div>
|
|
|
349
|
+ <div class="flex justify-between ">
|
|
|
350
|
+ <div v-if="item.mer_id != '148'" style="color:#fa4032">¥{{ orderProductItem.productAttr.price }}</div>
|
|
|
351
|
+ <div v-if="item.mer_id == '148'" style="color:#fa4032">{{ Math.round(orderProductItem.productAttr.price *
|
|
|
352
|
+ 30) }}积分</div>
|
|
|
353
|
+ <nut-input-number v-model="orderProductItem.cart_num"
|
|
|
354
|
+ @change="(num) => handleNumberChange(num, orderProductItem)" />
|
|
359
|
355
|
|
|
|
356
|
+ </div>
|
|
360
|
357
|
</div>
|
|
361
|
358
|
|
|
362
|
359
|
</div>
|
|
363
|
|
- <div>
|
|
364
|
|
- <!-- 优惠券数据 先写死 -->
|
|
365
|
|
- <FCell
|
|
366
|
|
- v-if="item.mer_id != '148'"
|
|
367
|
|
- title="优惠劵"
|
|
368
|
|
- :value="item.order.youhui_price!=0 ? item.order.youhui_price : '暂无优惠券'"
|
|
369
|
|
- arrow
|
|
370
|
|
- @click="gotoCoupon"
|
|
371
|
|
- ></FCell>
|
|
372
|
|
- <FCell
|
|
373
|
|
- v-if="item.mer_id == '148'"
|
|
374
|
|
- title="积分"
|
|
375
|
|
- :value="userStore.userInfo.score!='0' ? userStore.userInfo.score : '暂无积分'"
|
|
376
|
|
- arrow
|
|
377
|
|
- ></FCell>
|
|
378
|
|
- <FCell
|
|
379
|
|
- title="运费"
|
|
380
|
|
- :value="item.order.postage_price > 0 ? item.order.postage_price : '免运费'"
|
|
381
|
|
- arrow
|
|
382
|
|
- ></FCell>
|
|
383
|
|
-<!-- <FCell-->
|
|
384
|
|
-<!-- title="留言"-->
|
|
385
|
|
-<!-- value="建议留言前先与商家沟通确认"-->
|
|
386
|
|
-<!-- arrow-->
|
|
387
|
|
-<!-- ></FCell>-->
|
|
388
|
|
- <FField label="留言" placeholder="建议留言前先与商家沟通确认" v-model="data.mark" :exClass="['text-right']"/>
|
|
389
|
|
- </div>
|
|
390
|
360
|
|
|
391
|
361
|
</div>
|
|
|
362
|
+ <div>
|
|
|
363
|
+ <!-- 优惠券数据 先写死 -->
|
|
|
364
|
+ <FCell v-if="item.mer_id != '148'" title="优惠劵"
|
|
|
365
|
+ :value="item.order.youhui_price != 0 ? item.order.youhui_price : '暂无优惠券'" arrow @click="gotoCoupon"></FCell>
|
|
|
366
|
+ <FCell v-if="item.mer_id == '148'" title="积分"
|
|
|
367
|
+ :value="userStore.userInfo.score != '0' ? userStore.userInfo.score : '暂无积分'" arrow></FCell>
|
|
|
368
|
+ <FCell title="运费" :value="item.order.postage_price > 0 ? item.order.postage_price : '免运费'" arrow></FCell>
|
|
|
369
|
+ <!-- <FCell-->
|
|
|
370
|
+ <!-- title="留言"-->
|
|
|
371
|
+ <!-- value="建议留言前先与商家沟通确认"-->
|
|
|
372
|
+ <!-- arrow-->
|
|
|
373
|
+ <!-- ></FCell>-->
|
|
|
374
|
+ <FField label="留言" placeholder="建议留言前先与商家沟通确认" v-model="data.mark" :exClass="['text-right']" />
|
|
|
375
|
+ </div>
|
|
|
376
|
+
|
|
392
|
377
|
</div>
|
|
393
|
378
|
</div>
|
|
|
379
|
+ </div>
|
|
394
|
380
|
|
|
395
|
|
- <div class="fixed bottom-0 pb-safe w-full bg-white">
|
|
396
|
|
- <div class="flex justify-between items-center p-3">
|
|
397
|
|
- <div class="flex-1 flex text-sm font-bold">
|
|
398
|
|
- 应付金额:
|
|
399
|
|
- <div style="color:#fa4032" v-if="data.type && data.type == '3'" >{{ data.totalPrice * 30 }}积分</div>
|
|
400
|
|
- <div style="color:#fa4032" v-else >¥{{data.totalPrice}}</div>
|
|
401
|
|
- </div>
|
|
402
|
|
- <div class="flex">
|
|
403
|
|
- <nut-button type="primary" @click="handleSubmit">提交订单</nut-button>
|
|
404
|
|
- </div>
|
|
|
381
|
+ <div class="fixed bottom-0 pb-safe w-full bg-white">
|
|
|
382
|
+ <div class="flex justify-between items-center p-3">
|
|
|
383
|
+ <div class="flex-1 flex text-sm font-bold">
|
|
|
384
|
+ 应付金额:
|
|
|
385
|
+ <div style="color:#fa4032" v-if="data.type && data.type == '3'">{{ Math.round(data.totalPrice * 30) }}积分</div>
|
|
|
386
|
+ <div style="color:#fa4032" v-else>¥{{ data.totalPrice }}</div>
|
|
|
387
|
+ </div>
|
|
|
388
|
+ <div class="flex">
|
|
|
389
|
+ <nut-button type="primary" @click="handleSubmit">提交订单</nut-button>
|
|
405
|
390
|
</div>
|
|
406
|
|
-
|
|
407
|
391
|
</div>
|
|
|
392
|
+
|
|
|
393
|
+ </div>
|
|
408
|
394
|
</template>
|
|
409
|
395
|
|
|
410
|
396
|
<route lang="yaml">
|