add
This commit is contained in:
commit
2dff195b4f
10
api/order.js
10
api/order.js
|
@ -29,3 +29,13 @@ export const orderCountApi = (data)=>{
|
|||
export const cancelOrderApi = (data)=>{
|
||||
return request.post('/order/RetailOrder/cancel_order', data);
|
||||
}
|
||||
|
||||
//订单确认收货
|
||||
export const confirmReceiptApi = (data)=>{
|
||||
return request.post('/order/RetailOrder/confirm_receipt', data);
|
||||
}
|
||||
|
||||
//订单再次购买
|
||||
export const purchaseAgainApi = (data)=>{
|
||||
return request.get('/order/RetailOrder/purchase_again', data);
|
||||
}
|
|
@ -1,6 +1,12 @@
|
|||
import request from '@/utils/request';
|
||||
|
||||
//报价单列表
|
||||
export const OpurchaseGoodsOfferApi = (data) => {
|
||||
export const OpurchaseGoodsOfferListApi = (data) => {
|
||||
return request.get('/operation/OpurchaseGoodsOffer/list', data);
|
||||
}
|
||||
|
||||
|
||||
//报价单提交
|
||||
export const OpurchaseGoodsOfferApi = (data) => {
|
||||
return request.post('/operation/OpurchaseGoodsOffer/offer', data);
|
||||
}
|
|
@ -5,21 +5,24 @@
|
|||
<view class="list-admin">
|
||||
<view>常用地址</view>
|
||||
<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/addressEdit/addressEdit')"><up-icon name="plus" color="#20B128"></up-icon>新增</view>
|
||||
<view class="btn" @click="navTo('/pagesOrder/addressList/addressList')"><up-icon name="edit-pen"
|
||||
color="#20B128"></up-icon>管理</view>
|
||||
<view class="btn" @click="navTo('/pagesOrder/addressEdit/addressEdit')"><up-icon name="plus"
|
||||
color="#20B128"></up-icon>新增</view>
|
||||
</view>
|
||||
</view>
|
||||
<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="top">
|
||||
<view class="name">{{item.real_name}}</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 class="bottom u-line-2">{{item.detail}}</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>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
@ -41,7 +44,7 @@
|
|||
list: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits(['close', 'change']);
|
||||
|
@ -50,7 +53,9 @@
|
|||
}
|
||||
|
||||
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) => {
|
||||
|
@ -58,6 +63,13 @@
|
|||
url: url
|
||||
})
|
||||
}
|
||||
|
||||
const setCheck = (e)=>{
|
||||
addressType.value = e;
|
||||
}
|
||||
defineExpose({
|
||||
setCheck
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
@custom="searchKeyword"></up-search>
|
||||
</view>
|
||||
<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="">
|
||||
<text>{{item.mer_name}}</text>
|
||||
|
@ -20,7 +20,7 @@
|
|||
{{item.mer_address||'sdsd'}}
|
||||
</view>
|
||||
<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">
|
||||
</image>
|
||||
<image style="width: 36rpx;height: 36rpx" v-else src="@/static/icon/n-check.png"></image>
|
||||
|
@ -56,7 +56,9 @@
|
|||
}
|
||||
|
||||
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('')
|
||||
|
@ -69,6 +71,13 @@
|
|||
url: url
|
||||
})
|
||||
}
|
||||
|
||||
const setCheck = (e)=>{
|
||||
addressType.value = e;
|
||||
}
|
||||
defineExpose({
|
||||
setCheck
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
|
|
@ -8,7 +8,7 @@ let env = "prod"
|
|||
switch(env){
|
||||
case 'prod': BASE_URL = 'https://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
|
||||
|
|
|
@ -1,4 +1,13 @@
|
|||
<template>
|
||||
<view class="">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<view class="content">
|
||||
<view class="card" v-for="item in 10">
|
||||
<view class="head">
|
||||
|
@ -40,6 +49,11 @@
|
|||
<up-button shape='circle' color='#20B128' text="提交"></up-button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
|
|
@ -1,43 +1,72 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<view class="card" v-for="item in 10">
|
||||
<view class="">
|
||||
|
||||
<up-sticky bgColor="#fff">
|
||||
<view class="head">
|
||||
<text>PF171504442988969633</text>
|
||||
<text style="color: #989898;">2023-04-25</text>
|
||||
<!-- <up-search placeholder="请输入提货点名称" @search="searchKeyword" v-model="keyword"
|
||||
@custom="searchKeyword"></up-search> -->
|
||||
<view class="">
|
||||
<view class="" style="display: flex;justify-content: space-around;margin-top: 24rpx;color:#777777">
|
||||
<view :class="{act: tabIndex==1}" @click="changeTabs(1)">
|
||||
订单列表
|
||||
</view>
|
||||
<view :class="{act: tabIndex==2}" @click="changeTabs(2)">
|
||||
报价记录
|
||||
</view>
|
||||
</view>
|
||||
<view style="height: 8rpx;" />
|
||||
<view class="line" :style="{left:tabIndex==1?tabsLeft+'px':tabsRight+'px'}" />
|
||||
</view>
|
||||
</view>
|
||||
</up-sticky>
|
||||
|
||||
|
||||
<view class="content">
|
||||
<view class="card" v-for="(item,index) in goodsList" :key='index'>
|
||||
<view class="head">
|
||||
<!-- <text> {{orer_sn}}</text> -->
|
||||
<!-- <text style="color: #989898;">{{time}}</text> -->
|
||||
</view>
|
||||
<view class="card-content">
|
||||
<view class="card-content-l" style="width: 152rpx;height: 152rpx;">
|
||||
<image style="width: 152rpx;height: 152rpx;" src="../../static/logo.png" mode=""></image>
|
||||
<image style="width: 152rpx;height: 152rpx;" :src="item.goods.imgs" mode=""></image>
|
||||
<view class="status">
|
||||
未报价
|
||||
{{tabIndex==1?"未报价":"已报价" }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="card-content-r">
|
||||
<view class="title ellipsis">
|
||||
正宗新疆哈密瓜网纹瓜
|
||||
{{item.goods.name}}
|
||||
</view>
|
||||
<view class="need">
|
||||
需求量: 100斤
|
||||
需求量: {{item.need_num}}{{item.unit_name}}
|
||||
</view>
|
||||
<view class="ipt">
|
||||
<up-input placeholderStyle='fontSize:24rpx' placeholder="点击数入报价数量" v-model="value1"
|
||||
<up-input placeholderStyle='fontSize:24rpx' placeholder="点击数入报价数量" :readonly="tabIndex==2"
|
||||
v-model="item.nums"
|
||||
style="margin-right: 10rpx;background-color:#F6F6F6;border: none;"></up-input>
|
||||
<!-- <up-input placeholderStyle='fontSize:24rpx' placeholder="点击数入报价数量" :readonly="tabIndex==2"
|
||||
v-model="item.num"
|
||||
style="margin-right: 10rpx;background-color:#F6F6F6;border: none;"></up-input> -->
|
||||
<up-input placeholderStyle='fontSize:24rpx' style="background-color: #F6F6F6;border: none;"
|
||||
placeholder="点击数入产品报价" v-model="value2"></up-input>
|
||||
placeholder="点击数入产品报价" @blur="priceBlur(index)" :readonly="tabIndex==2"
|
||||
v-model="item.price"></up-input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="status-png">
|
||||
<image :src="errPng" style="width: 108rpx; height: 84rpx;"></image>
|
||||
<view class="status-png" v-if="tabIndex==2">
|
||||
<image :src="item.is_adopt?successPng:errPng" style="width: 108rpx; height: 84rpx;"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="card-footer">
|
||||
共100斤 合计:<text style="font-size: 28rpx;color: #FC452F;font-weight: 700;">¥500.00</text>
|
||||
<view class="card-footer" v-if="item.nums &&item.price">
|
||||
共{{item.nums}}{{item.unit_name}} 合计:<text
|
||||
style="font-size: 28rpx;color: #FC452F;font-weight: 700;">¥{{item.nums*item.price}}</text>
|
||||
</view>
|
||||
<up-line style="margin-top: 30rpx;" color="#F3F3F3"></up-line>
|
||||
</view>
|
||||
|
||||
<view class="submit-btn">
|
||||
<up-button shape='circle' color='#20B128' text="提交"></up-button>
|
||||
<view class="submit-btn" v-if="tabIndex==1">
|
||||
<up-button shape='circle' color='#20B128' @click="submit" text="提交"></up-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
@ -45,18 +74,96 @@
|
|||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
reactive
|
||||
reactive,
|
||||
} from "vue"
|
||||
const value1 = ref('')
|
||||
const value2 = ref('')
|
||||
import {
|
||||
OpurchaseGoodsOfferApi,
|
||||
OpurchaseGoodsOfferListApi
|
||||
} from "@/api/quotation.js"
|
||||
|
||||
// 状态图片url
|
||||
const successPng = ref('https://lihai001.oss-cn-chengdu.aliyuncs.com/attach/739c3202405071458553459.png')
|
||||
const errPng = ref('https://lihai001.oss-cn-chengdu.aliyuncs.com/attach/04c2c202405071501462462.png')
|
||||
// 状态图片url结束
|
||||
|
||||
|
||||
// tabsindex
|
||||
const tabIndex = ref(1)
|
||||
const {
|
||||
windowWidth
|
||||
} = uni.getSystemInfoSync();
|
||||
const tabsLeft = ref(((windowWidth / 2) - 26) / 2)
|
||||
const tabsRight = ref(tabsLeft.value + (windowWidth / 2))
|
||||
// tabsindex结束
|
||||
|
||||
const priceBlur = (index) => {
|
||||
goodsList.value[index].price = Number(goodsList.value[index].price).toFixed(2)
|
||||
}
|
||||
|
||||
// 列表
|
||||
const goodsList = ref([])
|
||||
const getGoodsList = async (type) => {
|
||||
let res = await OpurchaseGoodsOfferListApi({
|
||||
type
|
||||
})
|
||||
goodsList.value = res.data.lists
|
||||
|
||||
goodsList.value.forEach(item => {
|
||||
item.nums = item.nums ? item.nums : ''
|
||||
item.price = (+item.price) ? item.price : ''
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
const changeTabs = (num) => {
|
||||
tabIndex.value = num
|
||||
getGoodsList(num)
|
||||
}
|
||||
|
||||
getGoodsList(tabIndex.value)
|
||||
// 列表结束
|
||||
const submit = async () => {
|
||||
let datas = goodsList.value.map(item => ({
|
||||
id: item.id,
|
||||
nums: item.nums,
|
||||
price: item.price
|
||||
}))
|
||||
let newData = []
|
||||
datas.forEach(item => {
|
||||
if (item.nums && item.price) {
|
||||
newData.push(item)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
let res = await OpurchaseGoodsOfferApi({
|
||||
data: newData
|
||||
})
|
||||
tabIndex.value = 2
|
||||
getGoodsList(tabIndex.value)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.head {
|
||||
padding: 20rpx;
|
||||
background-color: white;
|
||||
position: relative;
|
||||
|
||||
.act {
|
||||
color: #20B128;
|
||||
}
|
||||
|
||||
.line {
|
||||
width: 26px;
|
||||
height: 5rpx;
|
||||
background-color: #20B128;
|
||||
border-radius: 50rpx;
|
||||
position: absolute;
|
||||
transition: 300ms;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 20rpx;
|
||||
padding-bottom: 150rpx;
|
||||
|
@ -68,12 +175,7 @@
|
|||
box-sizing: border-box;
|
||||
background-color: white;
|
||||
|
||||
.head {
|
||||
font-size: 28rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
|
||||
.card-content {
|
||||
display: flex;
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
<scroll-view scroll-y style="height: 100%;width: 100%;">
|
||||
<view class="page-box1">
|
||||
<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>
|
||||
<view class="shop-content" style="width: 490rpx;">
|
||||
<view class="title">
|
||||
|
@ -368,7 +368,7 @@
|
|||
align-items: center;
|
||||
|
||||
.num {
|
||||
width: 60rpx;
|
||||
margin: 0 20rpx;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<view class="list-item" @click="navTo(2)">
|
||||
<image src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/45241202404261403353935.png"></image>
|
||||
<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 class="list-item">
|
||||
<image src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/96915202404261403582769.png"></image>
|
||||
|
@ -60,6 +60,7 @@
|
|||
import { ref } from "vue";
|
||||
import useUserStore from "@/store/user";
|
||||
import { orderCountApi } from "@/api/order.js";
|
||||
import { onShow } from "@dcloudio/uni-app"
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
|
@ -75,7 +76,6 @@
|
|||
orderCount.value = res.data;
|
||||
})
|
||||
}
|
||||
getOrderCount();
|
||||
|
||||
const navTo = (type=0) => {
|
||||
uni.navigateTo({
|
||||
|
@ -90,6 +90,10 @@
|
|||
url: '/pages/login/login'
|
||||
})
|
||||
}
|
||||
|
||||
onShow(()=>{
|
||||
getOrderCount();
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
@ -153,7 +157,7 @@
|
|||
left: 0;
|
||||
z-index: 3;
|
||||
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-repeat: no-repeat;
|
||||
|
||||
|
|
|
@ -3,6 +3,28 @@
|
|||
<view class="count_down" v-if="datas.paid==0&&countDown">
|
||||
还剩<text>{{countDown}}</text>订单自动取消
|
||||
</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="address-info">
|
||||
<view class="top">
|
||||
|
@ -110,28 +132,32 @@
|
|||
<block v-else>
|
||||
<view></view>
|
||||
<view style="width: 450rpx;">
|
||||
<up-button v-if="datas.status==0||datas.status==1" color="#20B128" shape="circle" @click="">确认收货</up-button>
|
||||
<up-button v-else 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" plain shape="circle" @click="purchaseAgain">再次购买</up-button>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<orderCanclePopup :show="showCancel" @close="showCancel=false" @change="submitCancel" />
|
||||
<addressPopup v-if="addressList.length>0" :show="showAddress" :list="addressList" @close="showAddress=false" @change="changeAddress" />
|
||||
<modal :show="false" content="您还没有添加收货地址,请点击添加"></modal>
|
||||
<addressPopup ref="addressRef" :show="showAddress" :list="addressList" @close="showAddress=false" @change="changeAddress" />
|
||||
<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>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onLoad, onBackPress } from "@dcloudio/uni-app";
|
||||
import { ref } from "vue";
|
||||
import { nextTick, ref } from "vue";
|
||||
import addressPopup from "@/components/addressPopup.vue";
|
||||
import orderCanclePopup from "@/components/orderCanclePopup.vue";
|
||||
import shopListPopupVue from "@/components/shopListPopup.vue";
|
||||
import modal from "@/components/modal.vue";
|
||||
import { orderDetailApi, cancelOrderApi, rePaymentApi } from "@/api/order.js"
|
||||
import { orderDetailApi, cancelOrderApi, rePaymentApi, confirmReceiptApi, purchaseAgainApi } from "@/api/order.js"
|
||||
import { addressListsApi, merchantListApi } from "@/api/user.js";
|
||||
|
||||
const showCancel = ref(false);
|
||||
const showTake = ref(false);
|
||||
|
||||
const submitCancel = (e) => {
|
||||
showCancel.value = false;
|
||||
|
@ -157,6 +183,21 @@
|
|||
order_id: datas.value.id
|
||||
}).then(res=>{
|
||||
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){
|
||||
targetDate = new Date(res.data.create_time).getTime() + 30*60*1000;
|
||||
// 每秒更新一次倒计时
|
||||
|
@ -173,6 +214,20 @@
|
|||
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 getAddressList = ()=>{
|
||||
|
@ -186,26 +241,67 @@
|
|||
if(addressList.value.length>0){
|
||||
addressInfo.value = addressList.value[0];
|
||||
}
|
||||
if(addressInfo.value.address_id) nextTick(()=>{
|
||||
addressRef.value.setCheck(addressInfo.value.address_id);
|
||||
})
|
||||
})
|
||||
}
|
||||
getAddressList();
|
||||
// 选择地址
|
||||
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 shopRef = ref(false);
|
||||
const shopListShow = ref(false);
|
||||
const merchantList = ref([]);
|
||||
const myAddressInfo = ref({
|
||||
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);
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
getMerchantList();
|
||||
// 定位
|
||||
const LoadAddress = () => {
|
||||
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 = ()=>{
|
||||
rePaymentApi({
|
||||
order_id: datas.value.id,
|
||||
mer_id: shopInfo.value.mer_id,
|
||||
address_id: addressInfo.value.address_id,
|
||||
pay_type: 1
|
||||
}).then(res=>{
|
||||
if(!res.data?.nonceStr) return uni.$u.toast('支付失败!');
|
||||
|
@ -240,6 +336,15 @@
|
|||
})
|
||||
}
|
||||
|
||||
// 再次购买
|
||||
const purchaseAgain = ()=>{
|
||||
purchaseAgainApi({
|
||||
order_id: datas.value.id
|
||||
}).then(res=>{
|
||||
uni.$u.toast('已加入购物车');
|
||||
})
|
||||
}
|
||||
|
||||
// 设置目标日期
|
||||
let targetDate = "";
|
||||
let countDown = ref("");
|
||||
|
@ -265,6 +370,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) => {
|
||||
uni.setNavigationBarTitle({
|
||||
title: option.type == 0 ? '等待付款' : '订单详情'
|
||||
|
|
|
@ -27,13 +27,13 @@
|
|||
</view>
|
||||
<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="#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 v-else class="item-btn">
|
||||
<!-- <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>
|
||||
<view v-if="datas.status==2||datas.status==3" style="width: 80px;"><up-button size="small" plain color="#20B128"
|
||||
<view @click="purchaseAgain" v-if="datas.status==2||datas.status==3" style="width: 80px;"><up-button size="small" plain color="#20B128"
|
||||
shape="circle">再次购买</up-button></view>
|
||||
<view @click="navTo" style="width: 80px;"><up-button size="small" plain color="#20B128"
|
||||
shape="circle">查看详情</up-button></view>
|
||||
|
@ -67,11 +67,19 @@
|
|||
})
|
||||
}
|
||||
|
||||
const emit = defineEmits(['cancleOrder', 'rePay']);
|
||||
const emit = defineEmits(['cancleOrder', 'rePay', 'takeOrder', 'purchaseAgain']);
|
||||
const cancleOrder = ()=>{
|
||||
emit('cancleOrder', props.datas)
|
||||
}
|
||||
|
||||
const takeOrder = ()=>{
|
||||
emit('takeOrder', props.datas)
|
||||
}
|
||||
|
||||
const purchaseAgain = ()=>{
|
||||
emit('purchaseAgain', props.datas)
|
||||
}
|
||||
|
||||
const rePay = ()=>{
|
||||
emit('rePay', props.datas)
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="loadMoreGood">
|
||||
<view class="page-box">
|
||||
<view v-if="list.length>0" class="list">
|
||||
<good v-for="(item, index) in list" :datas="item" :key="index" :type="k" @cancleOrder="cancleOrder"
|
||||
@rePay="rePay"></good>
|
||||
<good v-for="(item, index) in list" :datas="item" :key="index" :type="k" @cancleOrder="cancleOrder" @takeOrder="takeOrder"
|
||||
@rePay="rePay" @purchaseAgain="purchaseAgain"></good>
|
||||
</view>
|
||||
<view v-if="!where[k].loading&&list.length==0" style="padding-top: 100rpx;">
|
||||
<up-empty text="订单空空如也"
|
||||
|
@ -40,16 +40,17 @@
|
|||
</swiper-item>
|
||||
</swiper>
|
||||
<orderCanclePopup :show="showCancel" @close="showCancel=false" @change="submitCancel" />
|
||||
<modal :show="showTake" title="确认收货" content="请确认您已收到货" @close="showTake=false" @change="confirmReceipt"></modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onLoad } from "@dcloudio/uni-app"
|
||||
import { onLoad, onUnload } from "@dcloudio/uni-app"
|
||||
import { ref } from 'vue';
|
||||
import good from "./component/good.vue";
|
||||
import orderCanclePopup from "@/components/orderCanclePopup.vue"
|
||||
import { orderListApi } from "@/api/order.js";
|
||||
import { cancelOrderApi, rePaymentApi } from "@/api/order.js"
|
||||
import modal from "@/components/modal.vue"
|
||||
import { cancelOrderApi, rePaymentApi, confirmReceiptApi, orderListApi, purchaseAgainApi } from "@/api/order.js"
|
||||
|
||||
const tabsActive = ref(0)
|
||||
const changeTab = ({ index }) => {
|
||||
|
@ -69,9 +70,10 @@
|
|||
tabsActive.value = current;
|
||||
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 == 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);
|
||||
let cancelId = '';
|
||||
const submitCancel = (e) => {
|
||||
|
@ -92,9 +94,37 @@
|
|||
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 purchaseAgain = (e)=>{
|
||||
purchaseAgainApi({
|
||||
order_id: e.id
|
||||
}).then(res=>{
|
||||
uni.$u.toast('已加入购物车');
|
||||
})
|
||||
}
|
||||
|
||||
const rePay = (e) => {
|
||||
rePaymentApi({
|
||||
order_id: e.id,
|
||||
address_id: e.address_id,
|
||||
mer_id: e.merchant,
|
||||
pay_type: 1
|
||||
}).then(res => {
|
||||
if (!res.data?.nonceStr) return uni.$u.toast('支付失败!');
|
||||
|
@ -111,7 +141,7 @@
|
|||
title: '订单支付成功',
|
||||
icon: 'success'
|
||||
})
|
||||
getOrderList(1, '', 0);
|
||||
reloadAll();
|
||||
} else uni.$u.toast('支付失败')
|
||||
},
|
||||
fail: (e) => {
|
||||
|
@ -171,7 +201,7 @@
|
|||
const loadMoreGood = ()=>{
|
||||
if (swiperCurrent.value == 0) getOrderList(0);
|
||||
if (swiperCurrent.value == 1) getOrderList(1, '', 0);
|
||||
if (swiperCurrent.value == 2) getOrderList(2, 0);
|
||||
if (swiperCurrent.value == 2) getOrderList(2, 1);
|
||||
}
|
||||
|
||||
// 搜索
|
||||
|
@ -181,7 +211,7 @@
|
|||
where.value[+swiperCurrent.value].loadend = false;
|
||||
if (swiperCurrent.value == 0) getOrderList(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;
|
||||
|
@ -191,6 +221,16 @@
|
|||
})
|
||||
}
|
||||
|
||||
const reloadAll = () => { //对订单进行操作时刷新页面
|
||||
where.value.forEach(item=>{
|
||||
item.page_no = 1;
|
||||
item.loadend = false;
|
||||
});
|
||||
getOrderList(1, '', 0);
|
||||
getOrderList(0);
|
||||
getOrderList(2, 1);
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
if (options.type) {
|
||||
tabsActive.value = +options.type;
|
||||
|
@ -200,14 +240,13 @@
|
|||
if(options.back) back = options.back;
|
||||
// getOrderList(0);
|
||||
// getOrderList(1, '', 0);
|
||||
// getOrderList(2, 0);
|
||||
// getOrderList(2, 1);
|
||||
|
||||
uni.$on('reLoadOrderList', () => { //对订单进行操作时刷新页面
|
||||
where.value.forEach(item=>item.page_no=1);
|
||||
getOrderList(1, '', 0);
|
||||
getOrderList(0);
|
||||
getOrderList(2, 0);
|
||||
});
|
||||
uni.$on('reLoadOrderList', reloadAll);
|
||||
})
|
||||
|
||||
onUnload(()=>{
|
||||
uni.$off('reLoadOrderList', reloadAll)
|
||||
})
|
||||
|
||||
</script>
|
||||
|
|
|
@ -116,9 +116,9 @@
|
|||
</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" />
|
||||
<shopListPopupVue v-if="merchantList.length>0" :show="shopListShow" :list="merchantList"
|
||||
<shopListPopupVue ref="shopRef" :show="shopListShow" :list="merchantList"
|
||||
@close="shopListShow=false" @change="changeShop" @search="searchShop" />
|
||||
<modal title="尚未设置收货地址" content="您还没有添加收货地址,请点击添加" cancleText="添加地址" confirmText="继续支付" :show="toastAddressShow"
|
||||
@close="addAddress" @change="goPay" />
|
||||
|
@ -159,6 +159,22 @@
|
|||
const toastAddressShow = ref(false);
|
||||
|
||||
|
||||
// 选择地址
|
||||
const addressRef = ref(null);
|
||||
const showAddress = ref(false);
|
||||
const addressInfo = ref({});
|
||||
const changeAddress = (e) => {
|
||||
addressInfo.value = e;
|
||||
showAddress.value = false;
|
||||
isAddress.value = true;
|
||||
}
|
||||
const openAddress = () => {
|
||||
if (addressList.length > 0) showAddress.value = true;
|
||||
else uni.navigateTo({
|
||||
url: '/pagesOrder/addressEdit/addressEdit'
|
||||
})
|
||||
}
|
||||
|
||||
// 地址相关
|
||||
const addressList = ref([]);
|
||||
const getAddressList = () => {
|
||||
|
@ -174,24 +190,16 @@
|
|||
addressInfo.value = addressList.value[0];
|
||||
isAddress.value = true;
|
||||
}
|
||||
if(addressInfo.value.address_id) {
|
||||
nextTick(()=>{
|
||||
addressRef.value.setCheck(addressInfo.value.address_id);
|
||||
})
|
||||
}
|
||||
// 选择地址
|
||||
const showAddress = ref(false);
|
||||
const addressInfo = ref({});
|
||||
const changeAddress = (e) => {
|
||||
addressInfo.value = e;
|
||||
showAddress.value = false;
|
||||
isAddress.value = true;
|
||||
}
|
||||
const openAddress = () => {
|
||||
if (addressList.length > 0) showAddress.value = true;
|
||||
else uni.navigateTo({
|
||||
url: '/pagesOrder/addressEdit/addressEdit'
|
||||
})
|
||||
}
|
||||
|
||||
// 提货点相关
|
||||
const shopRef = ref(null);
|
||||
const shopListShow = ref(false);
|
||||
const merchantList = ref([]);
|
||||
const myAddressInfo = ref({
|
||||
|
@ -210,6 +218,9 @@
|
|||
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);
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -24,7 +24,8 @@ const useUserStore = defineStore("user", () => {
|
|||
}
|
||||
|
||||
// #ifdef H5
|
||||
token.value = "dc1b0fbf7db707502bd127cd02797a6a"
|
||||
|
||||
token.value = "c13a559d04e18ddcc685eebb35c89c0f"
|
||||
// token.value = "95b24dd6d2dda836fe07854b08ba0944"
|
||||
userInfo.value = {
|
||||
avatar: "https://lihaiim.oss-cn-chengdu.aliyuncs.com/image/admin/default_avatar.png",
|
||||
|
@ -34,7 +35,7 @@ const useUserStore = defineStore("user", () => {
|
|||
mobile: "19330904744",
|
||||
nickname: "用户1714964250",
|
||||
supplier: null,
|
||||
token: "dc1b0fbf7db707502bd127cd02797a6a"
|
||||
token: "c13a559d04e18ddcc685eebb35c89c0f"
|
||||
}
|
||||
// #endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue