作者 卢胜

订单交互

@@ -12,5 +12,9 @@ export const sellerOrderList = (data) => request({url: 'order/order_seller_list' @@ -12,5 +12,9 @@ export const sellerOrderList = (data) => request({url: 'order/order_seller_list'
12 12
13 // 买家收货 13 // 买家收货
14 export const order_confirm = (data) => request({url: 'order/order_confirm',method: 'post',data: data}) 14 export const order_confirm = (data) => request({url: 'order/order_confirm',method: 'post',data: data})
15 -// 买家收货  
16 -// export const order_confirm = (data) => request({url: 'order/order_confirm',method: 'post',data: data})  
  15 +
  16 +// 卖家发货
  17 +export const order_send = (order_id) => request({url: 'order/order_send',method: 'post',data: {order_id}})
  18 +
  19 +// 卖家上传证明
  20 +export const order_license = (data) => request({url: 'order/order_license',method: 'post',data: data})
@@ -38,10 +38,10 @@ @@ -38,10 +38,10 @@
38 </view> 38 </view>
39 <view class="line"></view> 39 <view class="line"></view>
40 <view class="botBtn flexA"> 40 <view class="botBtn flexA">
41 - <view v-if="reQest(item.status)" class="flexC yellow" @click="openshow(item.license_preview)">交易证明 41 + <view v-if="item.license_preview" class="flexC yellow" @click="openshow(item.license_preview)">交易证明
42 </view> 42 </view>
43 - <view v-if="reChest(item.status)" class="flexC">已收货</view>  
44 - <view v-if="reNest(item.status)" class="flexC" @click="order_confirm(item.id)">未收货</view> 43 + <view v-if="reChest(item.status)" class="flexC" @click="order_confirm(item.id,idx,1)">已收货</view>
  44 + <view v-if="reChest(item.status)" class="flexC" @click="order_confirm(item.id,idx,2)" >未收货</view>
45 </view> 45 </view>
46 </view> 46 </view>
47 </view> 47 </view>
@@ -92,14 +92,24 @@ @@ -92,14 +92,24 @@
92 }, 92 },
93 methods: { 93 methods: {
94 //确认收货 94 //确认收货
95 - async order_confirm(id) { 95 + async order_confirm(id,idx,type) {
96 let obj = { 96 let obj = {
97 order_id: id, 97 order_id: id,
98 - type: 2, 98 + type: type,
99 } 99 }
100 try { 100 try {
101 const res = await order_confirm(obj) 101 const res = await order_confirm(obj)
102 console.log('order_confirm', res) 102 console.log('order_confirm', res)
  103 + if(this.typeindex=2){
  104 + this.showlist.splice(idx,1)
  105 + }else{
  106 + if(type==2){
  107 + this.showlist[idx].status=5
  108 + }else{
  109 + this.showlist[idx].status=6
  110 + }
  111 + }
  112 +
103 // 保存数据 113 // 保存数据
104 } catch (err) { 114 } catch (err) {
105 uni.showToast({ 115 uni.showToast({
@@ -157,11 +167,10 @@ @@ -157,11 +167,10 @@
157 if (s == 3) return true; 167 if (s == 3) return true;
158 }, 168 },
159 reChest(s) { 169 reChest(s) {
160 - if (s == 6) return true;  
161 - if (s == 7) return true;  
162 - if (s == 4) return true; 170 + if (s == 3) return true;
163 }, 171 },
164 reNest(s) { 172 reNest(s) {
  173 +
165 }, 174 },
166 }, 175 },
167 } 176 }
@@ -40,11 +40,11 @@ @@ -40,11 +40,11 @@
40 </view> 40 </view>
41 <view class="line"></view> 41 <view class="line"></view>
42 <view class="botBtn flexA"> 42 <view class="botBtn flexA">
43 - <view class="flexC" @click="openshowBuyer(item)">买家信息</view>  
44 - <!-- <view class="flexC">上传转赠证明</view>  
45 - <view class="flexC">已发货</view>  
46 - <view class="flexC yellow" @click="show=true">查看交易证明</view>-->  
47 - <view class="flexC yellow">重新上传证明</view> 43 + <view v-if="reseller(item.status)" class="flexC" @click="openshowBuyer(item)">买家信息</view>
  44 + <view v-if="!item.license_preview" class="flexC" @click="openimag(item.id,idx)">上传转赠证明</view>
  45 + <view v-if="reseller(item.status)" class="flexC" @click="order_send(item.id,idx)">发货</view>
  46 + <view v-if="item.license_preview" class="flexC yellow" @click="openshow(item.license_preview)">查看交易证明</view>
  47 + <view v-if="item.license_preview" class="flexC yellow" @click="openimag(item.id,idx)">重新上传证明</view>
48 </view> 48 </view>
49 </view> 49 </view>
50 </view> 50 </view>
@@ -53,7 +53,7 @@ @@ -53,7 +53,7 @@
53 <view class="popTitle"> 53 <view class="popTitle">
54 转赠证明 54 转赠证明
55 </view> 55 </view>
56 - <image class="popImage" src="/static/logo.png" mode=""></image> 56 + <image class="popImage" :src="licenimg" mode=""></image>
57 <view class="popBtn flexC"> 57 <view class="popBtn flexC">
58 <view class="btn flexC" @click="show=false">确定</view> 58 <view class="btn flexC" @click="show=false">确定</view>
59 </view> 59 </view>
@@ -76,7 +76,7 @@ @@ -76,7 +76,7 @@
76 <view class="left"><text style="color: #FC4338;">*</text>微信号:</view> 76 <view class="left"><text style="color: #FC4338;">*</text>微信号:</view>
77 <view class="right flexA"> 77 <view class="right flexA">
78 <view class="fw700">{{wechart}}</view> 78 <view class="fw700">{{wechart}}</view>
79 - <view style="margin-left: 16rpx;color: rgba(0,0,0,0.4);" @click="copy(code)">复制</view> 79 + <view style="margin-left: 16rpx;color: rgba(0,0,0,0.4);" @click="copy(code)">复制</view>
80 </view> 80 </view>
81 </view> 81 </view>
82 <view class="list flexA"> 82 <view class="list flexA">
@@ -104,8 +104,13 @@ @@ -104,8 +104,13 @@
104 104
105 <script> 105 <script>
106 import { 106 import {
107 - sellerOrderList 107 + sellerOrderList,
  108 + order_send,
  109 + order_license
108 } from '@/api/order.js' 110 } from '@/api/order.js'
  111 + import {
  112 + baseURL
  113 + } from '@/utils/request.js'
109 export default { 114 export default {
110 data() { 115 data() {
111 return { 116 return {
@@ -133,6 +138,10 @@ @@ -133,6 +138,10 @@
133 wechart: "", 138 wechart: "",
134 name: "", 139 name: "",
135 phone: "", 140 phone: "",
  141 + //证明
  142 + imgid: "",
  143 + imgindex: "",
  144 + licenimg: "",
136 } 145 }
137 }, 146 },
138 onLoad() { 147 onLoad() {
@@ -140,6 +149,15 @@ @@ -140,6 +149,15 @@
140 149
141 }, 150 },
142 methods: { 151 methods: {
  152 + // 状态筛选
  153 + reseller(s) {
  154 + if (s == 2) return true;
  155 + },
  156 + rechange(s) {
  157 + if (s == 3) return true;
  158 + if (s == 4) return true;
  159 + if (s == 6) return true;
  160 + },
143 openshowBuyer(item) { 161 openshowBuyer(item) {
144 this.showBuyer = true 162 this.showBuyer = true
145 this.code = item.buyer_name 163 this.code = item.buyer_name
@@ -147,6 +165,79 @@ @@ -147,6 +165,79 @@
147 this.name = item.buyer_name 165 this.name = item.buyer_name
148 this.phone = item.buyer_mobile 166 this.phone = item.buyer_mobile
149 }, 167 },
  168 + // 查看证明
  169 + openshow(img) {
  170 + this.show = true
  171 + this.licenimg = img
  172 + console.log(this.licenimg)
  173 + },
  174 + //上传证明
  175 + openimag(id, imgindex) {
  176 + let that = this
  177 + that.imgid = id
  178 + that.imgindex = imgindex
  179 + uni.chooseImage({ // 从本地选择图片或使用相机拍照
  180 + success: (res) => {
  181 + count: 1, // 最多可以选择的图片张数,默认为9张
  182 + console.log(res)
  183 + const tempFilePaths = res.tempFilePaths; // 成功的返回图片的本地路径列表
  184 + uni.uploadFile({ // 直接上传文件到云储存
  185 + url: baseURL + '/common/upload', //仅为示例,非真实的接口地址
  186 + filePath: res.tempFilePaths[0], // 要上传文件的对象
  187 + name: 'file',
  188 + formData: {
  189 + token: uni.getStorageSync('token')
  190 + },
  191 + success: (uploadFileRes) => {
  192 + let data = JSON.parse(uploadFileRes.data);
  193 + console.log(data);
  194 + that.licenimg = data.data.fullurl; // 绝对路径
  195 + console.log(that.licenimg)
  196 + that.order_license()
  197 + }
  198 + });
  199 + }
  200 + })
  201 + return;
  202 + },
  203 + // 卖家上传证明
  204 + async order_license() {
  205 + let obj = {
  206 + order_id: this.imgid,
  207 + license: this.licenimg
  208 + }
  209 + try {
  210 + const res = await order_license(obj)
  211 + console.log('order_license', res)
  212 + this.list[this.imgindex].license_preview = this.licenimg
  213 + // 保存数据
  214 + } catch (err) {
  215 + uni.showToast({
  216 + title: err,
  217 + icon: 'none'
  218 + })
  219 + console.log('order_license', err)
  220 + }
  221 + },
  222 + //卖家发货
  223 + async order_send(id, idx) {
  224 + try {
  225 + const res = await order_send(id)
  226 + console.log('order_send', res)
  227 + if (this.typeindex == 0) {
  228 + this.list[idx].status = 3
  229 + } else {
  230 + this.list.splice(idx, 1)
  231 + }
  232 + // 保存数据
  233 + } catch (err) {
  234 + uni.showToast({
  235 + title: err,
  236 + icon: 'none'
  237 + })
  238 + console.log('order_send', err)
  239 + }
  240 + },
150 //复制 241 //复制
151 copy(it) { 242 copy(it) {
152 uni.setClipboardData({ 243 uni.setClipboardData({
1 -import {baseURL} from './request.js'  
2 -import {toast,toa} from './toast.js'  
3 -export const uploadFile = (tempFilePaths,data)=>{ 1 +import {
  2 + baseURL
  3 +} from './request.js'
  4 +import {
  5 + toast,
  6 + toa
  7 +} from './toast.js'
  8 +export const uploadFile = (tempFilePaths, data) => {
4 return new Promise((resolve, reject) => { 9 return new Promise((resolve, reject) => {
5 - toa.loading('上传中..')  
6 - uni.uploadFile({ 10 + toa.loading('上传中..')
  11 + uni.uploadFile({
7 url: baseURL + '/common/upload', //仅为示例,非真实的接口地址 12 url: baseURL + '/common/upload', //仅为示例,非真实的接口地址
8 filePath: tempFilePaths, 13 filePath: tempFilePaths,
9 name: 'file', 14 name: 'file',
10 - formData: {...data,token:uni.getStorageSync('token') || ''}, 15 + formData: {
  16 + ...data,
  17 + token: uni.getStorageSync('token') || ''
  18 + },
11 success: (res) => { 19 success: (res) => {
12 toa.hideLoading() 20 toa.hideLoading()
13 console.log(res); 21 console.log(res);
14 - if(res.statusCode==200){ 22 + if (res.statusCode == 200) {
15 // return res 23 // return res
16 resolve(JSON.parse(res.data).data) 24 resolve(JSON.parse(res.data).data)
17 } 25 }
18 }, 26 },
19 - fail:(err)=>{ 27 + fail: (err) => {
20 toa.hideLoading() 28 toa.hideLoading()
21 toast(JSON.parse(err.data).msg) 29 toast(JSON.parse(err.data).msg)
22 - console.log(err,'上传报错'); 30 + console.log(err, '上传报错');
23 // return 31 // return
24 reject(err) 32 reject(err)
25 } 33 }
26 }) 34 })
27 }) 35 })
28 -}  
  36 +}