Browse Source

订单流传

devlop
邓雄飞 4 years ago
parent
commit
7834d09a29
5 changed files with 165 additions and 85 deletions
  1. 3
      apis/commonApi.js
  2. 24
      apis/orderApi.js
  3. 15
      enums/index.js
  4. 38
      pages.json
  5. 170
      pages/order-detail/index.vue

3
apis/commonApi.js

@ -76,12 +76,13 @@ export function getVerifyUrl(data = {}) {
export function getGuaranteeContract(data = {}) { export function getGuaranteeContract(data = {}) {
return http.post({ url: '/yyt-uec/create/supplier/guarantee-contract?mallSupplierId=' + data.mallSupplierId, data }) return http.post({ url: '/yyt-uec/create/supplier/guarantee-contract?mallSupplierId=' + data.mallSupplierId, data })
} }
/** /**
* 转换合同成图片 * 转换合同成图片
* @param {object} data 图片地址链接 fileUrl * @param {object} data 图片地址链接 fileUrl
*/ */
export function transformFileToImg(data) { export function transformFileToImg(data) {
http.get({
return http.get({
url: '/document/get/enterprise-documents/file-image-base64', url: '/document/get/enterprise-documents/file-image-base64',
data: data data: data
}) })

24
apis/orderApi.js

@ -83,3 +83,27 @@ export function supplierDelivery(data) {
data data
}) })
} }
/**
* 供应商删除送货凭证
* @param {object} data id
* @returns {Promise<Object>}
*/
export function supplierDeleteVoucher(data) {
return http.post({
url: '/base-paper-trading/delete/certificate/img?id=' + data.id,
data
})
}
/**
* 供应商确认月结订单还款
* @param {object} data supplierOrderId
* @returns {Promise<Object>}
*/
export function supplierConfirmRepay(data) {
return http.post({
url: '/base-paper-trading/supplier/submit/reimbursement',
data
})
}

15
enums/index.js

@ -142,3 +142,18 @@ export const supplierOrderStatusMap = {
[supplierOrderStatusEnum.REPAYING]: '还款中', [supplierOrderStatusEnum.REPAYING]: '还款中',
[supplierOrderStatusEnum.CANCELED]: '已取消' [supplierOrderStatusEnum.CANCELED]: '已取消'
} }
/**
* 支付方式 1:微信支付 2:月结支付 4:飞算支付
*/
export const paymentMethodEnum = {
WECHAT_PAY: 1,
MONTHLY_PAY: 2,
FLY_PAY: 4
}
export const paymentMethodMap = {
[paymentMethodEnum.WECHAT_PAY]: '微信支付',
[paymentMethodEnum.MONTHLY_PAY]: '月结支付',
[paymentMethodEnum.FLY_PAY]: '飞算支付'
}

38
pages.json

