1326 lines
41 KiB
JavaScript
1326 lines
41 KiB
JavaScript
var app = getApp();
|
||
// import Dialog from "../../../dist/dialog/dialog";
|
||
Component({
|
||
properties: {
|
||
// 属性值可以在组件使用时指定
|
||
datasource: {
|
||
type: Array,
|
||
},
|
||
orderType: {
|
||
type: String,
|
||
},
|
||
detailUrl: {
|
||
type: String,
|
||
},
|
||
status: {
|
||
type: Number,
|
||
},
|
||
consolidated:{
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
custom_receipt_confirmation_html:{
|
||
type:String,
|
||
value:""
|
||
},
|
||
member_type:{
|
||
type:null,
|
||
value:''
|
||
}
|
||
},
|
||
data: {
|
||
language: "",
|
||
regional: "请选择快递公司",
|
||
dateshow_1: false,
|
||
columns: [],
|
||
checkList: [],
|
||
options: [],
|
||
//确认发货
|
||
dialogVisible: false,
|
||
expressName: "",
|
||
numberName: "",
|
||
addresseeInfo: {},
|
||
showQrcode: false,
|
||
qrcode_url: "",
|
||
// 上拉菜单弹出层
|
||
sendGoogsFail: {
|
||
show: false,
|
||
msg: "",
|
||
},
|
||
|
||
showID: "",
|
||
jurisdiction_set: 0,
|
||
|
||
showBarter: false,
|
||
showBarter_value: null,
|
||
filterExpressCompanys: [],
|
||
inputExpressCompanyName: "",
|
||
orderPayId: null,
|
||
blindBoxInfo: {
|
||
show: false,
|
||
goods: [],
|
||
//盲盒相关数据
|
||
},
|
||
refundShow: false, //退款原因
|
||
refundText: "",
|
||
|
||
custom_receipt_confirmation_show:false, //自定义确认收货弹窗
|
||
custom_receipt_confirmation_btn:{}, //自定义确认收货弹窗按钮
|
||
custom_receipt_confirmation_item:{},//自定义确认收货弹窗item
|
||
//S 申请存货弹窗
|
||
inventoryApplyPopup: false, //存货申请弹窗
|
||
inventoryApplyList: [], //仓库列表
|
||
inventoryApplyRadio: null
|
||
//E 申请存货弹窗
|
||
}, // 私有数据,可用于模板渲染
|
||
|
||
lifetimes: {
|
||
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
|
||
attached() {
|
||
let language = wx.getStorageSync("langIndex");
|
||
let yz_basic_info = wx.getStorageSync('yz_basic_info');
|
||
this.setData({
|
||
language: language.en,
|
||
vip_show:yz_basic_info.globalParameter.vip_show?yz_basic_info.globalParameter.vip_show:false
|
||
});
|
||
// this.getTemplate()
|
||
// 在组件实例进入页面节点树时执行
|
||
},
|
||
moved() {},
|
||
detached() {
|
||
// 在组件实例被从页面节点树移除时执行
|
||
},
|
||
},
|
||
pageLifetimes: {
|
||
// 组件所在页面的生命周期函数
|
||
show() {},
|
||
hide() {},
|
||
resize() {},
|
||
},
|
||
|
||
methods: {
|
||
filterExpressCompany(event) {
|
||
let input = event.detail;
|
||
const columns = this.data.columns;
|
||
this.setData({
|
||
filterExpressCompanys: columns.filter((val) => {
|
||
return val.indexOf(input) !== -1;
|
||
}),
|
||
inputExpressCompanyName: input,
|
||
});
|
||
},
|
||
toStore(e) {
|
||
let order = e.currentTarget.dataset.order;
|
||
if (order.plugin_id == 92) {
|
||
wx.navigateTo({
|
||
url: "/packageA/member/supplier/SupplierShop/SupplierShop?id=" + order.id + "&fromOrder=1",
|
||
});
|
||
} else if (order.plugin_id == 31 || order.plugin_id == 32) {
|
||
wx.navigateTo({
|
||
url: "/packageC/o2o/o2oStore/o2oStore?store_id=" + order.id + "&fromOrder=1",
|
||
});
|
||
} else if (order.plugin_id == 54 && order.has_one_team_member.store_id) {
|
||
wx.navigateTo({
|
||
url: "/packageC/o2o/o2oStore/o2oStore?store_id=" + order.has_one_team_member.store_id + "&fromHome=1",
|
||
});
|
||
} else if (order.plugin_id == 0) {
|
||
wx.reLaunch({
|
||
url: "/packageG/index/index",
|
||
});
|
||
}
|
||
},
|
||
showMore(e) {
|
||
let order_sn = e.currentTarget.dataset.order.order_sn;
|
||
if (this.data.showID == order_sn) {
|
||
this.setData({
|
||
showID: "",
|
||
});
|
||
} else {
|
||
this.setData({
|
||
showID: order_sn,
|
||
});
|
||
}
|
||
},
|
||
//获取模板id
|
||
getTemplate(order, btn) {
|
||
let urlStr = app.getNetAddresss("member.member.getMiniTemplateCorrespond");
|
||
let that = this;
|
||
app._getNetWork({
|
||
url: urlStr,
|
||
data: {
|
||
small_type: 2,
|
||
},
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
let array = [];
|
||
for (let i = 0; i < res.data.length; i++) {
|
||
array.push(res.data[i].template_id);
|
||
}
|
||
that.setData({
|
||
TemplateArray: array,
|
||
});
|
||
wx.requestSubscribeMessage({
|
||
tmplIds: that.data.TemplateArray,
|
||
success(res) {
|
||
that._toRefund(order, btn);
|
||
},
|
||
fail() {
|
||
that._toRefund(order, btn);
|
||
},
|
||
});
|
||
} else {
|
||
wx.showToast({
|
||
title: res.msg,
|
||
icon: "none",
|
||
duration: 1500,
|
||
});
|
||
}
|
||
},
|
||
fail: function (res) {
|
||
console.log(res);
|
||
},
|
||
});
|
||
},
|
||
multiplePayChange(event) {
|
||
this.setData({
|
||
checkList: event.detail,
|
||
});
|
||
this.triggerEvent("MultiplePayNotification", this.data.checkList);
|
||
},
|
||
//跳转到对应的订单详情
|
||
goOrderdetail(e) {
|
||
let orderType = this.data.orderType;
|
||
let orderid = e.currentTarget.dataset.orderid;
|
||
if(this.data.member_type == 2 || this.data.member_type == 4){
|
||
wx.navigateTo({
|
||
url: "/packageA/member/orderdetail/orderdetail?order_id=" + orderid + "&orderType=" + orderType + "&debt_shop_member_type=" + this.data.member_type,
|
||
});
|
||
return
|
||
}
|
||
wx.navigateTo({
|
||
url: "/packageA/member/orderdetail/orderdetail?order_id=" + orderid + "&orderType=" + orderType,
|
||
});
|
||
},
|
||
//根据按钮值判断用途
|
||
operation(e) {
|
||
let btn = e.currentTarget.dataset.item;
|
||
let order = e.currentTarget.dataset.order;
|
||
let orderidx = e.currentTarget.dataset.orderidx;
|
||
this.setData({
|
||
orderPayId: order.id,
|
||
});
|
||
if (!btn.api) {
|
||
if (btn.value == "expediting_delivery") {
|
||
wx.showToast({
|
||
icon: "none",
|
||
title: "已提醒过商家",
|
||
duration: 1000,
|
||
});
|
||
} else {
|
||
//接口没有返回按钮点击请求的地址
|
||
wx.showToast({
|
||
icon: "none",
|
||
title: "error:错误4008820",
|
||
duration: 1000,
|
||
});
|
||
}
|
||
return;
|
||
}
|
||
|
||
console.log(btn);
|
||
if (btn.value == 8 || btn.value == "snatch_regiment_express") {
|
||
//查看物流
|
||
this._checklogistics(order, btn);
|
||
} else if (btn.value == 12) {
|
||
//删除订单
|
||
this._deleteOrder(order, btn, orderidx);
|
||
} else if (btn.value == 51) {
|
||
//聚合cps
|
||
if (order.plugin_id == "71") {
|
||
wx.navigateTo({
|
||
url: "/packageH/cpsPwd/cpsPwd?id=" + order.id,
|
||
});
|
||
}
|
||
} else if (btn.value == 10) {
|
||
//评价订单
|
||
this._comment(order, btn);
|
||
} else if (btn.value == 1 || btn.value == "snatch_regiment_pay") {
|
||
//订单支付
|
||
this._toPay(order, btn);
|
||
} else if (btn.value == 13 || btn.value == "snatch_regiment_refund" || btn.value == '54') {
|
||
//退款
|
||
let that = this;
|
||
that.getTemplate(order, btn);
|
||
} else if (btn.value == 9) {
|
||
//取消订单
|
||
this._cancleOrder(order, btn, orderidx);
|
||
} else if (btn.value == 5) {
|
||
//确认订单
|
||
this._confirmOrder(order, btn);
|
||
} else if (btn.value == 18) {
|
||
//退款中
|
||
this._toRefundDetail(order, btn);
|
||
} else if (btn.value == "cashierPay") {
|
||
//订单已付款
|
||
this._cashPayOrder(order, btn);
|
||
} else if (btn.value == "verification_code") {
|
||
this._verification(order, btn);
|
||
} else if (btn.value == 20) {
|
||
this._verificationCash(order, btn);
|
||
} else if (btn.value == 21) {
|
||
//跳到OrderRecord
|
||
wx.navigateTo({
|
||
url: "/packageD/member/myOrder/order_record/order_record?order_id=" + item.id,
|
||
});
|
||
} else if (btn.value == 22) {
|
||
// 确认支付
|
||
this._payMoney(order, btn);
|
||
} else if (btn.value == 101) {
|
||
let _url = "/packageE/pickUpCard/pickUpCardReimburse/pickUpCardReimburse?orderid=" + order.id;
|
||
if(this.data.orderType == "picking-card-one") _url = _url + '&plugin=one';
|
||
wx.navigateTo({
|
||
url: _url
|
||
});
|
||
} else if (btn.value == "coupon") {
|
||
console.log(order.id);
|
||
wx.navigateTo({
|
||
url: "/packageD/coupon_share/coupon_share?orderid=" + order.id,
|
||
});
|
||
} else if (btn.value == 23 || btn.value == 60) {
|
||
// 确认发货
|
||
if (order.dispatch_type_id == 3) {
|
||
this.sendGoogs();
|
||
} else {
|
||
this._getCompany();
|
||
this.setData({
|
||
dialogVisible: true,
|
||
});
|
||
}
|
||
|
||
this.triggerEvent("stoprefresh", true);
|
||
this.setData({
|
||
expressName: "",
|
||
numberName: "",
|
||
});
|
||
} else if (btn.value == 24 || btn.value == 61) {
|
||
//取消发货
|
||
this._deliverGoodsCancel(order, btn);
|
||
} else if (btn.value == 25) {
|
||
//确认收货
|
||
this._collectGoods(order, btn);
|
||
} else if (btn.value == 26) {
|
||
//关闭订单
|
||
this._closeOrderPay(order, btn);
|
||
} else if (btn.value == 30) {
|
||
//退款关闭订单
|
||
this._closeOrderPay(order, btn,'确定退款关闭订单?');
|
||
} else if (btn.value == 27) {
|
||
this._evaluate(order, btn);
|
||
} else if (btn.value == 28) {
|
||
//卡密
|
||
this._truckList(btn, order);
|
||
} else if (btn.value == 41) {
|
||
//398售后
|
||
wx.navigateTo({
|
||
url: btn.api,
|
||
});
|
||
} else if (btn.value == 50) {
|
||
//查看发票
|
||
this._checkInvoice(btn, order);
|
||
} else if (btn.value == 11) {
|
||
//酒店确认下单
|
||
this.confirmHotelOrder(btn.api, order.id);
|
||
} else if (btn.value == "lease_toy_refund" || btn.value == "package_deliver_clerk") {
|
||
console.log("申请归还");
|
||
this.getRuruen(btn, order); //进行归还请求
|
||
} else if (btn.value == "lease_toy_apply_adopt") {
|
||
console.log("填写归还");
|
||
wx.navigateTo({
|
||
url: "/packageB/member/OrderReturn/OrderReturn?id=" + order.id,
|
||
});
|
||
} else if (btn.value == "lease_toy_return_info") {
|
||
console.log("归还详情");
|
||
wx.navigateTo({
|
||
url: "/packageA/others/order_ruturn_info/order_ruturn_info?id=" + order.id,
|
||
});
|
||
} else if (btn.value == "package_deliver" || btn.value == "package_delivery_confirm_code" || btn.value == "store_package_deliver" || btn.value == "reserve_simple") {
|
||
console.log("自提点核销");
|
||
console.log(btn.api);
|
||
this.getQrImg(btn, order);
|
||
} else if (btn.value == "expediting_delivery") {
|
||
this.publicMessage(btn, order, "提醒商家发货");
|
||
} else if (btn.value == "snatch_regiment_barter") {
|
||
// 抢团易货兑换
|
||
this.setData({
|
||
showBarter: true,
|
||
showBarter_value: order.barter,
|
||
});
|
||
} else if(btn.value == 53){
|
||
this.getBlindBoxGoods(order.id);
|
||
} else if(btn.value == 56){
|
||
wx.navigateTo({
|
||
url:"/packageH/project_verification/MyProject/MyProject"
|
||
});
|
||
} else if (btn.value == "close_reason") {
|
||
this.setData({
|
||
refundShow: true,
|
||
refundText: order.close_reason
|
||
});
|
||
} else if (btn.value == 140){
|
||
wx.navigateTo({
|
||
url:"/packageI/brand_resources/cardVoucherInfo/cardVoucherInfo?id="+order.id
|
||
});
|
||
} else if(btn.value == "city_delivery_detail"){
|
||
wx.navigateTo({
|
||
url:"/packageA/member/order/orderLogisticsDetails/orderLogisticsDetails?id="+order.id
|
||
});
|
||
} else if (btn.value == "inventory_apply") {
|
||
this.getWarehouseList_CH(); //获取仓库列表(申请存货)
|
||
} else {
|
||
this.publicMessage(btn, order, btn.name);
|
||
}
|
||
},
|
||
getBlindBoxGoods(id){
|
||
let that = this;
|
||
let urlStr = app.getNetAddresss('plugin.blind-box.api.index.blind-box-goods');
|
||
urlStr += '&order_id=' + this.data.orderPayId;
|
||
app._getNetWork({
|
||
url: urlStr,
|
||
success: function(resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
that.setData({
|
||
['blindBoxInfo.show']:true,
|
||
['blindBoxInfo.goods']:res.data.order
|
||
});
|
||
} else {
|
||
wx.showToast({
|
||
icon: 'none',
|
||
title: res.msg,
|
||
duration: 1200
|
||
});
|
||
}
|
||
},
|
||
fail: function(res) {
|
||
console.log(res);
|
||
}
|
||
});
|
||
},
|
||
blindBoxInfoTap(){
|
||
this.setData({
|
||
['blindBoxInfo.show']:false,
|
||
});
|
||
},
|
||
goOrderList(item){
|
||
console.log(item);
|
||
let id = item.currentTarget.dataset.item.id;
|
||
let orderType = this.data.orderType;
|
||
wx.navigateTo({
|
||
url: '/packageA/member/orderdetail/orderdetail?order_id=' + id + '&orderType=' + orderType
|
||
});
|
||
},
|
||
confirmBarter() {
|
||
let urlStr = app.getNetAddresss("plugin.snatch-regiment.api.order.barter");
|
||
urlStr += "&order_id=" + this.data.orderPayId;
|
||
app._getNetWork({
|
||
url: urlStr,
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
wx.showToast({
|
||
title: `易货兑换成功`,
|
||
icon: "success",
|
||
duration: 1500,
|
||
success: function () {},
|
||
});
|
||
that.getdata();
|
||
} else {
|
||
wx.showToast({
|
||
icon: "none",
|
||
title: res.msg,
|
||
duration: 1200,
|
||
});
|
||
}
|
||
},
|
||
fail: function (res) {
|
||
console.log(res);
|
||
},
|
||
});
|
||
},
|
||
cancelBarter() {
|
||
this.setData({
|
||
showBarter: false,
|
||
showBarter_value: null,
|
||
});
|
||
},
|
||
// 自提点确认核销
|
||
getQrImg(btn, order) {
|
||
let urlStr = app.getNetAddresss(btn.api);
|
||
if (btn.value == "package_deliver"||btn.value == "store_package_deliver") {
|
||
urlStr += "&order_id=" + order.id;
|
||
} else if(btn.value == "package_delivery_confirm_code"){
|
||
urlStr += "&order_id=" + order.id;
|
||
} else if(btn.value == "reserve_simple"){
|
||
urlStr += "&id=" + order.id;
|
||
} else {
|
||
urlStr += "&order_pay_id=" + order.id;
|
||
}
|
||
app._getNetWork({
|
||
url: urlStr,
|
||
success: (resdata) => {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
this.setData({
|
||
showQrcode: true,
|
||
qrcode_url: res.data.qr_code_url,
|
||
});
|
||
} else {
|
||
wx.showToast({
|
||
icon: "none",
|
||
title: res.msg,
|
||
duration: 1000,
|
||
});
|
||
}
|
||
},
|
||
fail: function (res) {
|
||
console.log(res);
|
||
},
|
||
});
|
||
},
|
||
|
||
publicMessage(btn, order, text) {
|
||
let that = this;
|
||
if (!btn.api) {
|
||
return;
|
||
}
|
||
wx.showModal({
|
||
title: "提示",
|
||
content: `确定${text}?`,
|
||
success(res) {
|
||
if (res.confirm) {
|
||
let urlStr = "";
|
||
urlStr += app.getNetAddresss(btn.api);
|
||
urlStr += "&order_id=" + that.data.orderPayId;
|
||
app._getNetWork({
|
||
url: urlStr,
|
||
success: function (res) {
|
||
var resdata = res.data;
|
||
if (resdata.result == 1) {
|
||
that.triggerEvent("ConfrimOrderNotification", "pay");
|
||
if(btn.value == 'inventory_cancel'){
|
||
wx.showModal({
|
||
content:'申请成功,请到待发货列表查询此订单',
|
||
});
|
||
} else{
|
||
wx.showToast({
|
||
icon: "success",
|
||
title: `${text}成功`,
|
||
duration: 1000,
|
||
});
|
||
}
|
||
} else {
|
||
wx.showToast({
|
||
icon: "none",
|
||
title: resdata.msg,
|
||
duration: 1000,
|
||
});
|
||
}
|
||
},
|
||
fail: function (resdata) {
|
||
console.log(resdata);
|
||
},
|
||
});
|
||
}
|
||
},
|
||
});
|
||
},
|
||
onClose() {
|
||
this.setData({
|
||
showQrcode: false,
|
||
});
|
||
},
|
||
//查看物流
|
||
_checklogistics(item, btn) {
|
||
//logistics
|
||
console.log(item, btn);
|
||
if (item.is_all_send_goods == 0) {
|
||
wx.navigateTo({
|
||
url: "/packageA/member/order/logistics/logistics?id=" + item.id + "&api=" + btn.api,
|
||
});
|
||
} else {
|
||
wx.navigateTo({
|
||
url: "/packageE/multiplePackages/multiplePackages?id=" + item.id + "&api=" + btn.api,
|
||
});
|
||
}
|
||
},
|
||
// 申请归还
|
||
getRuruen(btn, order) {
|
||
let urlStr = app.getNetAddresss(btn.api);
|
||
urlStr += "&order_id=" + order.id;
|
||
app._getNetWork({
|
||
url: urlStr,
|
||
success: (resdata) => {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
wx.showToast({
|
||
title: res.msg,
|
||
icon: "none",
|
||
duration: 1500,
|
||
});
|
||
this.triggerEvent("ConfrimOrderNotification");
|
||
} else {
|
||
wx.showToast({
|
||
icon: "none",
|
||
title: res.msg,
|
||
duration: 1000,
|
||
});
|
||
}
|
||
},
|
||
fail: function (res) {
|
||
console.log(res);
|
||
},
|
||
});
|
||
},
|
||
//删除订单
|
||
_deleteOrder(item, btn, orderidx) {
|
||
let that = this;
|
||
wx.showModal({
|
||
title: "提示",
|
||
content: "确定删除此订单?",
|
||
success(res) {
|
||
if (res.confirm) {
|
||
//删除当前选中的地址
|
||
let datasource = that.data.datasource;
|
||
datasource.splice(orderidx, 1);
|
||
that.setData({
|
||
datasource: datasource,
|
||
});
|
||
that._sentRequest(btn.api, "&order_id=" + item.id, false);
|
||
}
|
||
},
|
||
});
|
||
},
|
||
_sentRequest(action, params, isIndicator) {
|
||
let urlStr = app.getNetAddresss(action);
|
||
urlStr += params;
|
||
app._getNetWork({
|
||
url: urlStr,
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
wx.showToast({
|
||
title: res.msg,
|
||
icon: "none",
|
||
duration: 1500,
|
||
success: function () {
|
||
setTimeout(function () {
|
||
//要延时执行的代码
|
||
wx.navigateBack({
|
||
delta: 1,
|
||
});
|
||
}, 1500); //延迟时间
|
||
},
|
||
});
|
||
} else {
|
||
wx.showToast({
|
||
icon: "none",
|
||
title: res.msg,
|
||
duration: 1000,
|
||
});
|
||
}
|
||
},
|
||
fail: function (res) {
|
||
console.log(res);
|
||
},
|
||
});
|
||
},
|
||
//评价订单
|
||
_comment(item, btn) {
|
||
wx.navigateTo({
|
||
url: "/packageB/comment/comment?order=" + JSON.stringify(item ? item : {}),
|
||
});
|
||
// 跳到评价订单
|
||
//comment
|
||
},
|
||
_toPay(item, btn) {
|
||
if(item.plugin_id == '107'){
|
||
wx.navigateTo({
|
||
url: '/packageD/buy/orderPay/orderPay?order_id=' + item.id + '&status=1'+ '&api=' + btn.api+'&name=bilndBox'
|
||
});
|
||
return;
|
||
}
|
||
//status-2合并支付 type-1订单支付
|
||
wx.navigateTo({
|
||
url: "/packageD/buy/orderPay/orderPay?order_id=" + item.id + "&status=1" + "&api=" + btn.api,
|
||
});
|
||
},
|
||
//退款中
|
||
_toRefundDetail(item, btn) {
|
||
//aftersales
|
||
wx.navigateTo({
|
||
url: "/packageD/member/myOrder/Aftersales/Aftersales?refund_id=" + item.refund_id,
|
||
});
|
||
},
|
||
//退款
|
||
_toRefund(item, btn) {
|
||
//refund
|
||
if(item.plugin_id == '107'){
|
||
wx.navigateTo({
|
||
url: "/packageD/member/myOrder/refund/refund?order_id=" + item.id + "&type=1"+'&value='+btn.value,
|
||
});
|
||
return;
|
||
}
|
||
if (btn.value == "snatch_regiment_refund") {
|
||
//抢团
|
||
wx.navigateTo({
|
||
url: "/packageD/member/myOrder/refund/refund?order_id=" + item.id + "&type=3",
|
||
});
|
||
} else {
|
||
wx.navigateTo({
|
||
url: "/packageD/member/myOrder/refund/refund?order_id=" + item.id + "&type=1",
|
||
});
|
||
}
|
||
},
|
||
//取消订单
|
||
_cancleOrder(item, btn, orderidx) {
|
||
var that = this;
|
||
wx.showModal({
|
||
title: "提示",
|
||
content: "确定取消此订单?",
|
||
success(res) {
|
||
if (res.confirm) {
|
||
//取消当前选中的地址
|
||
let datasource = that.data.datasource;
|
||
datasource.splice(orderidx, 1);
|
||
that.setData({
|
||
datasource: datasource,
|
||
});
|
||
that._sentRequest(btn.api, "&order_id=" + item.id, false);
|
||
}
|
||
},
|
||
});
|
||
},
|
||
//确认收货
|
||
_confirmOrder(item, btn) {
|
||
console.log(item,this.data.custom_receipt_confirmation_html);
|
||
if((item.plugin_id==0 || item.plugin_id==44) && this.data.custom_receipt_confirmation_html!==''){
|
||
this.setData({
|
||
custom_receipt_confirmation_btn:btn,
|
||
custom_receipt_confirmation_item:item,
|
||
custom_receipt_confirmation_show:true
|
||
});
|
||
return;
|
||
}
|
||
wx.showModal({
|
||
title: "提示",
|
||
content: "您确定收到货物?",
|
||
success:(resqu)=> {
|
||
if (resqu.confirm) {
|
||
this._confirmOrder_request(item,btn);
|
||
}
|
||
},
|
||
});
|
||
},
|
||
CustomReceiptConfirmationSend(){
|
||
this._confirmOrder_request(this.data.custom_receipt_confirmation_item,this.data.custom_receipt_confirmation_btn);
|
||
},
|
||
_confirmOrder_request(item,btn){
|
||
let urlStr = app.getNetAddresss(btn.api);
|
||
urlStr += "&order_id=" + item.id;
|
||
app._getNetWork({
|
||
url: urlStr,
|
||
success: (resdata) => {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
this.triggerEvent("ConfrimOrderNotification", item.id);
|
||
} else {
|
||
app.tips(res.msg);
|
||
}
|
||
},
|
||
fail: (res) => {
|
||
console.log(res);
|
||
},
|
||
});
|
||
},
|
||
_cashPayOrder(item, btn) {
|
||
let that = this;
|
||
wx.showModal({
|
||
title: "提示",
|
||
content: "确定此订单已付款?",
|
||
success(res) {
|
||
if (res.confirm) {
|
||
that._sentRequest(btn.api, "&order_id=" + item.id + "&order_pay_id=" + that.data.order_pay_id, false);
|
||
}
|
||
},
|
||
});
|
||
},
|
||
_verification(item, btn) {
|
||
//订单核销
|
||
//orderVerification
|
||
wx.navigateTo({
|
||
url: "/packageD/member/myOrder/orderVerification/orderVerification?order_id=" + item.id + "&api=" + btn.api,
|
||
});
|
||
},
|
||
_verificationCash(item, btn) {
|
||
let that = this;
|
||
wx.showModal({
|
||
title: "提示",
|
||
content: "确定此订单已付款?",
|
||
success(res) {
|
||
if (res.confirm) {
|
||
that._sentRequest(btn.api, "&order_id=" + item.id + "&order_pay_id=" + that.data.order_pay_id, false);
|
||
}
|
||
},
|
||
});
|
||
},
|
||
//确认支付
|
||
_payMoney(item, btn) {
|
||
let that = this;
|
||
wx.showModal({
|
||
title: "提示",
|
||
content: "确认支付该订单?",
|
||
success(res) {
|
||
if (res.confirm) {
|
||
let urlStr = "";
|
||
if (that.data.orderType == "supplier" || that.data.orderType == "subsidiary" || that.data.orderType == "storeMang") {
|
||
urlStr += app.getNetAddresss(btn.api);
|
||
urlStr += "&order_id=" + that.data.orderPayId;
|
||
} else {
|
||
urlStr += app.getNetAddresss("plugin.store-cashier.frontend.store.center.order-operation.pay");
|
||
urlStr += "&order_id=" + that.data.orderPayId;
|
||
}
|
||
app._getNetWork({
|
||
url: urlStr,
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
that.triggerEvent("ConfrimOrderNotification", "pay");
|
||
wx.showToast({
|
||
icon: "success",
|
||
title: "支付成功",
|
||
duration: 1000,
|
||
});
|
||
} else {
|
||
wx.showToast({
|
||
icon: "none",
|
||
title: res.msg,
|
||
duration: 1000,
|
||
});
|
||
}
|
||
},
|
||
fail: function (res) {
|
||
console.log(res);
|
||
},
|
||
});
|
||
}
|
||
},
|
||
});
|
||
},
|
||
//获取快递公司
|
||
_getCompany() {
|
||
let that = this;
|
||
let urlStr = "";
|
||
if (that.data.orderType == "supplier") {
|
||
urlStr += app.getNetAddresss("plugin.supplier.frontend.order.express-company");
|
||
} else if (that.data.orderType == "subsidiary") {
|
||
urlStr += app.getNetAddresss("plugin.subsidiary.frontend.order.express-company");
|
||
} else if (that.data.orderType == "storeMang") {
|
||
urlStr += app.getNetAddresss("plugin.shop-assistant.frontend.order.expressCompanies");
|
||
} else {
|
||
urlStr += app.getNetAddresss("plugin.store-cashier.frontend.store.center.sendOrder");
|
||
}
|
||
urlStr += "&order_id=" + that.data.orderPayId;
|
||
app._getNetWork({
|
||
url: urlStr,
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
that.setData({
|
||
options: res.data.express_companies,
|
||
});
|
||
var arrayOfSquares = that.data.options.map(function (item) {
|
||
return item.name;
|
||
});
|
||
if (!app._isTextEmpty(res.data.jurisdiction_set)) {
|
||
that.setData({
|
||
jurisdiction_set: res.data.jurisdiction_set,
|
||
});
|
||
}
|
||
that.setData({
|
||
columns: arrayOfSquares,
|
||
addresseeInfo: res.data.address,
|
||
});
|
||
}
|
||
},
|
||
fail: function (res) {
|
||
console.log(res);
|
||
},
|
||
});
|
||
},
|
||
//取消发货
|
||
_deliverGoodsCancel(order, btn) {
|
||
let that = this;
|
||
wx.showModal({
|
||
title: "提示",
|
||
content: "确定取消发货?",
|
||
success(res) {
|
||
if (res.confirm) {
|
||
let urlStr = "";
|
||
if (that.data.orderType == "supplier" || that.data.orderType == "subsidiary" || that.data.orderType == "storeMang") {
|
||
urlStr += app.getNetAddresss(btn.api);
|
||
urlStr += "&order_id=" + that.data.orderPayId;
|
||
} else if (that.data.orderType == "auction") {
|
||
urlStr += app.getNetAddresss("plugin.auction.api.order-operation.cancel-send");
|
||
urlStr += "&order_id=" + that.data.orderPayId;
|
||
} else {
|
||
urlStr += app.getNetAddresss("plugin.store-cashier.frontend.store.center.order-operation.cancel-send");
|
||
urlStr += "&order_id=" + that.data.orderPayId;
|
||
}
|
||
app._getNetWork({
|
||
url: urlStr,
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
that.triggerEvent("ConfrimOrderNotification", "pay");
|
||
wx.showToast({
|
||
icon: "success",
|
||
title: "取消发货成功",
|
||
duration: 1000,
|
||
});
|
||
} else {
|
||
wx.showToast({
|
||
icon: "none",
|
||
title: res.msg,
|
||
duration: 1000,
|
||
});
|
||
}
|
||
},
|
||
fail: function (res) {
|
||
console.log(res);
|
||
},
|
||
});
|
||
}
|
||
},
|
||
});
|
||
},
|
||
//确认收货
|
||
_collectGoods(order, btn) {
|
||
let that = this;
|
||
wx.showModal({
|
||
title: "提示",
|
||
content: "确认收货?",
|
||
success(res) {
|
||
if (res.confirm) {
|
||
let urlStr = "";
|
||
if (that.data.orderType == "supplier" || that.data.orderType == "subsidiary" || that.data.orderType == "pickup_card"|| that.data.orderType == "picking-card-one" || that.data.orderType == "storeMang") {
|
||
urlStr += app.getNetAddresss(btn.api);
|
||
urlStr += "&order_id=" + that.data.orderPayId;
|
||
} else {
|
||
urlStr += app.getNetAddresss("plugin.store-cashier.frontend.store.center.order-operation.receive");
|
||
urlStr += "&order_id=" + that.data.orderPayId;
|
||
}
|
||
app._getNetWork({
|
||
url: urlStr,
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
that.triggerEvent("ConfrimOrderNotification", "pay");
|
||
wx.showToast({
|
||
icon: "success",
|
||
title: "收货成功",
|
||
duration: 1000,
|
||
});
|
||
} else {
|
||
wx.showToast({
|
||
icon: "none",
|
||
title: res.msg,
|
||
duration: 1000,
|
||
});
|
||
}
|
||
},
|
||
fail: function (res) {
|
||
console.log(res);
|
||
},
|
||
});
|
||
}
|
||
},
|
||
});
|
||
},
|
||
//关闭订单
|
||
_closeOrderPay(order, btn,msg='') {
|
||
let that = this;
|
||
wx.showModal({
|
||
title: "提示",
|
||
content: !msg?'确定关闭订单?':msg,
|
||
success(res) {
|
||
if (res.confirm) {
|
||
let urlStr = "";
|
||
if (that.data.orderType == "supplier" || that.data.orderType == "subsidiary" || that.data.orderType == "storeMang") {
|
||
urlStr += app.getNetAddresss(btn.api);
|
||
urlStr += "&order_id=" + that.data.orderPayId;
|
||
} else {
|
||
urlStr += app.getNetAddresss("plugin.store-cashier.frontend.store.center.order-operation.close");
|
||
urlStr += "&order_id=" + that.data.orderPayId;
|
||
urlStr += "&shop_id=" + null;
|
||
}
|
||
app._getNetWork({
|
||
url: urlStr,
|
||
success: function (res) {
|
||
var resdata = res.data;
|
||
if (resdata.result == 1) {
|
||
that.triggerEvent("ConfrimOrderNotification", "pay");
|
||
wx.showToast({
|
||
icon: "success",
|
||
title: "关闭订单成功",
|
||
duration: 1000,
|
||
});
|
||
} else {
|
||
wx.showToast({
|
||
icon: "none",
|
||
title: resdata.msg,
|
||
duration: 1000,
|
||
});
|
||
}
|
||
},
|
||
fail: function (resdata) {
|
||
console.log(resdata);
|
||
},
|
||
});
|
||
}
|
||
},
|
||
});
|
||
},
|
||
// 评价
|
||
_evaluate(order, btn) {
|
||
//抢单评价
|
||
//DeliveryEvaluate
|
||
wx.navigateTo({
|
||
url: "/packageD/member/myOrder/DeliveryEvaluate/DeliveryEvaluate?order_id=" + order.order_id + "&api=" + btn.api + "&name=distributor",
|
||
});
|
||
},
|
||
//卡密
|
||
_truckList(btn, order) {
|
||
//TruckList
|
||
wx.navigateTo({
|
||
url: "/packageD/member/myOrder/truckList/truckList?order_id=" + order.id,
|
||
});
|
||
},
|
||
//查看发票
|
||
_checkInvoice(btn, order) {
|
||
//Invoice
|
||
wx.navigateTo({
|
||
url: "/packageD/member/myOrder/invoice/invoice?order_id=" + order.id,
|
||
});
|
||
},
|
||
//快递单号输入值绑定
|
||
numberNamebtn(e) {
|
||
let val = e.detail.value;
|
||
this.setData({
|
||
numberName: val,
|
||
});
|
||
},
|
||
//确认发货
|
||
sendGoogs(event) {
|
||
if (!event || event.detail === "confirm") {
|
||
let that = this;
|
||
// 发货失败上拉弹出菜单函数
|
||
const sendGoogsFail = (msg) => {
|
||
this.setData({
|
||
sendGoogsFail: {
|
||
show: true,
|
||
msg,
|
||
},
|
||
dialogVisible: false,
|
||
});
|
||
};
|
||
if (this.data.orderType == "supplier") {
|
||
let urlStr = "";
|
||
urlStr += app.getNetAddresss("plugin.supplier.frontend.order.send");
|
||
let json = {
|
||
order_id: that.data.orderPayId,
|
||
express_code: that.data.expressName.value,
|
||
express_company_name: that.data.expressName.name,
|
||
express_sn: that.data.numberName,
|
||
};
|
||
app._postNetWork({
|
||
url: urlStr,
|
||
showToastIn: false,
|
||
data: json,
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
console.log("msg=", res);
|
||
if (res.result == 1) {
|
||
that.setData({
|
||
dialogVisible: false,
|
||
});
|
||
that.triggerEvent("stoprefresh", false);
|
||
that.triggerEvent("ConfrimOrderNotification", "pay");
|
||
wx.showToast({
|
||
icon: "success",
|
||
title: "发货成功",
|
||
duration: 1000,
|
||
});
|
||
} else {
|
||
sendGoogsFail(res.msg);
|
||
}
|
||
},
|
||
fail: function (res) {},
|
||
});
|
||
} else if (this.data.orderType == "subsidiary") {
|
||
let urlStr = "";
|
||
urlStr += app.getNetAddresss("plugin.subsidiary.frontend.order.send");
|
||
let json = {
|
||
order_id: that.data.orderPayId,
|
||
express_code: that.data.expressName.value,
|
||
express_company_name: that.data.expressName.name,
|
||
express_sn: that.data.numberName,
|
||
};
|
||
app._postNetWork({
|
||
url: urlStr,
|
||
showToastIn: false,
|
||
data: json,
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
that.setData({
|
||
dialogVisible: false,
|
||
});
|
||
that.triggerEvent("stoprefresh", false);
|
||
that.triggerEvent("ConfrimOrderNotification", "pay");
|
||
wx.showToast({
|
||
icon: "success",
|
||
title: "发货成功",
|
||
duration: 1000,
|
||
});
|
||
} else {
|
||
sendGoogsFail(res.msg);
|
||
}
|
||
},
|
||
fail: function (res) {},
|
||
});
|
||
} else if (this.data.orderType == "auction" || this.data.orderType=='storeMang') {
|
||
let urlStr = "";
|
||
urlStr = app.getNetAddresss("plugin.auction.api.order-operation.send");
|
||
if(this.data.orderType=='storeMang'){
|
||
urlStr += app.getNetAddresss("plugin.shop-assistant.frontend.order.send");
|
||
}
|
||
let json = {
|
||
order_id: that.data.orderPayId,
|
||
express_code: that.data.expressName.value,
|
||
express_company_name: that.data.expressName.name,
|
||
express_sn: that.data.numberName,
|
||
};
|
||
app._postNetWork({
|
||
url: urlStr,
|
||
showToastIn: false,
|
||
data: json,
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
that.setData({
|
||
dialogVisible: false,
|
||
});
|
||
that.triggerEvent("stoprefresh", false);
|
||
that.triggerEvent("ConfrimOrderNotification", "pay");
|
||
wx.showToast({
|
||
icon: "success",
|
||
title: "发货成功",
|
||
duration: 1000,
|
||
});
|
||
} else {
|
||
sendGoogsFail(res.msg);
|
||
}
|
||
},
|
||
fail: function (res) {},
|
||
});
|
||
} else {
|
||
let urlStr = "";
|
||
urlStr += app.getNetAddresss("plugin.store-cashier.frontend.store.center.order-operation.send");
|
||
urlStr += "&order_id=" + that.data.orderPayId;
|
||
urlStr += "&express_code=" + that.data.expressName.value;
|
||
urlStr += "&express_company_name=" + that.data.expressName.name;
|
||
urlStr += "&express_sn=" + that.data.numberName;
|
||
app._getNetWork({
|
||
url: urlStr,
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
console.log("result=", res.result);
|
||
that.triggerEvent("ConfrimOrderNotification", "pay");
|
||
wx.showToast({
|
||
icon: "success",
|
||
title: "发货成功",
|
||
duration: 1000,
|
||
});
|
||
that.setData({
|
||
dialogVisible: false,
|
||
});
|
||
} else {
|
||
sendGoogsFail(res.msg);
|
||
}
|
||
},
|
||
fail: function (res) {},
|
||
});
|
||
}
|
||
} else {
|
||
this.setData({
|
||
dialogVisible: false,
|
||
});
|
||
this.triggerEvent("stoprefresh", false);
|
||
}
|
||
},
|
||
// 关闭上拉弹出
|
||
colseSendGoogsFailPopup() {
|
||
this.setData({
|
||
"sendGoogsFail.show": false,
|
||
});
|
||
},
|
||
//快递选择
|
||
seleRegional: function () {
|
||
this.setData({
|
||
dateshow_1: true,
|
||
});
|
||
},
|
||
onCancelbtn: function () {
|
||
this.setData({
|
||
dateshow_1: false,
|
||
inputExpressCompanyName: "",
|
||
filterExpressCompanys: [],
|
||
});
|
||
},
|
||
onConfirmbtn: function (e) {
|
||
let index = e.detail.index;
|
||
let val = e.detail.value;
|
||
let array = this.data.options.filter((item) => {
|
||
return item.name.indexOf(this.data.inputExpressCompanyName) !== -1;
|
||
});
|
||
this.setData({
|
||
dateshow_1: false,
|
||
regional: val,
|
||
expressName: array[index],
|
||
inputExpressCompanyName: "",
|
||
filterExpressCompanys: [],
|
||
});
|
||
},
|
||
// for prevent touchmove
|
||
noop: function noop() {},
|
||
//value 11 酒店确认下单
|
||
confirmHotelOrder(api, id) {
|
||
let urlStr = "";
|
||
urlStr += app.getNetAddresss(api);
|
||
urlStr += "&order_id=" + id;
|
||
app._getNetWork({
|
||
url: urlStr,
|
||
success: function (resdata) {
|
||
var res = resdata.data;
|
||
if (res.result == 1) {
|
||
wx.showToast({
|
||
icon: "none",
|
||
title: res.msg,
|
||
duration: 1000,
|
||
});
|
||
} else {
|
||
wx.showToast({
|
||
icon: "none",
|
||
title: res.msg,
|
||
duration: 1000,
|
||
});
|
||
}
|
||
},
|
||
fail: function (res) {
|
||
console.log(res);
|
||
},
|
||
});
|
||
},
|
||
copyorderbtn(e) {
|
||
let copydata = e.currentTarget.dataset.copydata;
|
||
wx.setClipboardData({
|
||
data: copydata ? copydata : "",
|
||
success(res) {
|
||
wx.showToast({
|
||
icon: "none",
|
||
title: "复制成功",
|
||
duration: 1000,
|
||
});
|
||
},
|
||
});
|
||
},
|
||
onCloseRefundShow(){
|
||
this.setData({
|
||
refundShow: false
|
||
});
|
||
},
|
||
|
||
// 评价,追评,查看评价按钮
|
||
evaluateOpration(e) {
|
||
let btn = e.target.dataset.btn;
|
||
let item = e.target.dataset.goods;
|
||
let order_id = e.target.dataset.order.id;
|
||
//value-0评价 value-1追加评价 value-2查看评价详情
|
||
if (btn.value == 0) {
|
||
wx.navigateTo({
|
||
url: '/packageD/member/evaluate/evaluate?order_id=' + order_id + '&id=' + item.id
|
||
});
|
||
} else if (btn.value == 1) {
|
||
wx.navigateTo({
|
||
url: '/packageD/member/addevaluate/addevaluate?order_id=' + order_id + '&item=' + JSON.stringify(item)
|
||
});
|
||
} else if (btn.value == 2) {
|
||
let options = "?order_id=" + order_id;
|
||
options = options + '&goods_id=' + item.has_one_comment.goods_id;
|
||
options = options + '&comment_id=' + item.has_one_comment.id;
|
||
options = options + '&order_goods_id=' + item.id;
|
||
wx.navigateTo({
|
||
url: '/packageD/member/CommentDetails/CommentDetails' + options
|
||
});
|
||
}
|
||
},
|
||
|
||
onChangeInventoryApplyRadio(event){
|
||
this.setData({
|
||
inventoryApplyRadio: event.detail,
|
||
});
|
||
},
|
||
getWarehouseList_CH() {
|
||
let urlStr = app.getNetAddresss("plugin.order-inventory.frontend.index.warehouse-list");
|
||
app._postNetWork({
|
||
url: urlStr,
|
||
data: {},
|
||
success: (resdata) => {
|
||
let res = resdata.data;
|
||
if (res.result == 1) {
|
||
this.setData({
|
||
inventoryApplyList: res.data.list, //仓库列表
|
||
inventoryApplyRadio: res.data.list[0].id,
|
||
inventoryApplyPopup: true //存货申请弹窗
|
||
})
|
||
} else {
|
||
app.tips(res.msg)
|
||
}
|
||
},
|
||
fail: (res) => {
|
||
console.log(res);
|
||
},
|
||
});
|
||
},
|
||
confirmInventoryApply() {
|
||
let urlStr = app.getNetAddresss("plugin.order-inventory.frontend.index.inventory-apply");
|
||
app._postNetWork({
|
||
url: urlStr,
|
||
data: { warehouse_id: this.data.inventoryApplyRadio, order_id: this.data.orderPayId },
|
||
success: (resdata) => {
|
||
let res = resdata.data;
|
||
app.tips(res.msg)
|
||
if (res.result == 1) {
|
||
this.triggerEvent("ConfrimOrderNotification", "pay");
|
||
}
|
||
},
|
||
fail: (res) => {
|
||
console.log(res);
|
||
},
|
||
});
|
||
},
|
||
},
|
||
});
|