|
@@ -36,14 +36,17 @@
|
|
|
<text class="goods-number">x{{item.buyNum}}</text>
|
|
|
<text class="plant-text" v-if="item.productType == 4">有效期:{{item.term}}天</text>
|
|
|
</view>
|
|
|
+ <view class="goods-editnumber">
|
|
|
+ <CnumberBox v-if="item.productType == 3 && isEdit" isDisabled @getNum="getStockNum($event,index)" minNum="1"></CnumberBox>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="order-info">
|
|
|
<u-cell-group :border="false">
|
|
|
<u-cell-item title="商品金额" :value="'¥' + orderData.orderSum" :arrow="false" :border-bottom="false"></u-cell-item>
|
|
|
- <u-cell-item title="积分抵扣" :value="'-¥' + orderData.integralAmount" :arrow="false" :border-bottom="false" v-if="goodType == 1"></u-cell-item>
|
|
|
- <u-cell-item title="优惠券" :value="'-¥' + orderData.couponDiscountAmount" :arrow="false" :border-bottom="false" v-if="goodType == 1"></u-cell-item>
|
|
|
+ <u-cell-item title="积分抵扣" :value="'-¥' + orderData.integralAmount" :arrow="false" :border-bottom="false" v-if="goodType == 1 || goodType == 3"></u-cell-item>
|
|
|
+ <u-cell-item title="优惠券" :value="'-¥' + orderData.couponDiscountAmount" :arrow="false" :border-bottom="false" v-if="goodType == 1 || goodType == 3"></u-cell-item>
|
|
|
<u-cell-item title="备注" :value="orderData.notes" :arrow="false" :border-bottom="false"></u-cell-item>
|
|
|
</u-cell-group>
|
|
|
</view>
|
|
@@ -113,7 +116,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<uni-goods-nav :fill="true" :options="[]" @click="" @buttonClick="orderHandle" class="order-handle" :buttonGroup="buttonGroup"
|
|
|
- v-if="(orderData.orderStatus >= 2 && orderData.orderStatus <= 4) || (orderData.orderStatus == 5 && orderData.evaluateReplyStatus == 1)" />
|
|
|
+ v-if="(orderData.orderStatus >= 1 && orderData.orderStatus <= 4) || (orderData.orderStatus == 5 && orderData.evaluateReplyStatus == 1)" />
|
|
|
<u-top-tips ref="uTips"></u-top-tips>
|
|
|
<view class="uni-popup-dialog" :hidden="show_qx">
|
|
|
<view class="uni-dialog-title">
|
|
@@ -137,7 +140,11 @@
|
|
|
<script>
|
|
|
const NET = require('@/utils/request')
|
|
|
const API = require('@/config/api')
|
|
|
+ import CnumberBox from '@/components/CnumberBox.vue'
|
|
|
export default {
|
|
|
+ components: {
|
|
|
+ CnumberBox
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
show_qx:true,
|
|
@@ -170,12 +177,7 @@
|
|
|
tenantCode: '',
|
|
|
evaluateReplyStatus: 1,
|
|
|
},
|
|
|
- goodType: 1,
|
|
|
- // buttonGroup: [{
|
|
|
- // text: '',
|
|
|
- // backgroundColor: '#52A63A',
|
|
|
- // color: '#fff'
|
|
|
- // }],
|
|
|
+ goodType: 1, // 1是普通商品类型;2是包含自助采摘+普通商品的类型;3是拍卖、共享种植
|
|
|
buttonGroup: [
|
|
|
{
|
|
|
text: '',
|
|
@@ -183,78 +185,114 @@
|
|
|
color: '#fff'
|
|
|
}
|
|
|
],
|
|
|
- noPick: true // 没有自助采摘的商品
|
|
|
+ noPick: true, // 没有自助采摘的商品
|
|
|
+ isEdit: false,
|
|
|
+ orderId: '',
|
|
|
+ orderStatus: 1,
|
|
|
+ isClick: false
|
|
|
}
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
this.userData = uni.getStorageSync("userData")
|
|
|
- NET.request(API.getOrderDetail, {
|
|
|
- flag: 2,
|
|
|
- orderId: options.orderId,
|
|
|
- orderStatus: options.orderStatus,
|
|
|
- }, 'GET').then(res => {
|
|
|
- this.orderData = res.data
|
|
|
- if (this.orderData.addOrderTime) {
|
|
|
- let tempTime = new Date(this.orderData.addOrderTime).getTime()
|
|
|
- let addTempTime = new Date(tempTime + 1000 * 60 * 60 * 24)
|
|
|
- let addYear = addTempTime.getFullYear()
|
|
|
- let addMonth = addTempTime.getMonth() + 1
|
|
|
- let addDay = addTempTime.getDate()
|
|
|
- let addHours = addTempTime.getHours()
|
|
|
- let addMin = addTempTime.getMinutes()
|
|
|
- let addSeconds = addTempTime.getSeconds()
|
|
|
- this.orderData.overTime = addYear + '年' + addMonth + '月' + addDay + '日' + addHours + ':' + addMin + ':' +
|
|
|
- addSeconds
|
|
|
- }
|
|
|
- if (this.orderData.merchantInfoResVO.products.length && this.orderData.merchantInfoResVO.products[0].productType !=
|
|
|
- 2 && this.orderData.merchantInfoResVO.products[0].productType != 4) {
|
|
|
- this.goodType = 1
|
|
|
- } else {
|
|
|
- this.goodType = 2
|
|
|
- }
|
|
|
- if (this.orderData.orderStatus == 2) {
|
|
|
- if (this.orderData.merchantInfoResVO.products.length) {
|
|
|
+ this.orderId = options.orderId
|
|
|
+ this.orderStatus = options.orderStatus
|
|
|
+ this.getDetail()
|
|
|
+ },
|
|
|
+ onShow() {},
|
|
|
+ methods: {
|
|
|
+ closeSetting:function(){
|
|
|
+ this.show_qx=true;
|
|
|
+ },
|
|
|
+ // 获取订单详情
|
|
|
+ getDetail() {
|
|
|
+ NET.request(API.getOrderDetail, {
|
|
|
+ flag: 2,
|
|
|
+ orderId: this.orderId,
|
|
|
+ orderStatus: this.orderStatus,
|
|
|
+ }, 'GET').then(res => {
|
|
|
+ this.orderData = res.data
|
|
|
+ if (this.orderData.addOrderTime) {
|
|
|
+ let tempTime = new Date(this.orderData.addOrderTime).getTime()
|
|
|
+ let addTempTime = new Date(tempTime + 1000 * 60 * 60 * 24)
|
|
|
+ let addYear = addTempTime.getFullYear()
|
|
|
+ let addMonth = addTempTime.getMonth() + 1
|
|
|
+ let addDay = addTempTime.getDate()
|
|
|
+ let addHours = addTempTime.getHours()
|
|
|
+ let addMin = addTempTime.getMinutes()
|
|
|
+ let addSeconds = addTempTime.getSeconds()
|
|
|
+ this.orderData.overTime = addYear + '年' + addMonth + '月' + addDay + '日' + addHours + ':' + addMin + ':' +
|
|
|
+ addSeconds
|
|
|
+ }
|
|
|
+ if (this.orderData.merchantInfoResVO.products.length && this.orderData.merchantInfoResVO.products[0].productType !=
|
|
|
+ 2 && this.orderData.merchantInfoResVO.products[0].productType != 4) {
|
|
|
+ // this.goodType = 1
|
|
|
if (this.orderData.merchantInfoResVO.products.some(v => {return v.productType == 3})) {
|
|
|
- this.noPick = false
|
|
|
- this.buttonGroup = [{
|
|
|
- text: '发货',
|
|
|
- backgroundColor: '#75BD60',
|
|
|
- color: '#fff'
|
|
|
- }, {
|
|
|
- text: '自助采摘',
|
|
|
- backgroundColor: '#52A63A',
|
|
|
- color: '#fff'
|
|
|
- }]
|
|
|
+ this.goodType = 3
|
|
|
} else {
|
|
|
- this.buttonGroup = [{
|
|
|
- text: '发货',
|
|
|
- backgroundColor: '#75BD60',
|
|
|
- color: '#fff'
|
|
|
- }]
|
|
|
+ this.goodType = 1
|
|
|
}
|
|
|
+ } else {
|
|
|
+ this.goodType = 2
|
|
|
}
|
|
|
- if (this.orderData.auctionStatus == 1) {
|
|
|
+ if (this.orderData.orderStatus == 1 && this.goodType == 3) {
|
|
|
+ this.buttonGroup = [{
|
|
|
+ text: '修改订单',
|
|
|
+ backgroundColor: '#75BD60',
|
|
|
+ color: '#fff'
|
|
|
+ }]
|
|
|
+ } else if (this.orderData.orderStatus == 2) {
|
|
|
+ if (this.orderData.merchantInfoResVO.products.length) {
|
|
|
+ if (this.orderData.merchantInfoResVO.products.some(v => {return v.productType == 3})) {
|
|
|
+ this.noPick = false
|
|
|
+ this.buttonGroup = [{
|
|
|
+ text: '发货',
|
|
|
+ backgroundColor: '#75BD60',
|
|
|
+ color: '#fff'
|
|
|
+ }, {
|
|
|
+ text: '自助采摘',
|
|
|
+ backgroundColor: '#52A63A',
|
|
|
+ color: '#fff'
|
|
|
+ }]
|
|
|
+ } else {
|
|
|
+ this.buttonGroup = [{
|
|
|
+ text: '发货',
|
|
|
+ backgroundColor: '#75BD60',
|
|
|
+ color: '#fff'
|
|
|
+ }]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (this.orderData.auctionStatus == 1) {
|
|
|
+ this.buttonGroup = []
|
|
|
+ }
|
|
|
+ } else if (this.orderData.orderStatus == 3 || this.orderData.orderStatus == 4) {
|
|
|
+ this.buttonGroup[0].text = '追踪物流'
|
|
|
+ } else if (this.orderData.evaluateReplyStatus == 1) {
|
|
|
+ this.buttonGroup[0].text = '回复'
|
|
|
+ } else {
|
|
|
this.buttonGroup = []
|
|
|
}
|
|
|
- } else if (this.orderData.orderStatus == 3 || this.orderData.orderStatus == 4) {
|
|
|
- this.buttonGroup[0].text = '追踪物流'
|
|
|
- } else if (this.orderData.evaluateReplyStatus == 1) {
|
|
|
- this.buttonGroup[0].text = '回复'
|
|
|
- } else {
|
|
|
- this.buttonGroup = []
|
|
|
- }
|
|
|
- this.getOrderType()
|
|
|
- }).catch(error => {
|
|
|
- this.$refs.uTips.show({
|
|
|
- title: error.data.msg,
|
|
|
- type: 'warning',
|
|
|
+ this.getOrderType()
|
|
|
+ }).catch(error => {
|
|
|
+ this.$refs.uTips.show({
|
|
|
+ title: error.data.msg,
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
})
|
|
|
- })
|
|
|
- },
|
|
|
- onShow() {},
|
|
|
- methods: {
|
|
|
- closeSetting:function(){
|
|
|
- this.show_qx=true;
|
|
|
+ },
|
|
|
+ // 获取子组件的库存数量/
|
|
|
+ getStockNum(num,index) {
|
|
|
+ this.isClick = true
|
|
|
+ debugger
|
|
|
+ this.orderData.merchantInfoResVO.products[index].buyNum = num
|
|
|
+ this.getEditSum()
|
|
|
+ },
|
|
|
+ // 计算实付额和订单总额
|
|
|
+ getEditSum() {
|
|
|
+ let price = this.orderData.merchantInfoResVO.products.reduce((total, site) => {
|
|
|
+ return total + site.bizPrice * site.buyNum
|
|
|
+ }, 0)
|
|
|
+ this.orderData.orderSum = price.toFixed(2)
|
|
|
+ this.orderData.paySum = (price - this.orderData.discountAmount).toFixed(2)
|
|
|
},
|
|
|
// 获取订单类型
|
|
|
getOrderType() {
|
|
@@ -298,7 +336,41 @@
|
|
|
},
|
|
|
// 操作
|
|
|
orderHandle(e) {
|
|
|
- if (this.orderData.orderStatus == 2) {
|
|
|
+ if (this.orderData.orderStatus == 1) {
|
|
|
+ this.buttonGroup = [{
|
|
|
+ text: this.isEdit ? '修改订单' : '提交订单',
|
|
|
+ backgroundColor: this.isEdit ? '#52A63A' : '#75BD60',
|
|
|
+ color: '#fff'
|
|
|
+ }]
|
|
|
+ if (this.isEdit) {
|
|
|
+ if (!this.isClick) {
|
|
|
+ this.orderData.merchantInfoResVO.products.forEach(v => {
|
|
|
+ if (v.productType == 3) {
|
|
|
+ v.buyNum = 1
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.getEditSum()
|
|
|
+ }
|
|
|
+ NET.request(API.editOrder, {
|
|
|
+ orderId: this.orderData.orderId,
|
|
|
+ orderSum: this.orderData.orderSum,
|
|
|
+ paySum: this.orderData.paySum,
|
|
|
+ products: this.orderData.merchantInfoResVO.products
|
|
|
+ }, 'POST').then(res => {
|
|
|
+ this.$refs.uTips.show({
|
|
|
+ title: '修改成功',
|
|
|
+ type: 'success',
|
|
|
+ })
|
|
|
+ this.getDetail()
|
|
|
+ }).catch(error => {
|
|
|
+ this.$refs.uTips.show({
|
|
|
+ title: error.data.msg,
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.isEdit = !this.isEdit
|
|
|
+ } else if (this.orderData.orderStatus == 2) {
|
|
|
if (e.index == 0) {
|
|
|
// 发货
|
|
|
uni.navigateTo({
|
|
@@ -522,7 +594,7 @@
|
|
|
|
|
|
.goods-row {
|
|
|
width: 100%;
|
|
|
- height: 90px;
|
|
|
+ height: 110px;
|
|
|
float: left;
|
|
|
display: flex;
|
|
|
margin-bottom: 10px;
|
|
@@ -578,10 +650,10 @@
|
|
|
}
|
|
|
|
|
|
.goods-price-number {
|
|
|
- width: 100%;
|
|
|
+ width: 60%;
|
|
|
height: 20px;
|
|
|
float: left;
|
|
|
- line-height: 20px;
|
|
|
+ line-height: 40px;
|
|
|
font-family: PingFang SC;
|
|
|
color: #333333;
|
|
|
|
|
@@ -598,6 +670,11 @@
|
|
|
font-size: 12px;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ .goods-editnumber {
|
|
|
+ float: left;
|
|
|
+ width: 35%
|
|
|
+ }
|
|
|
|
|
|
.plant-text {
|
|
|
float: right;
|