@ -257,28 +257,24 @@
"navigationStyle": "custom", "navigationStyle": "custom",
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
},
{
"path": "pages/user-info/index",
"style": {
"navigationBarTitleText": "用户名",
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
},
{
"path": "pages/about/index",
"style": {
"navigationBarTitleText": "关于",
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
} }
,{
"path" : "pages/user-info/index",
"style" :
{
"navigationBarTitleText": "用户名",
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/about/index",
"style" :
{
"navigationBarTitleText": "关于",
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
}
],
],
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app", "navigationBarTitleText": "uni-app",

170
pages/order-detail/index.vue

@ -73,7 +73,7 @@
</view> </view>
</view> </view>
<!-- 送货凭证 --> <!-- 送货凭证 -->
<view v-if="showSendImgs(orderInfo.status)" class="footer">
<view v-if="showSendImgs(orderInfo.status)" class="footer" :style="showList.includes(`send`) ? '' : 'height:88rpx;'">
<view class="header flex-row-center-space"> <view class="header flex-row-center-space">
<text style="font-size: 28rpx; font-weight: 600">送货凭证</text> <text style="font-size: 28rpx; font-weight: 600">送货凭证</text>
<view class="flex-row-center-end" @click="changeShowIndex('send')"> <view class="flex-row-center-end" @click="changeShowIndex('send')">
@ -82,24 +82,14 @@
</view> </view>
</view> </view>
<view class="imgs flex-row-start-start"> <view class="imgs flex-row-start-start">
<view v-for="item in orderInfo.proofDelivery" :key="item.id" class="upload_img">
<uni-icons type="clear" size="16" class="close-icon" @click="deleteVoucher(item.id)"></uni-icons>
<image style="width: 120rpx; height: 120rpx" :src="item.imgUrl"></image>
</view>
<view class="default-upload" @click="uploadVoucher()"> <view class="default-upload" @click="uploadVoucher()">
<image src="/static/imgs/order/camera.png" class="icon"></image> <image src="/static/imgs/order/camera.png" class="icon"></image>
<text style="font-size: 26rpx; color: #4c4a58">上传凭证</text> <text style="font-size: 26rpx; color: #4c4a58">上传凭证</text>
</view> </view>
<image style="width: 120rpx; height: 120rpx; margin-right: 12rpx" src=""></image>
</view>
</view>
<!-- 收货凭证 -->
<view v-if="showReceiveImgs(orderInfo.status)" class="footer">
<view class="header flex-row-center-space">
<text style="font-size: 28rpx; font-weight: 600">送货凭证</text>
<view class="flex-row-center-end" @click="changeShowIndex(`receive`)">
<text style="font-size: 28rpx; margin-right: 8rpx">{{ showList.includes(`receive`) ? '收起' : '展开' }}</text>
<uni-icons :type="showList.includes(`receive`) ? 'top' : 'bottom'" size="16"></uni-icons>
</view>
</view>
<view class="imgs flex-row-start-start">
<image style="width: 120rpx; height: 120rpx; margin-right: 12rpx" src=""></image>
</view> </view>
</view> </view>
<view class="fee flex-row-center-space"> <view class="fee flex-row-center-space">
@ -125,6 +115,10 @@
<text class="label">下单时间</text> <text class="label">下单时间</text>
<text class="value">{{ orderInfo.createTime }}</text> <text class="value">{{ orderInfo.createTime }}</text>
</view> </view>
<view class="flex-row-center-space order-line">
<text class="label">供应商</text>
<text class="value">{{ orderInfo.supplierEnterpriseName }}</text>
</view>
</view> </view>
<qn-footer fixed height="120rpx" v-if="orderInfo.status === supplierOrderStatusEnum.WAIT_SUPPLIER_CONFIRM"> <qn-footer fixed height="120rpx" v-if="orderInfo.status === supplierOrderStatusEnum.WAIT_SUPPLIER_CONFIRM">
<view class="flex-row-center-space" style="padding: 0 32rpx"> <view class="flex-row-center-space" style="padding: 0 32rpx">
@ -132,11 +126,23 @@
<view class="button button_confirm" @click="confirm(orderInfo)">确认订单</view> <view class="button button_confirm" @click="confirm(orderInfo)">确认订单</view>
</view> </view>
</qn-footer> </qn-footer>
<qn-footer fixed height="120rpx" v-if="orderInfo.status === supplierOrderStatusEnum.WAIT_DELIVERY">
<view class="flex-row-center-space" style="padding: 0 32rpx">
<view class="button button_cancel" style="width: 220rpx" @click="cancel">取消订单</view>
<qn-footer fixed height="120rpx" v-if="showSendImgs(orderInfo.status)">
<view class="flex-row-center-end" style="padding: 0 32rpx">
<view class="button button_cancel" v-show="orderInfo.status === supplierOrderStatusEnum.WAIT_DELIVERY" style="width: 220rpx" @click="cancel">
取消订单
</view>
<view class="button button_contact" @click="viewContract">查看合同</view> <view class="button button_contact" @click="viewContract">查看合同</view>
<view class="button button_confirm" @click="delivery" style="width: 220rpx">确认发货</view>
<view class="button button_confirm" v-show="orderInfo.status === supplierOrderStatusEnum.WAIT_DELIVERY" @click="delivery" style="width: 220rpx">
确认发货
</view>
<view
class="button button_confirm"
v-show="orderInfo.paymentMethod === paymentMethodEnum.MONTHLY_PAY && orderInfo.status === supplierOrderStatusEnum.WAIT_CLIENT_REPAY"
@click="confirmRepay"
style="width: 220rpx"
>
确认还款
</view>
</view> </view>
</qn-footer> </qn-footer>
</view> </view>
@ -150,9 +156,11 @@ import {
confirmSupplierOrder, confirmSupplierOrder,
supplierOperatePaper, supplierOperatePaper,
supplierUploadVoucher, supplierUploadVoucher,
supplierDelivery
supplierDelivery,
supplierDeleteVoucher,
supplierConfirmRepay
} from '@/apis/orderApi.js' } from '@/apis/orderApi.js'
import { supplierOrderStatusMap, supplierOrderStatusEnum } from '@/enums/index.js'
import { supplierOrderStatusMap, supplierOrderStatusEnum, paymentMethodEnum } from '@/enums/index.js'
import { transformFileToImg } from '@/apis/commonApi.js' import { transformFileToImg } from '@/apis/commonApi.js'
export default { export default {
data() { data() {
@ -163,7 +171,8 @@ export default {
}, },
supplierOrderStatusMap: Object.freeze(supplierOrderStatusMap), supplierOrderStatusMap: Object.freeze(supplierOrderStatusMap),
supplierOrderStatusEnum: Object.freeze(supplierOrderStatusEnum), supplierOrderStatusEnum: Object.freeze(supplierOrderStatusEnum),
showList: [],
paymentMethodEnum: Object.freeze(paymentMethodEnum),
showList: ['send', 'receive'],
steps: [] steps: []
} }
}, },
@ -284,20 +293,6 @@ export default {
] ]
return list.includes(status) return list.includes(status)
}, },
//
showReceiveImgs(status) {
let list = [
supplierOrderStatusEnum.WAIT_CLIENT_LOAN,
supplierOrderStatusEnum.PAYING,
supplierOrderStatusEnum.WAIT_CLIENT_PAY,
supplierOrderStatusEnum.PAY_FAIL,
supplierOrderStatusEnum.FINISHED,
supplierOrderStatusEnum.WAIT_CLIENT_REPAY,
supplierOrderStatusEnum.REPAYING,
supplierOrderStatusEnum.CANCELED
]
return list.includes(status)
},
// //
cancel(order) { cancel(order) {
uni.showModal({ uni.showModal({
@ -343,15 +338,6 @@ export default {
window ? (window.location.href = res.signUrl) : '' window ? (window.location.href = res.signUrl) : ''
// #endif // #endif
} }
// uni.showToast({
// title: '',
// icon: 'success',
// success: () => {
// setTimeout(() => {
// this.init(order.orderId)
// }, 1000)
// }
// })
} }
}) })
} }
@ -389,25 +375,21 @@ export default {
uploadImage(['album'], 5) uploadImage(['album'], 5)
.then((urls) => { .then((urls) => {
if (urls) { if (urls) {
let promiseList = []
urls.forEach((url) => {
promiseList.push(
supplierUploadVoucher({
supplierOrderId: this.orderInfo.orderId,
proofDeliveryUrl: url
supplierUploadVoucher({
supplierOrderId: this.orderInfo.orderId,
proofDeliveryUrl: urls
}).then((res) => {
if (res) {
uni.showToast({
title: '上传成功',
icon: 'success',
success: () => {
setTimeout(() => {
this.init(this.orderInfo.orderId)
}, 1000)
}
}) })
)
})
Promise.all(promiseList).then(() => {
uni.showToast({
title: '上传成功',
icon: 'success',
success: () => {
setTimeout(() => {
this.init(this.orderInfo.orderId)
}, 1000)
}
})
}
}) })
} }
}) })
@ -453,6 +435,49 @@ export default {
}) })
} }
}, },
//
deleteVoucher(id) {
supplierDeleteVoucher({ id }).then((res) => {
if (res) {
uni.showToast({
title: '删除成功',
icon: 'success',
success: () => {
setTimeout(() => {
this.init(this.orderInfo.orderId)
}, 1000)
}
})
}
})
},
//
confirmRepay() {
uni.showModal({
title: '提示',
content: '确定确认还款吗?',
success: (res) => {
if (res.confirm) {
supplierConfirmRepay({
supplierOrderId: this.orderInfo.orderId
}).then((res) => {
if (res) {
uni.showToast({
title: '确认还款成功',
icon: 'success',
success: () => {
setTimeout(() => {
this.init(this.orderInfo.orderId)
}, 1000)
}
})
}
})
}
}
})
},
//
clip(content) { clip(content) {
uni.setClipboardData({ uni.setClipboardData({
data: content, data: content,
@ -590,4 +615,23 @@ export default {
margin-bottom: 8rpx; margin-bottom: 8rpx;
} }
} }
.upload_img {
width: 120rpx;
height: 120rpx;
border-radius: 10rpx;
background-color: #dcdee0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
position: relative;
margin-right: 12rpx;
overflow: hidden;
.close-icon {
position: absolute;
top: 0;
right: 0;
z-index: 5;
}
}
</style> </style>
Loading…
Cancel
Save