更新优化,修复bug
This commit is contained in:
parent
08fbd02dca
commit
605acbe2b9
|
@ -29,3 +29,8 @@ export const orderCountApi = (data)=>{
|
||||||
export const cancelOrderApi = (data)=>{
|
export const cancelOrderApi = (data)=>{
|
||||||
return request.post('/order/RetailOrder/cancel_order', data);
|
return request.post('/order/RetailOrder/cancel_order', data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//订单确认收货
|
||||||
|
export const confirmReceiptApi = (data)=>{
|
||||||
|
return request.post('/order/RetailOrder/confirm_receipt', data);
|
||||||
|
}
|
|
@ -5,21 +5,24 @@
|
||||||
<view class="list-admin">
|
<view class="list-admin">
|
||||||
<view>常用地址</view>
|
<view>常用地址</view>
|
||||||
<view class="admin-btn">
|
<view class="admin-btn">
|
||||||
<view class="btn" @click="navTo('/pagesOrder/addressList/addressList')"><up-icon name="edit-pen" color="#20B128"></up-icon>管理</view>
|
<view class="btn" @click="navTo('/pagesOrder/addressList/addressList')"><up-icon name="edit-pen"
|
||||||
<view class="btn" @click="navTo('/pagesOrder/addressEdit/addressEdit')"><up-icon name="plus" color="#20B128"></up-icon>新增</view>
|
color="#20B128"></up-icon>管理</view>
|
||||||
|
<view class="btn" @click="navTo('/pagesOrder/addressEdit/addressEdit')"><up-icon name="plus"
|
||||||
|
color="#20B128"></up-icon>新增</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<scroll-view style="height: 600rpx;padding-bottom: 20rpx;" scroll-y>
|
<scroll-view style="height: 600rpx;padding-bottom: 20rpx;" scroll-y>
|
||||||
<view class="row" v-for="(item,index) in list" :key="index" @click="addressType=index">
|
<view class="row" v-for="(item,index) in list" :key="index" @click="addressType=item.address_id">
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<view class="top">
|
<view class="top">
|
||||||
<view class="name">{{item.real_name}}</view>
|
<view class="name">{{item.real_name}}</view>
|
||||||
<view class="phone">{{item.phone}}</view>
|
<view class="phone">{{item.phone}}</view>
|
||||||
<u-tag v-if="item.is_default" style="pointer-events: none;" text="默认" type="success" plain size="mini"></u-tag>
|
<u-tag v-if="item.is_default" style="pointer-events: none;" text="默认" type="success" plain
|
||||||
|
size="mini"></u-tag>
|
||||||
</view>
|
</view>
|
||||||
<view class="bottom u-line-2">{{item.detail}}</view>
|
<view class="bottom u-line-2">{{item.detail}}</view>
|
||||||
</view>
|
</view>
|
||||||
<image v-if="addressType==index" src="@/static/icon/check.png"></image>
|
<image v-if="addressType==item.address_id" src="@/static/icon/check.png"></image>
|
||||||
<image v-else src="@/static/icon/n-check.png"></image>
|
<image v-else src="@/static/icon/n-check.png"></image>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
@ -40,8 +43,8 @@
|
||||||
},
|
},
|
||||||
list: {
|
list: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: ()=>[]
|
default: () => []
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits(['close', 'change']);
|
const emit = defineEmits(['close', 'change']);
|
||||||
|
@ -50,14 +53,23 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const submitAddress = () => {
|
const submitAddress = () => {
|
||||||
emit('change', props.list[addressType.value]);
|
let e = props.list.find(item=>item.address_id==addressType.value);
|
||||||
|
if(addressType.value<=0 || !e) return uni.$u.toast('请选择地址');
|
||||||
|
emit('change', e);
|
||||||
}
|
}
|
||||||
|
|
||||||
const navTo = (url)=>{
|
const navTo = (url) => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: url
|
url: url
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const setCheck = (e)=>{
|
||||||
|
addressType.value = e;
|
||||||
|
}
|
||||||
|
defineExpose({
|
||||||
|
setCheck
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
@custom="searchKeyword"></up-search>
|
@custom="searchKeyword"></up-search>
|
||||||
</view>
|
</view>
|
||||||
<scroll-view style="height: 600rpx;padding-bottom: 20rpx;" scroll-y>
|
<scroll-view style="height: 600rpx;padding-bottom: 20rpx;" scroll-y>
|
||||||
<view class="list-li border" v-for="(item,index) in list" :key="index" @click="addressType=index">
|
<view class="list-li border" v-for="(item,index) in list" :key="index" @click="addressType=item.mer_id">
|
||||||
<view class="list-li-top">
|
<view class="list-li-top">
|
||||||
<view class="">
|
<view class="">
|
||||||
<text>{{item.mer_name}}</text>
|
<text>{{item.mer_name}}</text>
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
{{item.mer_address||'sdsd'}}
|
{{item.mer_address||'sdsd'}}
|
||||||
</view>
|
</view>
|
||||||
<view class="check">
|
<view class="check">
|
||||||
<image style="width: 36rpx;height: 36rpx" v-if="addressType==index"
|
<image style="width: 36rpx;height: 36rpx" v-if="addressType==item.mer_id"
|
||||||
src="@/static/icon/check.png">
|
src="@/static/icon/check.png">
|
||||||
</image>
|
</image>
|
||||||
<image style="width: 36rpx;height: 36rpx" v-else src="@/static/icon/n-check.png"></image>
|
<image style="width: 36rpx;height: 36rpx" v-else src="@/static/icon/n-check.png"></image>
|
||||||
|
@ -56,7 +56,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const submitAddress = () => {
|
const submitAddress = () => {
|
||||||
emit('change', props.list[addressType.value]);
|
let e = props.list.find(item=>item.mer_id==addressType.value);
|
||||||
|
if(addressType.value<=0 || !e) return uni.$u.toast('请选择提货点');
|
||||||
|
emit('change', e);
|
||||||
}
|
}
|
||||||
|
|
||||||
const keyword = ref('')
|
const keyword = ref('')
|
||||||
|
@ -69,6 +71,13 @@
|
||||||
url: url
|
url: url
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const setCheck = (e)=>{
|
||||||
|
addressType.value = e;
|
||||||
|
}
|
||||||
|
defineExpose({
|
||||||
|
setCheck
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|
|
@ -8,7 +8,7 @@ let env = "prod"
|
||||||
switch(env){
|
switch(env){
|
||||||
case 'prod': BASE_URL = 'https://erp.lihaink.cn';break;
|
case 'prod': BASE_URL = 'https://erp.lihaink.cn';break;
|
||||||
case 'test': BASE_URL = 'https://ceshi-erp.lihaink.cn';break;
|
case 'test': BASE_URL = 'https://ceshi-erp.lihaink.cn';break;
|
||||||
default: BASE_URL = 'http://192.168.1.22:8546';
|
default: BASE_URL = 'http://192.168.1.15:8546';
|
||||||
}
|
}
|
||||||
|
|
||||||
let HTTP_REQUEST_URL
|
let HTTP_REQUEST_URL
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
<scroll-view scroll-y style="height: 100%;width: 100%;">
|
<scroll-view scroll-y style="height: 100%;width: 100%;">
|
||||||
<view class="page-box1">
|
<view class="page-box1">
|
||||||
<view v-if="frequentlyList.length>0" class="list">
|
<view v-if="frequentlyList.length>0" class="list">
|
||||||
<view class="shop-item" v-for="(item, index) in c" :key="index" @click="openGoodPopup(item)">
|
<view class="shop-item" v-for="(item, index) in frequentlyList" :key="index" @click="openGoodPopup(item)">
|
||||||
<image class="shop-img" :src="item.imgs"></image>
|
<image class="shop-img" :src="item.imgs"></image>
|
||||||
<view class="shop-content" style="width: 490rpx;">
|
<view class="shop-content" style="width: 490rpx;">
|
||||||
<view class="title">
|
<view class="title">
|
||||||
|
@ -368,7 +368,7 @@
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.num {
|
.num {
|
||||||
width: 60rpx;
|
margin: 0 20rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<view class="list-item" @click="navTo(2)">
|
<view class="list-item" @click="navTo(2)">
|
||||||
<image src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/45241202404261403353935.png"></image>
|
<image src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/45241202404261403353935.png"></image>
|
||||||
<view class="">待收货</view>
|
<view class="">待收货</view>
|
||||||
<view class="badge" v-if="orderCount.waiting">{{orderCount.waiting}}</view>
|
<view class="badge" v-if="orderCount.receiving">{{orderCount.receiving}}</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="list-item">
|
<!-- <view class="list-item">
|
||||||
<image src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/96915202404261403582769.png"></image>
|
<image src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/96915202404261403582769.png"></image>
|
||||||
|
@ -60,6 +60,7 @@
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import useUserStore from "@/store/user";
|
import useUserStore from "@/store/user";
|
||||||
import { orderCountApi } from "@/api/order.js";
|
import { orderCountApi } from "@/api/order.js";
|
||||||
|
import { onShow } from "@dcloudio/uni-app"
|
||||||
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
|
|
||||||
|
@ -75,7 +76,6 @@
|
||||||
orderCount.value = res.data;
|
orderCount.value = res.data;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
getOrderCount();
|
|
||||||
|
|
||||||
const navTo = (type=0) => {
|
const navTo = (type=0) => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
|
@ -90,6 +90,10 @@
|
||||||
url: '/pages/login/login'
|
url: '/pages/login/login'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onShow(()=>{
|
||||||
|
getOrderCount();
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
@ -153,7 +157,7 @@
|
||||||
left: 0;
|
left: 0;
|
||||||
z-index: 3;
|
z-index: 3;
|
||||||
background-image: url('https://lihai001.oss-cn-chengdu.aliyuncs.com/def/a8863202404261349533191.png');
|
background-image: url('https://lihai001.oss-cn-chengdu.aliyuncs.com/def/a8863202404261349533191.png');
|
||||||
background-size: 28% 100%;
|
background-size: 35% 100%;
|
||||||
background-position: right;
|
background-position: right;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,28 @@
|
||||||
<view class="count_down" v-if="datas.paid==0&&countDown">
|
<view class="count_down" v-if="datas.paid==0&&countDown">
|
||||||
还剩<text>{{countDown}}</text>订单自动取消
|
还剩<text>{{countDown}}</text>订单自动取消
|
||||||
</view>
|
</view>
|
||||||
|
<view class="m-card m-address" style="margin-top: 20rpx;">
|
||||||
|
<view class="address-info">
|
||||||
|
<view class="top" style="align-items: flex-start;">
|
||||||
|
<view style="color: #333;display: flex;align-items: center;">
|
||||||
|
<up-icon name="map"></up-icon>
|
||||||
|
<text style="margin: 0 10rpx;">自提点</text>
|
||||||
|
</view>
|
||||||
|
<view v-if="shopInfo.mer_id">
|
||||||
|
<view>{{shopInfo.mer_name}}</view>
|
||||||
|
<view>
|
||||||
|
<text>{{shopInfo.service_phone}}</text>
|
||||||
|
<text
|
||||||
|
style="color: #20b128;margin-left: 10rpx;font-size: 22rpx;">{{shopInfo.distance}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="address-btn">
|
||||||
|
<view style="width: 80px;"><up-button @click="shopListShow=true" size="small" shape="circle"
|
||||||
|
color="#f6f6f6" :customStyle="{color:'#666666'}">修改</up-button></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<view class="m-card m-address" style="margin-top: 20rpx;">
|
<view class="m-card m-address" style="margin-top: 20rpx;">
|
||||||
<view class="address-info">
|
<view class="address-info">
|
||||||
<view class="top">
|
<view class="top">
|
||||||
|
@ -110,28 +132,32 @@
|
||||||
<block v-else>
|
<block v-else>
|
||||||
<view></view>
|
<view></view>
|
||||||
<view style="width: 450rpx;">
|
<view style="width: 450rpx;">
|
||||||
<up-button v-if="datas.status==0||datas.status==1" color="#20B128" shape="circle" @click="">确认收货</up-button>
|
<up-button v-if="datas.status==0||datas.status==1" color="#20B128" shape="circle" @click="showTake=true">确认收货</up-button>
|
||||||
<up-button v-else color="#20B128" shape="circle" @click="">再次购买</up-button>
|
<up-button v-else color="#20B128" plain shape="circle" @click="">再次购买</up-button>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<orderCanclePopup :show="showCancel" @close="showCancel=false" @change="submitCancel" />
|
<orderCanclePopup :show="showCancel" @close="showCancel=false" @change="submitCancel" />
|
||||||
<addressPopup v-if="addressList.length>0" :show="showAddress" :list="addressList" @close="showAddress=false" @change="changeAddress" />
|
<addressPopup ref="addressRef" :show="showAddress" :list="addressList" @close="showAddress=false" @change="changeAddress" />
|
||||||
<modal :show="false" content="您还没有添加收货地址,请点击添加"></modal>
|
<shopListPopupVue ref="shopRef" :show="shopListShow" :list="merchantList"
|
||||||
|
@close="shopListShow=false" @change="changeShop" @search="searchShop" />
|
||||||
|
<modal :show="showTake" title="确认收货" content="请确认您已收到货" @close="showTake=false" @change="confirmReceipt"></modal>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onLoad, onBackPress } from "@dcloudio/uni-app";
|
import { onLoad, onBackPress } from "@dcloudio/uni-app";
|
||||||
import { ref } from "vue";
|
import { nextTick, ref } from "vue";
|
||||||
import addressPopup from "@/components/addressPopup.vue";
|
import addressPopup from "@/components/addressPopup.vue";
|
||||||
import orderCanclePopup from "@/components/orderCanclePopup.vue";
|
import orderCanclePopup from "@/components/orderCanclePopup.vue";
|
||||||
|
import shopListPopupVue from "@/components/shopListPopup.vue";
|
||||||
import modal from "@/components/modal.vue";
|
import modal from "@/components/modal.vue";
|
||||||
import { orderDetailApi, cancelOrderApi, rePaymentApi } from "@/api/order.js"
|
import { orderDetailApi, cancelOrderApi, rePaymentApi, confirmReceiptApi } from "@/api/order.js"
|
||||||
import { addressListsApi, merchantListApi } from "@/api/user.js";
|
import { addressListsApi, merchantListApi } from "@/api/user.js";
|
||||||
|
|
||||||
const showCancel = ref(false);
|
const showCancel = ref(false);
|
||||||
|
const showTake = ref(false);
|
||||||
|
|
||||||
const submitCancel = (e) => {
|
const submitCancel = (e) => {
|
||||||
showCancel.value = false;
|
showCancel.value = false;
|
||||||
|
@ -157,6 +183,21 @@
|
||||||
order_id: datas.value.id
|
order_id: datas.value.id
|
||||||
}).then(res=>{
|
}).then(res=>{
|
||||||
datas.value = res.data;
|
datas.value = res.data;
|
||||||
|
shopInfo.value = res.data.merchant_info;
|
||||||
|
if(addressList.value.length>0 && res.data.paid){
|
||||||
|
addressInfo.value = addressList.value.find(item=>item.address_id == res.data.address_id);
|
||||||
|
}else {
|
||||||
|
addressInfo.value = {
|
||||||
|
address_id: res.data.address_id,
|
||||||
|
real_name: res.data.real_name,
|
||||||
|
phone: res.data.user_phone,
|
||||||
|
detail: res.data.user_address
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nextTick(()=>{
|
||||||
|
shopRef.value.setCheck(shopInfo.value.mer_id);
|
||||||
|
addressRef.value.setCheck(addressInfo.value.address_id);
|
||||||
|
})
|
||||||
if(!res.data.paid){
|
if(!res.data.paid){
|
||||||
targetDate = new Date(res.data.create_time).getTime() + 30*60*1000;
|
targetDate = new Date(res.data.create_time).getTime() + 30*60*1000;
|
||||||
// 每秒更新一次倒计时
|
// 每秒更新一次倒计时
|
||||||
|
@ -173,6 +214,20 @@
|
||||||
return price.split('.')[index] || (index ? '00' : '0');
|
return price.split('.')[index] || (index ? '00' : '0');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 选择地址
|
||||||
|
const addressRef = ref(null);
|
||||||
|
const showAddress = ref(false);
|
||||||
|
const addressInfo = ref({});
|
||||||
|
const changeAddress = (e) => {
|
||||||
|
addressInfo.value = e;
|
||||||
|
showAddress.value = false;
|
||||||
|
}
|
||||||
|
const openAddress = ()=>{
|
||||||
|
if(addressList.length>0) showAddress.value=true;
|
||||||
|
else uni.navigateTo({
|
||||||
|
url: '/pagesOrder/addressEdit/addressEdit'
|
||||||
|
})
|
||||||
|
}
|
||||||
// 地址相关
|
// 地址相关
|
||||||
const addressList = ref([]);
|
const addressList = ref([]);
|
||||||
const getAddressList = ()=>{
|
const getAddressList = ()=>{
|
||||||
|
@ -186,26 +241,67 @@
|
||||||
if(addressList.value.length>0){
|
if(addressList.value.length>0){
|
||||||
addressInfo.value = addressList.value[0];
|
addressInfo.value = addressList.value[0];
|
||||||
}
|
}
|
||||||
|
if(addressInfo.value.address_id) nextTick(()=>{
|
||||||
|
addressRef.value.setCheck(addressInfo.value.address_id);
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
getAddressList();
|
getAddressList();
|
||||||
// 选择地址
|
|
||||||
const showAddress = ref(false);
|
const shopRef = ref(false);
|
||||||
const addressInfo = ref({});
|
const shopListShow = ref(false);
|
||||||
const changeAddress = (e) => {
|
const merchantList = ref([]);
|
||||||
addressInfo.value = e;
|
const myAddressInfo = ref({
|
||||||
showAddress.value = false;
|
long: "",
|
||||||
|
lat: ""
|
||||||
|
})
|
||||||
|
const shopInfo = ref({
|
||||||
|
mer_id: ''
|
||||||
|
});
|
||||||
|
const getMerchantList = (mer_name = null) => {
|
||||||
|
merchantListApi({
|
||||||
|
...myAddressInfo.value,
|
||||||
|
mer_name: mer_name ? mer_name : ''
|
||||||
|
}).then(res => {
|
||||||
|
merchantList.value = res.data.lists;
|
||||||
|
if (mer_name === null && myAddressInfo.value.long && merchantList.value.length > 0 && !shopInfo
|
||||||
|
.value.mer_id) {
|
||||||
|
shopInfo.value = merchantList.value[0];
|
||||||
|
nextTick(()=>{
|
||||||
|
shopRef.value.setCheck(shopInfo.value.mer_id);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
const openAddress = ()=>{
|
getMerchantList();
|
||||||
if(addressList.length>0) showAddress.value=true;
|
// 定位
|
||||||
else uni.navigateTo({
|
const LoadAddress = () => {
|
||||||
url: '/pagesOrder/addressEdit/addressEdit'
|
uni.getLocation({
|
||||||
})
|
success: (res) => {},
|
||||||
|
fail: (err) => {
|
||||||
|
uni.$u.toast('定位失败, 请手动选择提货点!')
|
||||||
|
},
|
||||||
|
complete: (res) => {
|
||||||
|
myAddressInfo.value.long = res.longitude || "";
|
||||||
|
myAddressInfo.value.lat = res.latitude || "";
|
||||||
|
getMerchantList();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const changeShop = (e) => {
|
||||||
|
LoadAddress();
|
||||||
|
shopInfo.value = e;
|
||||||
|
shopListShow.value = false;
|
||||||
|
}
|
||||||
|
const searchShop = (e) => {
|
||||||
|
getMerchantList(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
const rePay = ()=>{
|
const rePay = ()=>{
|
||||||
rePaymentApi({
|
rePaymentApi({
|
||||||
order_id: datas.value.id,
|
order_id: datas.value.id,
|
||||||
|
mer_id: shopInfo.value.mer_id,
|
||||||
|
address_id: addressInfo.value.address_id,
|
||||||
pay_type: 1
|
pay_type: 1
|
||||||
}).then(res=>{
|
}).then(res=>{
|
||||||
if(!res.data?.nonceStr) return uni.$u.toast('支付失败!');
|
if(!res.data?.nonceStr) return uni.$u.toast('支付失败!');
|
||||||
|
@ -265,6 +361,21 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 确认收货
|
||||||
|
const confirmReceipt = ()=>{
|
||||||
|
confirmReceiptApi({
|
||||||
|
order_id: datas.value.id
|
||||||
|
}).then(res=>{
|
||||||
|
showTake.value = false;
|
||||||
|
uni.$u.toast('确认收货成功');
|
||||||
|
uni.navigateBack({
|
||||||
|
success: () => {
|
||||||
|
uni.$emit('reLoadOrderList');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
onLoad((option) => {
|
onLoad((option) => {
|
||||||
uni.setNavigationBarTitle({
|
uni.setNavigationBarTitle({
|
||||||
title: option.type == 0 ? '等待付款' : '订单详情'
|
title: option.type == 0 ? '等待付款' : '订单详情'
|
||||||
|
|
|
@ -27,11 +27,11 @@
|
||||||
</view>
|
</view>
|
||||||
<view v-if="datas.paid==0" class="item-btn">
|
<view v-if="datas.paid==0" class="item-btn">
|
||||||
<view style="width: 80px;"><up-button size="small" plain color="#989898" shape="circle" @click="cancleOrder">取消订单</up-button></view>
|
<view style="width: 80px;"><up-button size="small" plain color="#989898" shape="circle" @click="cancleOrder">取消订单</up-button></view>
|
||||||
<view style="width: 80px;"><up-button size="small" plain color="#20B128" shape="circle" @click="rePay">立即支付</up-button></view>
|
<view style="width: 80px;"><up-button size="small" color="#20B128" shape="circle" @click="rePay">立即支付</up-button></view>
|
||||||
</view>
|
</view>
|
||||||
<view v-else class="item-btn">
|
<view v-else class="item-btn">
|
||||||
<!-- <view style="width: 80px;"><up-button size="small" plain color="#989898" shape="circle">申请售后</up-button></view> -->
|
<!-- <view style="width: 80px;"><up-button size="small" plain color="#989898" shape="circle">申请售后</up-button></view> -->
|
||||||
<view v-if="datas.status==1" style="width: 80px;"><up-button size="small" plain color="#20B128"
|
<view @click="takeOrder" v-if="datas.status==1" style="width: 80px;"><up-button size="small" color="#20B128"
|
||||||
shape="circle">确认收货</up-button></view>
|
shape="circle">确认收货</up-button></view>
|
||||||
<view v-if="datas.status==2||datas.status==3" style="width: 80px;"><up-button size="small" plain color="#20B128"
|
<view v-if="datas.status==2||datas.status==3" style="width: 80px;"><up-button size="small" plain color="#20B128"
|
||||||
shape="circle">再次购买</up-button></view>
|
shape="circle">再次购买</up-button></view>
|
||||||
|
@ -67,11 +67,15 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const emit = defineEmits(['cancleOrder', 'rePay']);
|
const emit = defineEmits(['cancleOrder', 'rePay', 'takeOrder']);
|
||||||
const cancleOrder = ()=>{
|
const cancleOrder = ()=>{
|
||||||
emit('cancleOrder', props.datas)
|
emit('cancleOrder', props.datas)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const takeOrder = ()=>{
|
||||||
|
emit('takeOrder', props.datas)
|
||||||
|
}
|
||||||
|
|
||||||
const rePay = ()=>{
|
const rePay = ()=>{
|
||||||
emit('rePay', props.datas)
|
emit('rePay', props.datas)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="loadMoreGood">
|
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="loadMoreGood">
|
||||||
<view class="page-box">
|
<view class="page-box">
|
||||||
<view v-if="list.length>0" class="list">
|
<view v-if="list.length>0" class="list">
|
||||||
<good v-for="(item, index) in list" :datas="item" :key="index" :type="k" @cancleOrder="cancleOrder"
|
<good v-for="(item, index) in list" :datas="item" :key="index" :type="k" @cancleOrder="cancleOrder" @takeOrder="takeOrder"
|
||||||
@rePay="rePay"></good>
|
@rePay="rePay"></good>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="!where[k].loading&&list.length==0" style="padding-top: 100rpx;">
|
<view v-if="!where[k].loading&&list.length==0" style="padding-top: 100rpx;">
|
||||||
|
@ -40,16 +40,17 @@
|
||||||
</swiper-item>
|
</swiper-item>
|
||||||
</swiper>
|
</swiper>
|
||||||
<orderCanclePopup :show="showCancel" @close="showCancel=false" @change="submitCancel" />
|
<orderCanclePopup :show="showCancel" @close="showCancel=false" @change="submitCancel" />
|
||||||
|
<modal :show="showTake" title="确认收货" content="请确认您已收到货" @close="showTake=false" @change="confirmReceipt"></modal>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onLoad } from "@dcloudio/uni-app"
|
import { onLoad, onUnload } from "@dcloudio/uni-app"
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import good from "./component/good.vue";
|
import good from "./component/good.vue";
|
||||||
import orderCanclePopup from "@/components/orderCanclePopup.vue"
|
import orderCanclePopup from "@/components/orderCanclePopup.vue"
|
||||||
import { orderListApi } from "@/api/order.js";
|
import modal from "@/components/modal.vue"
|
||||||
import { cancelOrderApi, rePaymentApi } from "@/api/order.js"
|
import { cancelOrderApi, rePaymentApi, confirmReceiptApi, orderListApi } from "@/api/order.js"
|
||||||
|
|
||||||
const tabsActive = ref(0)
|
const tabsActive = ref(0)
|
||||||
const changeTab = ({ index }) => {
|
const changeTab = ({ index }) => {
|
||||||
|
@ -69,9 +70,10 @@
|
||||||
tabsActive.value = current;
|
tabsActive.value = current;
|
||||||
if (swiperCurrent.value == 0 && orderList.value[0].length == 0) getOrderList(0);
|
if (swiperCurrent.value == 0 && orderList.value[0].length == 0) getOrderList(0);
|
||||||
if (swiperCurrent.value == 1 && orderList.value[1].length == 0) getOrderList(1, '', 0);
|
if (swiperCurrent.value == 1 && orderList.value[1].length == 0) getOrderList(1, '', 0);
|
||||||
if (swiperCurrent.value == 2 && orderList.value[2].length == 0) getOrderList(2, 0);
|
if (swiperCurrent.value == 2 && orderList.value[2].length == 0) getOrderList(2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 取消订单
|
||||||
const showCancel = ref(false);
|
const showCancel = ref(false);
|
||||||
let cancelId = '';
|
let cancelId = '';
|
||||||
const submitCancel = (e) => {
|
const submitCancel = (e) => {
|
||||||
|
@ -92,9 +94,28 @@
|
||||||
showCancel.value = true;
|
showCancel.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 确认收货
|
||||||
|
const showTake = ref(false);
|
||||||
|
let takeId = "";
|
||||||
|
const takeOrder = (e) => {
|
||||||
|
takeId = e.id;
|
||||||
|
showTake.value = true;
|
||||||
|
}
|
||||||
|
const confirmReceipt = ()=>{
|
||||||
|
confirmReceiptApi({
|
||||||
|
order_id: takeId
|
||||||
|
}).then(res=>{
|
||||||
|
showTake.value = false;
|
||||||
|
uni.$u.toast('确认收货成功');
|
||||||
|
reloadAll();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const rePay = (e) => {
|
const rePay = (e) => {
|
||||||
rePaymentApi({
|
rePaymentApi({
|
||||||
order_id: e.id,
|
order_id: e.id,
|
||||||
|
address_id: e.address_id,
|
||||||
|
mer_id: e.merchant,
|
||||||
pay_type: 1
|
pay_type: 1
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (!res.data?.nonceStr) return uni.$u.toast('支付失败!');
|
if (!res.data?.nonceStr) return uni.$u.toast('支付失败!');
|
||||||
|
@ -111,7 +132,7 @@
|
||||||
title: '订单支付成功',
|
title: '订单支付成功',
|
||||||
icon: 'success'
|
icon: 'success'
|
||||||
})
|
})
|
||||||
getOrderList(1, '', 0);
|
reloadAll();
|
||||||
} else uni.$u.toast('支付失败')
|
} else uni.$u.toast('支付失败')
|
||||||
},
|
},
|
||||||
fail: (e) => {
|
fail: (e) => {
|
||||||
|
@ -171,7 +192,7 @@
|
||||||
const loadMoreGood = ()=>{
|
const loadMoreGood = ()=>{
|
||||||
if (swiperCurrent.value == 0) getOrderList(0);
|
if (swiperCurrent.value == 0) getOrderList(0);
|
||||||
if (swiperCurrent.value == 1) getOrderList(1, '', 0);
|
if (swiperCurrent.value == 1) getOrderList(1, '', 0);
|
||||||
if (swiperCurrent.value == 2) getOrderList(2, 0);
|
if (swiperCurrent.value == 2) getOrderList(2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 搜索
|
// 搜索
|
||||||
|
@ -181,7 +202,7 @@
|
||||||
where.value[+swiperCurrent.value].loadend = false;
|
where.value[+swiperCurrent.value].loadend = false;
|
||||||
if (swiperCurrent.value == 0) getOrderList(0);
|
if (swiperCurrent.value == 0) getOrderList(0);
|
||||||
if (swiperCurrent.value == 1) getOrderList(1, '', 0);
|
if (swiperCurrent.value == 1) getOrderList(1, '', 0);
|
||||||
if (swiperCurrent.value == 2) getOrderList(2, 0);
|
if (swiperCurrent.value == 2) getOrderList(2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
let back = 0;
|
let back = 0;
|
||||||
|
@ -191,6 +212,16 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const reloadAll = () => { //对订单进行操作时刷新页面
|
||||||
|
where.value.forEach(item=>{
|
||||||
|
item.page_no = 1;
|
||||||
|
item.loadend = false;
|
||||||
|
});
|
||||||
|
getOrderList(1, '', 0);
|
||||||
|
getOrderList(0);
|
||||||
|
getOrderList(2, 1);
|
||||||
|
}
|
||||||
|
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
if (options.type) {
|
if (options.type) {
|
||||||
tabsActive.value = +options.type;
|
tabsActive.value = +options.type;
|
||||||
|
@ -200,14 +231,13 @@
|
||||||
if(options.back) back = options.back;
|
if(options.back) back = options.back;
|
||||||
// getOrderList(0);
|
// getOrderList(0);
|
||||||
// getOrderList(1, '', 0);
|
// getOrderList(1, '', 0);
|
||||||
// getOrderList(2, 0);
|
// getOrderList(2, 1);
|
||||||
|
|
||||||
uni.$on('reLoadOrderList', () => { //对订单进行操作时刷新页面
|
uni.$on('reLoadOrderList', reloadAll);
|
||||||
where.value.forEach(item=>item.page_no=1);
|
})
|
||||||
getOrderList(1, '', 0);
|
|
||||||
getOrderList(0);
|
onUnload(()=>{
|
||||||
getOrderList(2, 0);
|
uni.$off('reLoadOrderList', reloadAll)
|
||||||
});
|
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -116,9 +116,9 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<addressPopup v-if="addressList.length>0" :show="showAddress" :list="addressList" @close="showAddress=false"
|
<addressPopup ref="addressRef" :show="showAddress" :list="addressList" @close="showAddress=false"
|
||||||
@change="changeAddress" />
|
@change="changeAddress" />
|
||||||
<shopListPopupVue v-if="merchantList.length>0" :show="shopListShow" :list="merchantList"
|
<shopListPopupVue ref="shopRef" :show="shopListShow" :list="merchantList"
|
||||||
@close="shopListShow=false" @change="changeShop" @search="searchShop" />
|
@close="shopListShow=false" @change="changeShop" @search="searchShop" />
|
||||||
<modal title="尚未设置收货地址" content="您还没有添加收货地址,请点击添加" cancleText="添加地址" confirmText="继续支付" :show="toastAddressShow"
|
<modal title="尚未设置收货地址" content="您还没有添加收货地址,请点击添加" cancleText="添加地址" confirmText="继续支付" :show="toastAddressShow"
|
||||||
@close="addAddress" @change="goPay" />
|
@close="addAddress" @change="goPay" />
|
||||||
|
@ -159,24 +159,8 @@
|
||||||
const toastAddressShow = ref(false);
|
const toastAddressShow = ref(false);
|
||||||
|
|
||||||
|
|
||||||
// 地址相关
|
|
||||||
const addressList = ref([]);
|
|
||||||
const getAddressList = () => {
|
|
||||||
addressListsApi().then(res => {
|
|
||||||
addressList.value = res.data.lists;
|
|
||||||
addressList.value.forEach(item => {
|
|
||||||
if (item.is_default) {
|
|
||||||
addressInfo.value = item;
|
|
||||||
isAddress.value = true;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if (!isAddress.value && addressList.value.length > 0) {
|
|
||||||
addressInfo.value = addressList.value[0];
|
|
||||||
isAddress.value = true;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
// 选择地址
|
// 选择地址
|
||||||
|
const addressRef = ref(null);
|
||||||
const showAddress = ref(false);
|
const showAddress = ref(false);
|
||||||
const addressInfo = ref({});
|
const addressInfo = ref({});
|
||||||
const changeAddress = (e) => {
|
const changeAddress = (e) => {
|
||||||
|
@ -191,7 +175,31 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 地址相关
|
||||||
|
const addressList = ref([]);
|
||||||
|
const getAddressList = () => {
|
||||||
|
addressListsApi().then(res => {
|
||||||
|
addressList.value = res.data.lists;
|
||||||
|
addressList.value.forEach(item => {
|
||||||
|
if (item.is_default) {
|
||||||
|
addressInfo.value = item;
|
||||||
|
isAddress.value = true;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (!isAddress.value && addressList.value.length > 0) {
|
||||||
|
addressInfo.value = addressList.value[0];
|
||||||
|
isAddress.value = true;
|
||||||
|
}
|
||||||
|
if(addressInfo.value.address_id) {
|
||||||
|
nextTick(()=>{
|
||||||
|
addressRef.value.setCheck(addressInfo.value.address_id);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 提货点相关
|
// 提货点相关
|
||||||
|
const shopRef = ref(null);
|
||||||
const shopListShow = ref(false);
|
const shopListShow = ref(false);
|
||||||
const merchantList = ref([]);
|
const merchantList = ref([]);
|
||||||
const myAddressInfo = ref({
|
const myAddressInfo = ref({
|
||||||
|
@ -210,6 +218,9 @@
|
||||||
if (mer_name === null && myAddressInfo.value.long && merchantList.value.length > 0 && !shopInfo
|
if (mer_name === null && myAddressInfo.value.long && merchantList.value.length > 0 && !shopInfo
|
||||||
.value.mer_id) {
|
.value.mer_id) {
|
||||||
shopInfo.value = merchantList.value[0];
|
shopInfo.value = merchantList.value[0];
|
||||||
|
nextTick(()=>{
|
||||||
|
shopRef.value.setCheck(shopInfo.value.mer_id);
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ const useUserStore = defineStore("user", () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
token.value = "0f680a9bc1cdccd7ce588a2a58029411"
|
token.value = "1df48a21913ef4eba488983e7b84c056"
|
||||||
// token.value = "95b24dd6d2dda836fe07854b08ba0944"
|
// token.value = "95b24dd6d2dda836fe07854b08ba0944"
|
||||||
userInfo.value = {
|
userInfo.value = {
|
||||||
avatar: "https://lihaiim.oss-cn-chengdu.aliyuncs.com/image/admin/default_avatar.png",
|
avatar: "https://lihaiim.oss-cn-chengdu.aliyuncs.com/image/admin/default_avatar.png",
|
||||||
|
|
Loading…
Reference in New Issue