作者 卢胜

订单交互

... ... @@ -12,5 +12,9 @@ export const sellerOrderList = (data) => request({url: 'order/order_seller_list'
// 买家收货
export const order_confirm = (data) => request({url: 'order/order_confirm',method: 'post',data: data})
// 买家收货
// export const order_confirm = (data) => request({url: 'order/order_confirm',method: 'post',data: data})
\ No newline at end of file
// 卖家发货
export const order_send = (order_id) => request({url: 'order/order_send',method: 'post',data: {order_id}})
// 卖家上传证明
export const order_license = (data) => request({url: 'order/order_license',method: 'post',data: data})
\ No newline at end of file
... ...
... ... @@ -38,10 +38,10 @@
</view>
<view class="line"></view>
<view class="botBtn flexA">
<view v-if="reQest(item.status)" class="flexC yellow" @click="openshow(item.license_preview)">交易证明
<view v-if="item.license_preview" class="flexC yellow" @click="openshow(item.license_preview)">交易证明
</view>
<view v-if="reChest(item.status)" class="flexC">已收货</view>
<view v-if="reNest(item.status)" class="flexC" @click="order_confirm(item.id)">未收货</view>
<view v-if="reChest(item.status)" class="flexC" @click="order_confirm(item.id,idx,1)">已收货</view>
<view v-if="reChest(item.status)" class="flexC" @click="order_confirm(item.id,idx,2)" >未收货</view>
</view>
</view>
</view>
... ... @@ -92,14 +92,24 @@
},
methods: {
//确认收货
async order_confirm(id) {
async order_confirm(id,idx,type) {
let obj = {
order_id: id,
type: 2,
type: type,
}
try {
const res = await order_confirm(obj)
console.log('order_confirm', res)
if(this.typeindex=2){
this.showlist.splice(idx,1)
}else{
if(type==2){
this.showlist[idx].status=5
}else{
this.showlist[idx].status=6
}
}
// 保存数据
} catch (err) {
uni.showToast({
... ... @@ -157,11 +167,10 @@
if (s == 3) return true;
},
reChest(s) {
if (s == 6) return true;
if (s == 7) return true;
if (s == 4) return true;
if (s == 3) return true;
},
reNest(s) {
},
},
}
... ...
... ... @@ -40,11 +40,11 @@
</view>
<view class="line"></view>
<view class="botBtn flexA">
<view class="flexC" @click="openshowBuyer(item)">买家信息</view>
<!-- <view class="flexC">上传转赠证明</view>
<view class="flexC">已发货</view>
<view class="flexC yellow" @click="show=true">查看交易证明</view>-->
<view class="flexC yellow">重新上传证明</view>
<view v-if="reseller(item.status)" class="flexC" @click="openshowBuyer(item)">买家信息</view>
<view v-if="!item.license_preview" class="flexC" @click="openimag(item.id,idx)">上传转赠证明</view>
<view v-if="reseller(item.status)" class="flexC" @click="order_send(item.id,idx)">发货</view>
<view v-if="item.license_preview" class="flexC yellow" @click="openshow(item.license_preview)">查看交易证明</view>
<view v-if="item.license_preview" class="flexC yellow" @click="openimag(item.id,idx)">重新上传证明</view>
</view>
</view>
</view>
... ... @@ -53,7 +53,7 @@
<view class="popTitle">
转赠证明
</view>
<image class="popImage" src="/static/logo.png" mode=""></image>
<image class="popImage" :src="licenimg" mode=""></image>
<view class="popBtn flexC">
<view class="btn flexC" @click="show=false">确定</view>
</view>
... ... @@ -76,7 +76,7 @@
<view class="left"><text style="color: #FC4338;">*</text>微信号:</view>
<view class="right flexA">
<view class="fw700">{{wechart}}</view>
<view style="margin-left: 16rpx;color: rgba(0,0,0,0.4);" @click="copy(code)">复制</view>
<view style="margin-left: 16rpx;color: rgba(0,0,0,0.4);" @click="copy(code)">复制</view>
</view>
</view>
<view class="list flexA">
... ... @@ -104,8 +104,13 @@
<script>
import {
sellerOrderList
sellerOrderList,
order_send,
order_license
} from '@/api/order.js'
import {
baseURL
} from '@/utils/request.js'
export default {
data() {
return {
... ... @@ -133,6 +138,10 @@
wechart: "",
name: "",
phone: "",
//证明
imgid: "",
imgindex: "",
licenimg: "",
}
},
onLoad() {
... ... @@ -140,6 +149,15 @@
},
methods: {
// 状态筛选
reseller(s) {
if (s == 2) return true;
},
rechange(s) {
if (s == 3) return true;
if (s == 4) return true;
if (s == 6) return true;
},
openshowBuyer(item) {
this.showBuyer = true
this.code = item.buyer_name
... ... @@ -147,6 +165,79 @@
this.name = item.buyer_name
this.phone = item.buyer_mobile
},
// 查看证明
openshow(img) {
this.show = true
this.licenimg = img
console.log(this.licenimg)
},
//上传证明
openimag(id, imgindex) {
let that = this
that.imgid = id
that.imgindex = imgindex
uni.chooseImage({ // 从本地选择图片或使用相机拍照
success: (res) => {
count: 1, // 最多可以选择的图片张数,默认为9张
console.log(res)
const tempFilePaths = res.tempFilePaths; // 成功的返回图片的本地路径列表
uni.uploadFile({ // 直接上传文件到云储存
url: baseURL + '/common/upload', //仅为示例,非真实的接口地址
filePath: res.tempFilePaths[0], // 要上传文件的对象
name: 'file',
formData: {
token: uni.getStorageSync('token')
},
success: (uploadFileRes) => {
let data = JSON.parse(uploadFileRes.data);
console.log(data);
that.licenimg = data.data.fullurl; // 绝对路径
console.log(that.licenimg)
that.order_license()
}
});
}
})
return;
},
// 卖家上传证明
async order_license() {
let obj = {
order_id: this.imgid,
license: this.licenimg
}
try {
const res = await order_license(obj)
console.log('order_license', res)
this.list[this.imgindex].license_preview = this.licenimg
// 保存数据
} catch (err) {
uni.showToast({
title: err,
icon: 'none'
})
console.log('order_license', err)
}
},
//卖家发货
async order_send(id, idx) {
try {
const res = await order_send(id)
console.log('order_send', res)
if (this.typeindex == 0) {
this.list[idx].status = 3
} else {
this.list.splice(idx, 1)
}
// 保存数据
} catch (err) {
uni.showToast({
title: err,
icon: 'none'
})
console.log('order_send', err)
}
},
//复制
copy(it) {
uni.setClipboardData({
... ...
import {baseURL} from './request.js'
import {toast,toa} from './toast.js'
export const uploadFile = (tempFilePaths,data)=>{
import {
baseURL
} from './request.js'
import {
toast,
toa
} from './toast.js'
export const uploadFile = (tempFilePaths, data) => {
return new Promise((resolve, reject) => {
toa.loading('上传中..')
uni.uploadFile({
toa.loading('上传中..')
uni.uploadFile({
url: baseURL + '/common/upload', //仅为示例,非真实的接口地址
filePath: tempFilePaths,
name: 'file',
formData: {...data,token:uni.getStorageSync('token') || ''},
formData: {
...data,
token: uni.getStorageSync('token') || ''
},
success: (res) => {
toa.hideLoading()
console.log(res);
if(res.statusCode==200){
if (res.statusCode == 200) {
// return res
resolve(JSON.parse(res.data).data)
}
},
fail:(err)=>{
fail: (err) => {
toa.hideLoading()
toast(JSON.parse(err.data).msg)
console.log(err,'上传报错');
console.log(err, '上传报错');
// return
reject(err)
}
})
})
}
\ No newline at end of file
}
... ...