This commit is contained in:
zmj 2024-05-13 18:43:53 +08:00
parent 9eef80130c
commit babdd302f2
5 changed files with 806 additions and 770 deletions

View File

@ -15,6 +15,9 @@
</view>
</view>
<view style="margin-top: 20rpx;" @click="showPop=true">
<text>2024-4-7</text>-<text>2024-4-7</text>
</view>
<view class="recoder">
<view class="card" v-for="(item,index) in 10" :key="index">
<view class="right">

View File

@ -18,20 +18,19 @@
</view>
</view>
</up-sticky>
<view class="content">
<swiper class="swiper" circular>
<swiper-item>
<!-- 报价列表 -->
<view v-if="showGoods1">
<up-transition :show="showGoods1" mode="slide-left">
<view class="" v-if="goodsList1.length>0">
<view class="card" v-for="(item,index) in goodsList1" :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="item.goods.imgs" mode="">
</image>
<image style="width: 152rpx;height: 152rpx;" :src="item.goods.imgs" mode=""></image>
<view class="status">
{{tabIndex==1?"未报价":"已报价" }}
</view>
@ -47,6 +46,9 @@
<up-input :placeholderStyle="{fontSize:'20rpx'}" placeholder="输入报价数量"
:readonly="tabIndex==2" v-model="item.nums"
style="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> -->
<view style="width: 10rpx;">
</view>
@ -56,6 +58,17 @@
v-model="item.price"></up-input>
</view>
</view>
<!-- <view class="status-png" v-if="tabIndex==2">
<image v-if="is_storage==1 && is_adopt == 1" :src="waitPng"
style="width: 108rpx; height: 84rpx;">
</image>
<image v-else-if="is_storage==0 && is_adopt == 1" :src="waitPng"
style="width: 108rpx; height: 84rpx;">
</image>
<image v-else :src="waitPng" style="width: 108rpx; height: 84rpx;">
</image>
</view> -->
</view>
<view class="card-footer" v-if="item.nums && item.price">
{{item.nums}}{{item.unit_name}}&nbsp; &nbsp;合计:<text
@ -66,17 +79,23 @@
</view>
<up-empty @click='test2' v-else mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png">
</up-empty>
<!-- <button @click="test2">叫我按钮</button> -->
</up-transition>
</view>
</swiper-item>
<swiper-item>
<!-- 报价记录 -->
<view v-if="showGoods2">
<view v-if="goodsList2.length>0">
<up-transition :show="showGoods2" mode="slide-right">
<view class="" v-if="goodsList2.length>0">
<view class="card" v-for="(item,index) in goodsList2" :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="item.goods.imgs" mode="">
</image>
<image style="width: 152rpx;height: 152rpx;" :src="item.goods.imgs" mode=""></image>
<view class="status">
{{tabIndex==1?"未报价":"已报价" }}
</view>
@ -92,6 +111,9 @@
<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="点击数入产品报价"
@blur="priceBlur(index,goodsList2)" :readonly="tabIndex==2"
@ -99,8 +121,9 @@
</view>
</view>
<view class="status-png" v-if="tabIndex==2">
<image v-if="item.is_adopt==1" :src="waitPng"
style="width: 108rpx; height: 84rpx;">
<!-- <image :src="item.is_adopt?successPng:errPng" style="width: 108rpx; height: 84rpx;">
</image> -->
<image v-if="item.is_adopt==1" :src="waitPng" style="width: 108rpx; height: 84rpx;">
</image>
<image v-else-if="item.is_adopt==2" :src="successPng"
style="width: 108rpx; height: 84rpx;">
@ -115,25 +138,13 @@
</view>
<up-line style="margin-top: 30rpx;" color="#F3F3F3"></up-line>
</view>
</view>
<up-empty v-else mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png">
</up-empty>
</up-transition>
</view>
</swiper-item>
</swiper>
<!-- 报价列表 -->
<!-- 报价记录 -->
<view class="detail" @click="navgo('/pageQuota/Balance/detail')">
明细
</view>
@ -141,8 +152,6 @@
<up-button shape='circle' color='#20B128' @click="submit" text="提交"></up-button>
</view>
</view>
</view>
</template>

View File

