You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
huazhiyu/pages/warehouse/buy.vue

466 lines
10 KiB

1 year ago
<template>
<view class="page">
<!-- 订单tab -->
<view class="order-tab">
1 year ago
<view class="tab" :class="{'action':status==-1}" @click="onOrderTab(-1)">
<text>我的仓库</text>
1 year ago
<text class="line"></text>
</view>
1 year ago
<view class="tab" :class="{'action':status==0}" @click="onOrderTab(0)">
<text>付款确认</text>
1 year ago
<text class="line"></text>
</view>
1 year ago
<view class="tab" :class="{'action':status==1}" @click="onOrderTab(1)">
<text>收款确认</text>
1 year ago
<text class="line"></text>
</view>
1 year ago
<view class="tab" :class="{'action':status==3}" @click="onOrderTab(3)">
<text>投诉订单</text>
1 year ago
<text class="line"></text>
</view>
1 year ago
<view class="tab" :class="{'action':status==4}" @click="onOrderTab(4)">
<text>发货状态</text>
1 year ago
<text class="line"></text>
</view>
</view>
<!-- 订单列表 -->
<view class="order-list">
1 year ago
<view v-if="tableData.length>0">
1 year ago
<view class="list" v-for="(item,index) in tableData" @click="onOrderList(item)" :key="index">
1 year ago
<view class="title-status">
<view class="title">
<text>订单号{{item.order_sn}}</text>
</view>
<view class="status">
<text>{{item.status==0?'待支付':item.status==1?'待确认':item.status==2?'待委托':item.status==3?'已投诉':item.status==4?'待发货':item.status==5?'待收货':item.status==-1?'已取消':''}}</text>
</view>
1 year ago
</view>
1 year ago
<view class="goods-list">
<view class="cangku">
所属仓库{{item.warehouse?item.warehouse.title:'-'}}
1 year ago
</view>
1 year ago
<view class="goods">
<view class="thumb">
<image :src="item.order_goods[0]?item.order_goods[0].goods_image:''" mode=""></image>
1 year ago
</view>
1 year ago
<view class="item">
<view class="goods-name">
<text class="two-omit">{{item.order_goods[0]?item.order_goods[0].goods_name:''}}</text>
</view>
<view class="goods-price">
<text class="min">{{item.order_goods[0]?item.order_goods[0].goods_price:''}}</text>
</view>
1 year ago
</view>
</view>
</view>
1 year ago
<view class="status-btn" v-if="item.status==0">
1 year ago
<view class="btn" style="margin:0;" @click.native.stop="cancelOrderHandle(item)">取消订单</view>
1 year ago
<view class="btnGroup">
1 year ago
<view class="btn" @click.native.stop="uploadPay(item,index)">上传凭证</view>
1 year ago
<view class="btn" @click.native.stop="goPay(item)">去支付</view>
<view class="btn" @click.native.stop="confirmPay(item)">支付确认</view>
</view>
</view>
<view class="status-btn" v-if="item.status==2">
1 year ago
<view class="btn" style="margin:0;" @click.native.stop="changeStatusHandle(item)">提取货物</view>
1 year ago
<view class="btnGroup">
1 year ago
<view class="btn" @click.native.stop="weituoHandle(item)">委托上架</view>
1 year ago
1 year ago
</view>
1 year ago
</view>
1 year ago
1 year ago
</view>
</view>
1 year ago
<view class="empty" v-else>
<image src="../../static/image/empty.png" mode="widthFix"></image>
<view class="emptyText">
暂无数据
</view>
</view>
1 year ago
</view>
1 year ago
<u-modal :show="show" :content='content' :title="'提示'"
:showCancelButton="true" @confirm="confirmHandle" @cancel="cancelHandle"
></u-modal>
1 year ago
<u-modal :show="tiqushow" content="您确定要提取货物吗?提取后货物将无法上架!" :title="'提示'"
:showCancelButton="true" @confirm="tiquconfirmHandle" @cancel="tiqucancelHandle"
></u-modal>
<u-upload
:previewFullImage="false"
@afterRead="afterRead"
width="176" height="176"
style="display: none;"
ref="uploadPay"
name="1"
></u-upload>
1 year ago
<u-toast ref="uToast"></u-toast>
1 year ago
</view>
</template>
<script>
1 year ago
import {getToken} from '@/common/auth.js'
1 year ago
import {getBuyerOrderList,cancelOrder,orderPay} from '@/common/api.js'
1 year ago
export default {
data() {
return {
1 year ago
page:1,
limit:10,
status:null,
tableData:[],
total:0,
1 year ago
content:'确定取消订单',
show:false,
1 year ago
tiqushow:false,
1 year ago
orderObj:{},
1 year ago
selectedIndex:-1,
tiquSelected:{}
1 year ago
};
},
onLoad(params) {
1 year ago
this.status = params.type;
this.getList()
1 year ago
},
methods:{
1 year ago
goPay(item){
1 year ago
console.log(item)
1 year ago
uni.navigateTo({
1 year ago
url:"/pages/warehouse/pay?num="+item.order_amount+'&id='+item.id
1 year ago
})
},
1 year ago
getList(val){
let params={
page:this.page,
limit:this.limit,
status:this.status==-1?'':this.status
}
getBuyerOrderList({...params,custom: { auth: true }}).then(res=>{
if(val){
this.tableData.push(...res.data.data)
}else{
this.tableData = res.data.data;
this.total = res.data.total
}
})
1 year ago
},
1 year ago
uploadPay(item,index){
this.$refs.uploadPay.chooseFile();
this.selectedIndex = index;
},
// 新增图片
async afterRead(event) {
console.log(event)
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
let lists = [].concat(event.file)
for (let i = 0; i < lists.length; i++) {
const result = await this.uploadFilePromise(lists[i].url)
this.$refs.uToast.show({
message:'上传成功'
})
if(event.name==1){
this.tableData[this.selectedIndex].pay_voucher = JSON.parse(result).data.url;
}
}
1 year ago
1 year ago
},
1 year ago
//上传照片
uploadFilePromise(url) {
return new Promise((resolve, reject) => {
let a = uni.uploadFile({
url: this.baseUrl+'api/common/upload',
filePath: url,
name: 'file',
header:{
token:getToken()
},
formData: {
},
success: (res) => {
if(JSON.parse(res.data).code==1){
setTimeout(() => {
resolve(res.data)
}, 1000)
}else{
uni.$u.toast(JSON.parse(res.data).msg)
resolve(res.data)
}
},
fail: (res) => {
console.log(res,"rrr")
}
});
})
},
confirmPay(item){
console.log(item,"0000")
if(!item.pay_voucher){
this.$refs.uToast.show({
message:'请上传支付凭证'
})
return;
}
let params={
pay_voucher:item.pay_voucher,
id:item.id,
1 year ago
status:1
1 year ago
}
orderPay(params).then(res=>{
this.getList()
})
},
changeStatusHandle(item){
this.tiqushow = true;
1 year ago
this.tiquSelected = item;
1 year ago
},
1 year ago
/**
* 订单tab点击
*/
onOrderTab(type){
1 year ago
this.status = type
this.getList()
1 year ago
},
/**
* 订单列表点击
*/
1 year ago
onOrderList(item){
1 year ago
uni.navigateTo({
1 year ago
url: '/pages/OrderDetails/OrderDetails?id='+item.id,
})
},
cancelOrderHandle(item){
this.orderObj = item;
this.show = true;
},
confirmHandle(){
1 year ago
cancelOrder({id:this.orderObj.id,status:-1}).then(res=>{
1 year ago
if(res.code==1){
this.$refs.uToast.show({
message:'取消订单成功'
})
this.show=false;
}
this.getList()
1 year ago
})
1 year ago
},
tiquconfirmHandle(){
1 year ago
let params={
pay_voucher:this.tiquSelected.id,
id:item.id,
status:4
}
orderPay(params).then(res=>{
this.getList()
this.tiqushow = false;
})
1 year ago
},
1 year ago
cancelHandle(){
this.show = false;
1 year ago
},
tiqucancelHandle(){
this.tiqushow = false;
},
weituoHandle(item){
uni.navigateTo({
url: '/pages/warehouse/weituo?id='+item.id,
})
1 year ago
}
1 year ago
},
onReachBottom() {
if(this.tableData.length<this.total){
this.page++;
this.getList('over')
}
},
1 year ago
}
</script>
<style scoped lang="scss">
.page{
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: #f6f6f6;
}
/* 订单tab */
.order-tab{
position: fixed;
left: 0;
1 year ago
top: 88rpx;
1 year ago
/* #ifdef APP-PLUS */
top: calc(50rpx + var(--status-bar-height));
/* #endif */
z-index: 10;
display: flex;
align-items: center;
width: 100%;
1 year ago
height: 90rpx;
background: rgb(35, 96, 48);
1 year ago
.tab{
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 20%;
height: 80%;
text{
font-size: 26rpx;
1 year ago
color: #4D9A5E;
1 year ago
}
}
.action{
text{
1 year ago
color: #fff;
font-weight: bold;
1 year ago
}
.line{
position: absolute;
left: 50%;
bottom: 0;
width: 60rpx;
height: 6rpx;
1 year ago
background: #fff;
border-radius:3px;
1 year ago
transform: translate(-50%,0);
}
}
}
/* 订单列表 */
.order-list{
1 year ago
margin:0 24rpx;
margin-top:110rpx;
1 year ago
/* #ifdef APP-PLUS */
margin-top: calc(170rpx + var(--status-bar-height));
/* #endif */
.list{
padding: 0 4%;
1 year ago
min-height: 390rpx;
1 year ago
background-color: #FFFFFF;
border-radius: 20rpx;
margin-bottom: 20rpx;
.title-status{
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
1 year ago
height: 80rpx;
border-bottom: 1px solid #eaeaee;
1 year ago
.title{
display: flex;
align-items: center;
text{
font-size: 26rpx;
1 year ago
color: gray;
1 year ago
}
}
.status{
display: flex;
align-items: center;
text{
font-size: 26rpx;
color: $base;
}
1 year ago
1 year ago
}
}
.goods-list{
width: 100%;
1 year ago
.cangku{
text-align: left;
color:gray;
padding:10rpx 0 0 0;
}
1 year ago
.goods{
display: flex;
align-items: center;
width: 100%;
1 year ago
height: 180rpx;
1 year ago
.thumb{
display: flex;
align-items: center;
width: 30%;
height: 100%;
image{
width: 160rpx;
height: 160rpx;
border-radius: 10rpx;
}
}
.item{
display: flex;
1 year ago
flex-direction: column;
justify-content: space-around;
margin-left:20rpx;
width: 100%;
1 year ago
height: 100%;
.goods-name{
text{
font-size: 26rpx;
color: #555555;
}
}
.goods-price{
display: flex;
align-items: center;
text{
1 year ago
color: $base;
1 year ago
}
.min{
font-size: 26rpx;
}
.max{
font-size: 34rpx;
}
}
}
}
}
.status-btn{
display: flex;
align-items: center;
1 year ago
justify-content: space-between;
1 year ago
width: 100%;
1 year ago
.btnGroup{
display: flex;
align-items: center;
justify-content: space-between;
1 year ago
}
1 year ago
.btn{
background-color: $base;
padding: 10rpx 10rpx;
border-radius: 10rpx;
font-size: 24rpx;
color: #ffffff;
text-align: center;
margin-left:10rpx;
1 year ago
}
1 year ago
1 year ago
}
}
}
1 year ago
.empty{
text-align: center;
margin-top:30%;
image{
width:40%;
height:auto;
}
.emptyText{
text-align: center;
font-size: 26rpx;
color:gray;
}
}
1 year ago
</style>