Files

378 lines
12 KiB
Vue
Raw Normal View History

2020-03-15 13:59:43 +08:00
<template>
<view class="order-details pos-order-details">
<view class="header acea-row row-middle">
<view class="state">{{ title }}</view>
<view class="data">
<view class="order-num">订单{{ orderInfo.orderId }}</view>
<view>
<text class="time">
2020-04-06 17:18:09 +08:00
<data-format :date="orderInfo.addTime"></data-format>
</text>
</view>
</view>
</view>
<view class="orderingUser acea-row row-middle">{{ orderInfo.nickname }}</view>
<view class="address">
<view class="name">
2021-06-02 01:03:33 +08:00
{{ orderInfo.realName }}
<text class="phone">{{ orderInfo.userPhone }}</text>
</view>
<view>{{ orderInfo.userAddress }}</view>
</view>
<view class="line">
2021-04-10 15:42:46 +08:00
<image :src="`${$VUE_APP_RESOURCES_URL}/images/line.jpg`" />
</view>
<view class="pos-order-goods">
2021-06-02 01:03:33 +08:00
<view class="goods acea-row row-between-wrapper" v-for="(item, orderInfoIndex) in orderInfo.cartInfo" :key="orderInfoIndex">
<view class="picTxt acea-row row-between-wrapper">
<view class="pictrue">
<image :src="item.productInfo.image" />
</view>
<view class="text acea-row row-between row-column">
<view class="info line2">{{ item.productInfo.storeName }}</view>
2020-07-14 17:45:24 +08:00
<view class="attr">{{ item.productInfo.sku }}</view>
</view>
</view>
<view class="money">
<view class="x-money">{{ item.productInfo.price }}</view>
<view class="num">x{{ item.cartNum }}</view>
<view class="y-money">{{ item.productInfo.otPrice ? item.productInfo.otPrice : 0 }}</view>
</view>
</view>
</view>
<view class="public-total">
2020-03-15 13:59:43 +08:00
{{ orderInfo.totalNum }}件商品应支付
<text class="money">{{ orderInfo.payPrice }}</text>
2021-06-02 01:03:33 +08:00
( 邮费 ¥{{ orderInfo.payPostage }})
</view>
<view class="wrapper">
<view class="item acea-row row-between">
<view>订单编号</view>
<view class="conter acea-row row-middle row-right">
2021-06-02 01:03:33 +08:00
{{ orderInfo.orderId }}
<!-- #ifndef H5 -->
<text class="copy copy-data" @click="copyClipboard(orderInfo.orderId)">复制</text>
<!-- #endif -->
</view>
</view>
<view class="item acea-row row-between">
<view>下单时间</view>
<!-- <view class="conter"> -->
2021-06-02 01:03:33 +08:00
<view class="conter">{{ orderInfo.createTime }}</view>
<!-- <data-format :date="orderInfo.addTime"></data-format> -->
<!-- </view> -->
</view>
<view class="item acea-row row-between">
<view>支付状态</view>
2021-06-02 01:03:33 +08:00
<view class="conter">{{ orderInfo.paid == 1 ? '已支付' : '未支付' }}</view>
</view>
<view class="item acea-row row-between">
<view>支付方式</view>
<view class="conter">{{ payType }}</view>
</view>
<view class="item acea-row row-between">
<view>买家留言</view>
<view class="conter">{{ orderInfo.mark }}</view>
</view>
</view>
<view class="wrapper">
<view class="item acea-row row-between">
<view>支付金额</view>
<view class="conter">{{ orderInfo.totalPrice }}</view>
</view>
<view class="item acea-row row-between">
<view>优惠券抵扣</view>
<view class="conter">-{{ orderInfo.couponPrice }}</view>
</view>
<view class="actualPay acea-row row-right">
2020-03-15 13:59:43 +08:00
实付款
<text class="money font-color-red">{{ orderInfo.payPrice }}</text>
</view>
</view>
2021-06-02 01:03:33 +08:00
<view class="wrapper" v-if="orderInfo.delivery_type != 'fictitious' && orderInfo._status._type === 2">
<view class="item acea-row row-between">
<view>配送方式</view>
<view class="conter" v-if="orderInfo.delivery_type === 'express'">快递</view>
<view class="conter" v-if="orderInfo.delivery_type === 'send'">送货</view>
</view>
<view class="item acea-row row-between">
<view v-if="orderInfo.delivery_type === 'express'">快递公司</view>
<view v-if="orderInfo.delivery_type === 'send'">送货人</view>
<view class="conter">{{ orderInfo.delivery_name }}</view>
</view>
<view class="item acea-row row-between">
<view v-if="orderInfo.delivery_type === 'express'">快递单号</view>
<view v-if="orderInfo.delivery_type === 'send'">送货人电话</view>
<view class="conter">
2021-06-02 01:03:33 +08:00
{{ orderInfo.delivery_id }}
<!-- #ifndef H5 -->
<text class="copy copy-data" @click="copyClipboard(orderInfo.delivery_id)">复制</text>
<!-- #endif -->
</view>
</view>
</view>
<view style="height:100rpx;"></view>
<view class="footer acea-row row-right row-middle">
<view class="more"></view>
<view class="bnt cancel" @click="modify(0)" v-if="types == 0">一键改价</view>
<view class="bnt cancel" @click="modify(0)" v-if="types == -1">立即退款</view>
2021-06-02 01:03:33 +08:00
<view class="bnt cancel" v-if="orderInfo.pay_type === 'offline' && orderInfo.paid === 0" @click="offlinePay">确认付款</view>
<view class="bnt delivery" v-if="title == '未发货' && types == 1" @click="goGoodsDeliver(orderInfo)">去发货</view>
<view class="bnt quick" v-if="title == '待核销' && types == 1" @click="storeCancellation(0)">快速核销</view>
<view class="bnt delivery" v-if="title == '待核销' && types == 1" @click="storeCancellation(1)">立即核销</view>
</view>
2021-06-02 01:03:33 +08:00
<PriceChange :change="change" :orderInfo="orderInfo" v-on:closechange="changeclose($event)" v-on:savePrice="savePrice" :status="status"></PriceChange>
</view>
2020-03-15 13:59:43 +08:00
</template>
<script>
2021-06-02 01:03:33 +08:00
import PriceChange from '@/components/PriceChange'
import DataFormat from '@/components/DataFormat'
import { getAdminOrderDetail, setAdminOrderPrice, setAdminOrderRemark, setOfflinePay, setOrderRefund } from '@/api/admin'
import { orderVerific } from '@/api/order'
import { required, num } from '@/utils/validate'
import { validatorDefaultCatch } from '@/utils/dialog'
import { copyClipboard } from '@/utils'
2020-03-15 13:59:43 +08:00
export default {
2021-06-02 01:03:33 +08:00
name: 'AdminOrder',
2020-03-15 13:59:43 +08:00
components: {
PriceChange,
2021-06-02 01:03:33 +08:00
DataFormat,
2020-03-15 13:59:43 +08:00
},
props: {},
data: function() {
return {
order: false,
change: false,
2021-06-02 01:03:33 +08:00
order_id: '',
2020-03-15 13:59:43 +08:00
orderInfo: {
2021-06-02 01:03:33 +08:00
_status: {},
2020-03-15 13:59:43 +08:00
},
2021-06-02 01:03:33 +08:00
status: '',
title: '',
payType: '',
types: '',
}
2020-03-15 13:59:43 +08:00
},
watch: {
2021-06-02 01:03:33 +08:00
'$yroute.query.oid': function(newVal) {
let that = this
2020-03-15 13:59:43 +08:00
if (newVal != undefined) {
2021-06-02 01:03:33 +08:00
that.order_id = newVal
that.getIndex()
2020-03-15 13:59:43 +08:00
}
2021-06-02 01:03:33 +08:00
},
2020-03-15 13:59:43 +08:00
},
2020-12-20 16:23:14 +08:00
onShow: function() {
2021-06-02 01:03:33 +08:00
this.order_id = this.$yroute.query.oid
this.getIndex()
2020-03-15 13:59:43 +08:00
},
methods: {
2020-03-16 01:40:52 +08:00
goGoodsDeliver(orderInfo) {
this.$yrouter.push({
2021-06-02 01:03:33 +08:00
path: '/pages/orderAdmin/GoodsDeliver/index',
query: { oid: orderInfo.orderId },
})
2020-03-16 01:40:52 +08:00
},
2020-03-15 13:59:43 +08:00
copyClipboard,
more: function() {
2021-06-02 01:03:33 +08:00
this.order = !this.order
2020-03-15 13:59:43 +08:00
},
modify: function(status) {
2021-06-02 01:03:33 +08:00
this.change = true
this.status = status
2020-03-15 13:59:43 +08:00
},
changeclose: function(msg) {
2021-06-02 01:03:33 +08:00
this.change = msg
2020-03-15 13:59:43 +08:00
},
getIndex: function() {
2021-06-02 01:03:33 +08:00
let that = this
2020-03-15 13:59:43 +08:00
getAdminOrderDetail(that.order_id).then(
res => {
2021-06-02 01:03:33 +08:00
that.orderInfo = res.data
that.types = res.data._status._type
that.title = res.data._status._title
that.payType = res.data._status._payType
2020-03-15 13:59:43 +08:00
},
err => {
2020-03-16 01:40:52 +08:00
uni.showToast({
2020-03-15 13:59:43 +08:00
title: res.msg,
2021-06-02 01:03:33 +08:00
icon: 'none',
duration: 2000,
})
2020-03-15 13:59:43 +08:00
}
2021-06-02 01:03:33 +08:00
)
2020-03-15 13:59:43 +08:00
},
async savePrice(opt) {
let that = this,
data = {},
price = opt.price,
remark = opt.remark,
2021-06-02 01:03:33 +08:00
refund_price = opt.refund_price.toString()
data.orderId = that.orderInfo.orderId
2020-03-15 13:59:43 +08:00
if (that.status == 0 && that.orderInfo.refundStatus === 0) {
try {
await this.$validator({
2021-06-02 01:03:33 +08:00
price: [required(required.message('金额')), num(num.message('金额'))],
}).validate({ price })
2020-03-15 13:59:43 +08:00
} catch (e) {
2021-06-02 01:03:33 +08:00
return validatorDefaultCatch(e)
2020-03-15 13:59:43 +08:00
}
2021-06-02 01:03:33 +08:00
data.price = price
2020-03-15 13:59:43 +08:00
setAdminOrderPrice(data).then(
function() {
2021-06-02 01:03:33 +08:00
that.change = false
2020-03-16 01:40:52 +08:00
uni.showToast({
2021-06-02 01:03:33 +08:00
title: '改价成功',
icon: 'success',
duration: 2000,
})
that.getIndex()
2020-03-15 13:59:43 +08:00
},
function() {
2021-06-02 01:03:33 +08:00
that.change = false
2020-03-16 01:40:52 +08:00
uni.showToast({
2021-06-02 01:03:33 +08:00
title: '改价失败',
icon: 'none',
duration: 2000,
})
2020-03-15 13:59:43 +08:00
}
2021-06-02 01:03:33 +08:00
)
2020-03-15 13:59:43 +08:00
} else if (that.status == 0 && that.orderInfo.refundStatus === 1) {
try {
await this.$validator({
2021-06-02 01:03:33 +08:00
refund_price: [required(required.message('金额')), num(num.message('金额'))],
}).validate({ refund_price })
2020-03-15 13:59:43 +08:00
} catch (e) {
2021-06-02 01:03:33 +08:00
return validatorDefaultCatch(e)
2020-03-15 13:59:43 +08:00
}
2021-06-02 01:03:33 +08:00
data.price = refund_price
data.type = opt.type
2020-03-15 13:59:43 +08:00
setOrderRefund(data).then(
res => {
2021-06-02 01:03:33 +08:00
that.change = false
2020-03-16 01:40:52 +08:00
uni.showToast({
2020-03-15 13:59:43 +08:00
title: res.msg,
2021-06-02 01:03:33 +08:00
icon: 'none',
duration: 2000,
})
that.getIndex()
2020-03-15 13:59:43 +08:00
},
err => {
2021-06-02 01:03:33 +08:00
that.change = false
2020-03-16 01:40:52 +08:00
uni.showToast({
2020-03-15 13:59:43 +08:00
title: res.msg,
2021-06-02 01:03:33 +08:00
icon: 'none',
duration: 2000,
})
that.getIndex()
2020-03-15 13:59:43 +08:00
}
2021-06-02 01:03:33 +08:00
)
2020-03-15 13:59:43 +08:00
} else {
try {
await this.$validator({
2021-06-02 01:03:33 +08:00
remark: [required(required.message('备注'))],
}).validate({ remark })
2020-03-15 13:59:43 +08:00
} catch (e) {
2021-06-02 01:03:33 +08:00
return validatorDefaultCatch(e)
2020-03-15 13:59:43 +08:00
}
2021-06-02 01:03:33 +08:00
data.remark = remark
2020-03-15 13:59:43 +08:00
setAdminOrderRemark(data).then(
res => {
2021-06-02 01:03:33 +08:00
that.change = false
2020-03-16 01:40:52 +08:00
uni.showToast({
2020-03-15 13:59:43 +08:00
title: res.msg,
2021-06-02 01:03:33 +08:00
icon: 'none',
duration: 2000,
})
that.getIndex()
2020-03-15 13:59:43 +08:00
},
err => {
2021-06-02 01:03:33 +08:00
that.change = false
2020-03-16 01:40:52 +08:00
uni.showToast({
2020-03-15 13:59:43 +08:00
title: res.msg,
2021-06-02 01:03:33 +08:00
icon: 'none',
duration: 2000,
})
2020-03-15 13:59:43 +08:00
}
2021-06-02 01:03:33 +08:00
)
2020-03-15 13:59:43 +08:00
}
},
offlinePay: function() {
setOfflinePay({ order_id: this.orderInfo.order_id }).then(
res => {
2020-03-16 01:40:52 +08:00
uni.showToast({
2020-03-15 13:59:43 +08:00
title: res.msg,
2021-06-02 01:03:33 +08:00
icon: 'none',
duration: 2000,
})
this.getIndex()
2020-03-15 13:59:43 +08:00
},
err => {
2020-03-16 01:40:52 +08:00
uni.showToast({
2020-03-15 13:59:43 +08:00
title: err.msg,
2021-06-02 01:03:33 +08:00
icon: 'none',
duration: 2000,
})
2020-03-15 13:59:43 +08:00
}
2021-06-02 01:03:33 +08:00
)
2020-12-20 16:23:14 +08:00
},
storeCancellation(index) {
2021-06-02 01:03:33 +08:00
const that = this
that.check = true
2020-12-20 16:23:14 +08:00
if (index == 0) {
uni.showModal({
2021-06-02 01:03:33 +08:00
title: '确定核销订单?',
content: '注意:请务必核对核销码的与客户正确性',
2020-12-20 16:23:14 +08:00
success(res) {
if (res.confirm) {
uni.showLoading({
2021-06-02 01:03:33 +08:00
title: '查询中',
})
2020-12-20 16:23:14 +08:00
orderVerific(that.orderInfo.verifyCode, 1)
2021-06-02 01:03:33 +08:00
.then(res => {
console.log(res)
uni.hideLoading()
that.iShidden = false
uni.showToast({
title: res.msg,
icon: 'none',
duration: 1000,
2020-12-20 16:23:14 +08:00
})
2021-06-02 01:03:33 +08:00
//最后就是返回上一个页面。
setTimeout(function() {
uni.navigateBack({
delta: 1, // 返回上一级页面。
success: function() {
console.log('成功!')
},
})
}, 1000)
})
.catch(err => {
console.log(err)
uni.hideLoading()
uni.showToast({
title: err.data.msg,
icon: 'none',
duration: 2000,
})
})
2020-12-20 16:23:14 +08:00
}
2021-06-02 01:03:33 +08:00
},
})
2020-12-20 16:23:14 +08:00
} else {
that.$yrouter.push({
2021-06-02 01:03:33 +08:00
path: '/pages/orderAdmin/OrderCancellation/index',
2020-12-20 16:23:14 +08:00
})
}
2021-06-02 01:03:33 +08:00
},
},
}
2020-03-15 13:59:43 +08:00
</script>
2020-12-20 16:23:14 +08:00
<style lang="less">
.quick {
2021-06-02 01:03:33 +08:00
background: #f25555;
2020-12-20 16:23:14 +08:00
}
</style>