@ -37,8 +37,8 @@
</view>
</view>
<view class="address-btn" v-if="datas.paid==0">
<view style="width: 80px;"><up-button @click="showAddress = true" size="small" shape="circle" color="#f6f6f6"
:customStyle="{color:'#666666'}">修改</up-button></view>
<view style="width: 80px;"><up-button @click="showAddress = 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;" v-else>
@ -49,13 +49,13 @@
</view>
</view>
<view class="address-btn" v-if="datas.paid==0">
<view style="width: 80px;"><up-button @click="showAddress = true" size="small" shape="circle" color="#f6f6f6"
:customStyle="{color:'#666666'}">修改</up-button></view>
<view style="width: 80px;"><up-button @click="showAddress = true" size="small" shape="circle"
color="#f6f6f6" :customStyle="{color:'#666666'}">修改</up-button></view>
</view>
</view>
<view class="m-card m-good" v-for="(item,index) in datas.goods_list" :key="index">
<view class="image">
<up-image :src="item.imgs" width="160rpx" height="160rpx"></up-image>
<up-image :src="item.imgs" width="120rpx" height="120rpx"></up-image>
</view>
<view class="body-content">
<view>
@ -67,11 +67,12 @@
<view>{{item.goods_unit}}</view>
<view>x{{item.nums}}</view>
</view>
</view>
<view class="time">
{{item.msg}}
</view>
</view>
</view>
</view>
<view class="m-card good-info" v-if="datas.paid==0">
<view v-if="datas.goods_list" class="row">
@ -84,7 +85,9 @@
</view>
<view class="row-need">
<view style="margin-right: 10rpx;">需付款</view>
<view v-if="datas.total"><text>¥</text>{{c_price(datas.total, 0)}}<text>.{{c_price(datas.total, 1)}}</text></view>
<view v-if="datas.total">
<text>¥</text>{{c_price(datas.total, 0)}}<text>.{{c_price(datas.total, 1)}}</text>
</view>
</view>
</view>
<view class="m-card good-info">
@ -138,35 +141,54 @@
<block v-if="!datas.paid">
<view style="color: #777777;" @click="showCancel=true">取消订单</view>
<view style="width: 450rpx;">
<up-button color="#20B128" shape="circle" @click="rePay" :throttleTime="1000">立即支付 ¥{{datas.total}}</up-button>
<up-button color="#20B128" shape="circle" @click="rePay" :throttleTime="1000">立即支付
¥{{datas.total}}</up-button>
</view>
</block>
<block v-else>
<view></view>
<view style="width: 450rpx;">
<up-button v-if="datas.status==0||datas.status==1" color="#20B128" shape="circle" @click="showTake=true">确认收货</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 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>
<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 { nextTick, ref } from "vue";
import {
onLoad,
onBackPress
} from "@dcloudio/uni-app";
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, confirmReceiptApi, purchaseAgainApi } from "@/api/order.js"
import { addressListsApi, merchantListApi } from "@/api/user.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);
@ -176,7 +198,7 @@
cancelOrderApi({
order_id: datas.value.id,
value: e.value
}).then(res=>{
}).then(res => {
uni.showToast({
title: '取消成功',
icon: 'none'
@ -190,15 +212,15 @@
}
const datas = ref({})
const getDetails = ()=>{
const getDetails = () => {
orderDetailApi({
order_id: datas.value.id
}).then(res=>{
}).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 {
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,
@ -206,22 +228,22 @@
detail: res.data.user_address
}
}
nextTick(()=>{
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;
if (!res.data.paid) {
targetDate = new Date(res.data.create_time).getTime() + 30 * 60 * 1000;
//
timer = setInterval(updateCountdown, 1000);
updateCountdown();
}
}).catch(err=>{
}).catch(err => {
uni.navigateBack();
})
}
const c_price = (price, index=0)=>{
const c_price = (price, index = 0) => {
price = price + '';
return price.split('.')[index] || (index ? '00' : '0');
}
@ -230,32 +252,32 @@
const addressRef = ref(null);
const showAddress = ref(false);
const addressInfo = ref({
address_id:''
address_id: ''
});
const changeAddress = (e) => {
addressInfo.value = e;
showAddress.value = false;
}
const openAddress = ()=>{
if(addressList.length>0) showAddress.value=true;
const openAddress = () => {
if (addressList.length > 0) showAddress.value = true;
else uni.navigateTo({
url: '/pagesOrder/addressEdit/addressEdit'
})
}
//
const addressList = ref([]);
const getAddressList = ()=>{
addressListsApi().then(res=>{
const getAddressList = () => {
addressListsApi().then(res => {
addressList.value = res.data.lists;
addressList.value.forEach(item=>{
if(item.is_default) {
addressList.value.forEach(item => {
if (item.is_default) {
addressInfo.value = item;
}
})
if(addressList.value.length>0){
if (addressList.value.length > 0) {
addressInfo.value = addressList.value[0];
}
if(addressInfo.value.address_id) nextTick(()=>{
if (addressInfo.value.address_id) nextTick(() => {
addressRef.value.setCheck(addressInfo.value.address_id);
})
})
@ -281,7 +303,7 @@
if (mer_name === null && myAddressInfo.value.long && merchantList.value.length > 0 && !shopInfo
.value.mer_id) {
shopInfo.value = merchantList.value[0];
nextTick(()=>{
nextTick(() => {
shopRef.value.setCheck(shopInfo.value.mer_id);
})
}
@ -311,14 +333,14 @@
getMerchantList(e)
}
const rePay = ()=>{
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('支付失败!');
}).then(res => {
if (!res.data?.nonceStr) return uni.$u.toast('支付失败!');
uni.requestPayment({
provider: 'wxpay',
timeStamp: res.data.timeStamp,
@ -327,7 +349,7 @@
signType: res.data.signType,
paySign: res.data.paySign,
success: (e) => {
if(e.errMsg == 'requestPayment:ok'){
if (e.errMsg == 'requestPayment:ok') {
uni.showModal({
title: '订单支付成功',
confirmText: '确认',
@ -339,22 +361,22 @@
});
}
})
}else uni.$u.toast('支付失败')
} else uni.$u.toast('支付失败')
},
fail: (e) => {
uni.$u.toast('用户取消支付')
}
})
}).catch(err=>{
}).catch(err => {
uni.$u.toast('网络错误')
})
}
//
const purchaseAgain = ()=>{
const purchaseAgain = () => {
purchaseAgainApi({
order_id: datas.value.id
}).then(res=>{
}).then(res => {
uni.$u.toast('已加入购物车');
})
}
@ -368,14 +390,15 @@
function updateCountdown() {
const now = new Date().getTime();
const distance = targetDate - now;
if(distance<0) return clearInterval(timer);
if (distance < 0) return clearInterval(timer);
//
const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((distance % (1000 * 60)) / 1000);
countDown.value = `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
countDown.value =
`${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
//
if (distance < 0) {
@ -385,10 +408,10 @@
}
//
const confirmReceipt = ()=>{
const confirmReceipt = () => {
confirmReceiptApi({
order_id: datas.value.id
}).then(res=>{
}).then(res => {
showTake.value = false;
uni.$u.toast('确认收货成功');
uni.navigateBack({
@ -400,7 +423,7 @@
}
//
const callPhone = (phone)=>{
const callPhone = (phone) => {
uni.makePhoneCall({
phoneNumber: phone
})
@ -410,13 +433,13 @@
uni.setNavigationBarTitle({
title: option.type == 0 ? '等待付款' : '订单详情'
})
if(option.id) {
if (option.id) {
datas.value.id = option.id;
getDetails()
}
})
onBackPress(()=>{
onBackPress(() => {
clearInterval(timer);
console.log("清除");
})
@ -475,8 +498,8 @@
margin-bottom: 20rpx;
.image {
width: 160rpx;
height: 160rpx;
width: 120rpx;
height: 120rpx;
margin-right: 20rpx;
border-radius: 14rpx;
overflow: hidden;
@ -488,6 +511,7 @@
flex-direction: column;
justify-content: space-between;
color: #989898;
// background-color: red;
.title {
display: flex;
@ -542,6 +566,4 @@
font-size: 22rpx;
}
}
</style>

View File

@ -26,15 +26,17 @@
<view class="all"> {{datas.goods_count}} 件商品, 总金额 <text>¥{{datas.total}}</text> </view>
</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" color="#20B128" shape="circle" @click="rePay">立即支付</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" 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 @click="takeOrder" v-if="datas.status==1" style="width: 80px;"><up-button size="small" color="#20B128"
shape="circle">确认收货</up-button></view>
<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="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>
</view>
@ -68,19 +70,19 @@
}
const emit = defineEmits(['cancleOrder', 'rePay', 'takeOrder', 'purchaseAgain']);
const cancleOrder = ()=>{
const cancleOrder = () => {
emit('cancleOrder', props.datas)
}
const takeOrder = ()=>{
const takeOrder = () => {
emit('takeOrder', props.datas)
}
const purchaseAgain = ()=>{
const purchaseAgain = () => {
emit('purchaseAgain', props.datas)
}
const rePay = ()=>{
const rePay = () => {
emit('rePay', props.datas)
}
</script>
@ -108,8 +110,8 @@
color: #989898;
.image {
width: 160rpx;
height: 160rpx;
width: 120rpx;
height: 120rpx;
margin-right: 20rpx;
border-radius: 14rpx;
}

View File

@ -25,7 +25,7 @@ const useUserStore = defineStore("user", () => {
// #ifdef H5
token.value = "4f8bef69a4b5a195e9d69a3a72955827"
token.value = "9cc93459ebdb4a2367a53a08b3d96e89"
// token.value = "95b24dd6d2dda836fe07854b08ba0944"
userInfo.value = {
avatar: "https://lihaiim.oss-cn-chengdu.aliyuncs.com/image/admin/default_avatar.png",
@ -35,7 +35,7 @@ const useUserStore = defineStore("user", () => {
mobile: "19330904744",
nickname: "用户1714964250",
supplier: null,
token: "4f8bef69a4b5a195e9d69a3a72955827"
token: "9cc93459ebdb4a2367a53a08b3d96e89"
}
// #endif