parent
2aef6a4fe5
commit
00ed94c762
|
|
@ -32,6 +32,14 @@ export function getOrderPage(data) {
|
||||||
return request.get("app-api/trade/order/page", data);
|
return request.get("app-api/trade/order/page", data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function cancelOrder(id) {
|
||||||
|
return request.delete("app-api/trade/order/cancel?id=" + id, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deleteOrder(id) {
|
||||||
|
return request.delete("app-api/trade/order/delete?id=" + id, {});
|
||||||
|
}
|
||||||
|
|
||||||
export function getOrderItem(id) {
|
export function getOrderItem(id) {
|
||||||
return request.get("app-api/trade/order/item/get", {
|
return request.get("app-api/trade/order/item/get", {
|
||||||
id
|
id
|
||||||
|
|
|
||||||
|
|
@ -327,6 +327,7 @@
|
||||||
import { mapGetters } from "vuex";
|
import { mapGetters } from "vuex";
|
||||||
import dayjs from '@/plugin/dayjs/dayjs.min.js';
|
import dayjs from '@/plugin/dayjs/dayjs.min.js';
|
||||||
import * as Util from '@/utils/util.js';
|
import * as Util from '@/utils/util.js';
|
||||||
|
import {cancelOrder, deleteOrder} from "../../api/trade/order";
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
payment,
|
payment,
|
||||||
|
|
@ -429,6 +430,64 @@
|
||||||
}, '/pages/users/order_list/index');
|
}, '/pages/users/order_list/index');
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 打开支付组件
|
||||||
|
*/
|
||||||
|
goPay() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/goods/cashier/index?order_id=${this.orderInfo.payOrderId}&from_type=order`
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 取消订单
|
||||||
|
*/
|
||||||
|
cancelOrder() {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '确认取消该订单?',
|
||||||
|
success: res => {
|
||||||
|
if (res.confirm) {
|
||||||
|
OrderApi.cancelOrder(this.orderInfo.id).then(() => {
|
||||||
|
this.$util.Tips({
|
||||||
|
title: '取消成功'
|
||||||
|
})
|
||||||
|
this.getOrderInfo();
|
||||||
|
}).catch((err) => {
|
||||||
|
this.$util.Tips({
|
||||||
|
title: err
|
||||||
|
})
|
||||||
|
this.getOrderInfo();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 删除订单
|
||||||
|
*/
|
||||||
|
delOrder: function() {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '确认删除该订单?',
|
||||||
|
success: res => {
|
||||||
|
if (res.confirm) {
|
||||||
|
OrderApi.deleteOrder(this.orderInfo.id).then(() => {
|
||||||
|
this.$util.Tips({
|
||||||
|
title: '删除成功'
|
||||||
|
}, {
|
||||||
|
tab: 3,
|
||||||
|
url: '/pages/users/order_list/index'
|
||||||
|
})
|
||||||
|
}).catch((err) => {
|
||||||
|
this.$util.Tips({
|
||||||
|
title: err
|
||||||
|
})
|
||||||
|
this.getOrderInfo();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
// TODO 芋艿:未整理
|
// TODO 芋艿:未整理
|
||||||
|
|
||||||
|
|
@ -514,60 +573,6 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
* 打开支付组件
|
|
||||||
*/
|
|
||||||
goPay() {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pages/goods/cashier/index?order_id=${this.orderInfo.payOrderId}&from_type=order`
|
|
||||||
})
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 删除订单
|
|
||||||
*/
|
|
||||||
delOrder: function() {
|
|
||||||
let that = this;
|
|
||||||
orderDel(this.id).then(res => {
|
|
||||||
return that.$util.Tips({
|
|
||||||
title: '删除成功',
|
|
||||||
icon: 'success'
|
|
||||||
}, {
|
|
||||||
tab: 3,
|
|
||||||
url: 1
|
|
||||||
});
|
|
||||||
}).catch(err => {
|
|
||||||
return that.$util.Tips({
|
|
||||||
title: err
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
cancelOrder() {
|
|
||||||
let self = this
|
|
||||||
uni.showModal({
|
|
||||||
title: '提示',
|
|
||||||
content: '确认取消该订单?',
|
|
||||||
success: function(res) {
|
|
||||||
if (res.confirm) {
|
|
||||||
orderCancel(self.orderInfo.id)
|
|
||||||
.then((data) => {
|
|
||||||
self.$util.Tips({
|
|
||||||
title: '取消成功'
|
|
||||||
}, {
|
|
||||||
tab: 3
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
self.$util.Tips({
|
|
||||||
title: err
|
|
||||||
})
|
|
||||||
self.getDetail();
|
|
||||||
});
|
|
||||||
} else if (res.cancel) {
|
|
||||||
console.log('用户点击取消');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
// ========== 非关键逻辑 ==========
|
// ========== 非关键逻辑 ==========
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,6 @@
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { orderCancel, orderDel } from '@/api/order.js';
|
|
||||||
import { openOrderSubscribe } from '@/utils/SubscribeMessage.js';
|
import { openOrderSubscribe } from '@/utils/SubscribeMessage.js';
|
||||||
import home from '@/components/home';
|
import home from '@/components/home';
|
||||||
import payment from '@/components/payment';
|
import payment from '@/components/payment';
|
||||||
|
|
@ -251,52 +250,56 @@
|
||||||
// #endif
|
// #endif
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 取消订单 TODO 芋艿:未实现;
|
* 取消订单
|
||||||
*/
|
*/
|
||||||
cancelOrder: function(index, order_id) {
|
cancelOrder: function(index, order_id) {
|
||||||
if (!order_id) {
|
uni.showModal({
|
||||||
return this.$util.Tips({
|
title: '提示',
|
||||||
title: '缺少订单号无法取消订单'
|
content: '确认取消该订单?',
|
||||||
});
|
success: res => {
|
||||||
}
|
if (res.confirm) {
|
||||||
uni.showLoading({
|
OrderApi.cancelOrder(order_id).then(() => {
|
||||||
title: '正在删除中'
|
this.$util.Tips({
|
||||||
});
|
title: '取消成功'
|
||||||
orderCancel(order_id).then(res => {
|
}, () => {
|
||||||
uni.hideLoading();
|
this.orderList.splice(index, 1);
|
||||||
return this.$util.Tips({
|
this.$set(this, 'orderList', this.orderList);
|
||||||
title: '删除成功',
|
this.getOrderData();
|
||||||
icon: 'success'
|
})
|
||||||
}, () => {
|
}).catch((err) => {
|
||||||
this.orderList.splice(index, 1);
|
this.$util.Tips({
|
||||||
this.$set(this, 'orderList', this.orderList);
|
title: err
|
||||||
this.$set(this.orderData, 'unpaid_count', this.orderData.unpaid_count - 1);
|
})
|
||||||
this.getOrderData();
|
});
|
||||||
});
|
}
|
||||||
}).catch(err => {
|
}
|
||||||
return this.$util.Tips({
|
|
||||||
title: err
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 删除订单 TODO 芋艿:未实现
|
* 删除订单
|
||||||
*/
|
*/
|
||||||
delOrder: function(order_id, index) {
|
delOrder: function(order_id, index) {
|
||||||
orderDel(order_id).then(res => {
|
uni.showModal({
|
||||||
this.orderList.splice(index, 1);
|
title: '提示',
|
||||||
this.$set(this, 'orderList', this.orderList);
|
content: '确认删除该订单?',
|
||||||
this.$set(this.orderData, 'unpaid_count', this.orderData.unpaid_count - 1);
|
success: res => {
|
||||||
this.getOrderData();
|
if (res.confirm) {
|
||||||
return this.$util.Tips({
|
OrderApi.deleteOrder(order_id).then(() => {
|
||||||
title: '删除成功',
|
this.$util.Tips({
|
||||||
icon: 'success'
|
title: '删除成功'
|
||||||
});
|
}, () => {
|
||||||
}).catch(err => {
|
this.orderList.splice(index, 1);
|
||||||
return this.$util.Tips({
|
this.$set(this, 'orderList', this.orderList);
|
||||||
title: err
|
this.getOrderData();
|
||||||
});
|
})
|
||||||
})
|
}).catch((err) => {
|
||||||
|
this.$util.Tips({
|
||||||
|
title: err
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
fen2yuan(price) {
|
fen2yuan(price) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue