// pages/orderdetail/orderdetail.js var app = getApp(); Page({ /** * 页面的初始数据 */ data: { language: "", regional: "请选择快递公司", dateshow_1: false, orderType: "", order_id: "", options: [], columns: [], addresseeInfo: "", address: "", mobile: "", receiver: "", order_data: "", order_pay_id: "", dispatch_type_id: "", pay_type_id: "", hotel_start: "", hotel_end: "", night_day: "", hotel_name: "", //确认发货 dialogVisible: false, expressName: "", numberName: "", package_deliver: {}, showQrcode: false, qrcode_url: "", showDiyForm: false, diyform: {}, jurisdiction_set: 0, showID: "", showBarter: false, showBarter_value: null, orderPayId: null, //消费红包 showPacket: false, shrinkPacket: false, timer: null, hasPacket: false, showKefu: false, // 话费慢充 phone_bill: {}, customForm: [], refundShow: false, //退款原因 refundText: "", integral: "积分", custom_receipt_confirmation_html:"", custom_receipt_confirmation_show:false, //自定义确认收货弹窗 custom_receipt_confirmation_btn:{}, //自定义确认收货弹窗按钮 custom_receipt_confirmation_item:{},//自定义确认收货弹窗item electricity_bill_pro:{}, oil_recharge:{}, //油卡充值 aggregation_cps_recharge_bill:false, //S 申请存货弹窗 inventoryApplyPopup: false, //存货申请弹窗 inventoryApplyList: [], //仓库列表 inventoryApplyRadio: null //E 申请存货弹窗 }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { console.log("options:::::", options); // 页面传参 if (options.scene) { console.log("option.scene:::::", options.scene); console.log(decodeURIComponent(options.scene)); let scene = decodeURIComponent(options.scene); if (scene) { var info_arr = []; info_arr = scene.split("&"); for (let i = 0; i < info_arr.length; i++) { let chil_arr = []; chil_arr = info_arr[i].split("="); console.log(chil_arr); // 这是自提点 if (chil_arr[0] == "orderType") { this.setData({ orderType: chil_arr[1], }); } else { // 这是门店 this.setData({ orderType: "store", }); } if (chil_arr[0] == "id") { this.setData({ order_id: chil_arr[1], }); } else if (chil_arr[0] == "mid") { app._setMid(chil_arr[1]); } else if (chil_arr[0] == "is_clerk") { this.setData({ is_clerk: chil_arr[1], }); } else { console.log("error:: 核销员进入错误"); wx.hideLoading(); } } console.log(this.data.order_id); } } else { if (options.order_id) { this.setData({ order_id: options.order_id, }); } if(options.debt_shop_member_type){ this.setData({ debt_shop_member_type:options.debt_shop_member_type }) } if (options.orderType && options.orderType == "groups") { this.setData({ orderType: "groups", }); } else if (options.orderType) { this.setData({ orderType: options.orderType, }); } else { this.setData({ orderType: "shop", }); } } if (options.order_id) { this.setData({ order_id: options.order_id, }); } let yz_basic_info = wx.getStorageSync('yz_basic_info'); this.setData({ showDiyForm: false, vip_show:yz_basic_info.globalParameter.vip_show?yz_basic_info.globalParameter.vip_show:false }); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { let language = wx.getStorageSync("langIndex"); this.setData({ language: language.en }); const value = wx.getStorageSync("integral"); if (value) { this.setData({ integral: value, }); } }, /** * 生命周期函数--监听页面显示 */ onShow: function () { this.getNetData(); this.setData({ showPacket: false, shrinkPacket: false, timer: null, hasPacket: false, }); let basicinfo = wx.getStorageSync("yz_basic_info"); if (basicinfo && basicinfo.globalParameter.consume_red_packet_status == 1) { this.checkoutConsumePacket(); } }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () {}, /** * 生命周期函数--监听页面卸载 */ onUnload: function () {}, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () {}, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () {}, /** * 用户点击右上角分享 */ onShareAppMessage: function () {}, callPhone() { wx.makePhoneCall({ phoneNumber: this.data.service_mobile, }); }, phoneClick({target:{dataset:{phone}}}){ wx.makePhoneCall({ phoneNumber:phone, success(){}, fail(){} }) }, copyMsg({target:{dataset:{msg}}}){ console.log(msg); wx.setClipboardData({ data: msg, success: function (res) { wx.showToast({ title: '复制成功', icon: 'success', duration: 2000 }); }, fail(){ wx.showToast({ title: '复制失败', icon: 'error', duration: 2000 }) } }) }, closePop() { this.setData({ showKefu: false, }); }, 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, }); } }, startRotate() { if (this.data.timer) { clearInterval(this.data.timer); } this.data.timer = setInterval(() => { this.setData({ shrinkPacket: !this.data.shrinkPacket, }); }, 150); }, onClickShow() { this.setData({ showPacket: true, }); }, onClickHide() { this.setData({ showPacket: false, }); }, toPacket() { wx.navigateTo({ url: "/packageE/ConsumePacket/ConsumePacketSuccess/ConsumePacketSuccess?order_id=" + this.data.order_id.toString(), }); }, // 消费红包 checkoutConsumePacket() { let urlStr = app.getNetAddresss("plugin.consume-red-packet.Frontend.Modules.Packet.Controllers.has.index"); app._postNetWork({ url: urlStr, data: { order_id: this.data.order_id.toString().split(","), }, success: (resdata) => { var res = resdata.data; if (res.result == 1) { this.setData({ hasPacket: true, }); this.startRotate(); } }, fail: function (res) { console.log(res); }, }); }, // 获取客服 getKefu() { let goods_id = ""; if (this.data.order_data.has_many_order_goods.length > 0) { goods_id = this.data.order_data.has_many_order_goods[0].goods_id; } let urlStr = app.getNetAddresss("goods.customer-service.index"); app._postNetWork({ url: urlStr, data: { goods_id: goods_id, }, success: (resdata) => { var res = resdata.data; if (res.result == 1) { this.setData({ customer_open:res.data.customer_open == 0?false:true, showKefu: true, cservice: res.data.cservice, service_QRcode: res.data.service_QRcode, service_mobile: res.data.service_mobile, }); } }, fail: function (res) { console.log(res); }, }); }, showDiy(e) { if (e.currentTarget.dataset.from) { for (let i = 0; i <= e.currentTarget.dataset.from.length - 1; i++) { if (e.currentTarget.dataset.from[i].type == "diyriqi") { e.currentTarget.dataset.from[i].content = this.timestampToTime(parseInt(e.currentTarget.dataset.from[i].content) * 1000); } } this.setData({ showDiyForm: true, diyform: e.currentTarget.dataset.from, }); } }, timestampToTime(timestamp) { var date = new Date(timestamp * 1000); //时间戳为10位需*1000,时间戳为13位的话不需乘1000 let Y = date.getFullYear() + "-"; let M = (date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1) + "-"; let D = this.change(date.getDate()) + " "; let h = this.change(date.getHours()) + ":"; let m = this.change(date.getMinutes()) + ":"; let s = this.change(date.getSeconds()); return Y + M + D + h + m + s; }, change(t) { if (t < 10) { return "0" + t; } else { return t; } }, onDiyFormClose() { this.setData({ showDiyForm: false, }); }, //获取快递公司 getCompany() { let that = this; let urlStr = ""; if (this.data.orderType == "supplier") { urlStr += app.getNetAddresss("plugin.supplier.frontend.order.express-company"); } else if (this.data.orderType == "subsidiary") { urlStr += app.getNetAddresss("plugin.subsidiary.frontend.order.express-company"); } else if (this.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.order_id; app._getNetWork({ url: urlStr, success: function (resdata) { var res = resdata.data; if (res.result == 1) { that.setData({ options: res.data.express_companies ? 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, address: res.data.address.address, mobile: res.data.address.mobile, receiver: res.data.address.realname, }); } else { wx.showToast({ icon: "none", title: res.msg, duration: 1500, }); } }, fail: function (res) { console.log(res); }, }); }, getNetData() { let that = this; let urlStr = ""; if (this.data.orderType == "cashier") { urlStr += app.getNetAddresss("plugin.store-cashier.frontend.Order.detail"); } else if (this.data.orderType == "store") { urlStr += app.getNetAddresss("plugin.store-cashier.frontend.store.order-detail"); } else if (this.data.orderType == "supplier") { urlStr += app.getNetAddresss("plugin.supplier.frontend.order.detail"); } else if (this.data.orderType == "subsidiary") { urlStr += app.getNetAddresss("plugin.subsidiary.frontend.order.detail"); } else if (this.data.orderType == "hotel") { urlStr += app.getNetAddresss("plugin.hotel.frontend.hotel.detail"); } else if (this.data.orderType == "hotel_center") { urlStr += app.getNetAddresss("plugin.hotel.frontend.hotel.center.order-detail"); } else if (this.data.orderType == "hotelcashier") { urlStr += app.getNetAddresss("plugin.hotel.frontend.Order.detail"); } else if (this.data.orderType == "lease_toy") { urlStr += app.getNetAddresss("plugin.lease-toy.api.order.order-detail.index"); } else if (this.data.orderType == "verifier") { urlStr += app.getNetAddresss("plugin.package-deliver.frontend.clerk-order-detail.index"); //自提点核销员 } else if (this.data.orderType == "pdy") { urlStr += app.getNetAddresss("plugin.package-delivery.frontend.detail.index"); //商城自提点核销员 } else if (this.data.orderType == "commission_activity") { urlStr += app.getNetAddresss("plugin.commission-activity.api.activity-inquire.order-detail"); } else if (this.data.orderType == "groups") { urlStr += app.getNetAddresss("plugin.fight-groups.frontend.controllers.detail.index"); } else if (this.data.orderType == "groupsBuy") { urlStr += app.getNetAddresss("plugin.together-purchase.api.index.getTogetherData"); urlStr += "&art=orderDetail"; } else if (this.data.orderType == "grabGroup") { urlStr += app.getNetAddresss("plugin.snatch-regiment.api.index.getSnatchData"); urlStr += "&art=orderDetail"; } else if (this.data.orderType == "pickup_card") { urlStr += app.getNetAddresss("plugin.picking-card.frontend.detail"); } else if (this.data.orderType == "picking-card-one") { urlStr += app.getNetAddresss("plugin.picking-card-one.frontend.detail"); } else if (this.data.orderType == "community_buying") { urlStr += app.getNetAddresss("plugin.package-deliver.frontend.order.detail.index"); } else if(this.data.orderType == "luck-draw"){ urlStr += app.getNetAddresss("plugin.luck-draw.frontend.index.myPrizeDetail"); } else if(this.data.orderType == "newRetail"){ urlStr += app.getNetAddresss("plugin.new-retail.frontend.orderData.detail"); } else if(this.data.orderType == "zhpGroup"){ urlStr += app.getNetAddresss("plugin.zhp-group-lottery.frontend.detail.index"); } else if(this.data.orderType == "storeMang"){ urlStr += app.getNetAddresss("plugin.shop-assistant.frontend.order.order-detail"); } else if (this.data.orderType == "warehouseTakeDelivery") { urlStr += app.getNetAddresss("plugin.warehouse.frontend.controllers.takeDelivery.order-detail"); } else if (this.data.orderType == "warehousePurchasing") { urlStr += app.getNetAddresss("plugin.warehouse.frontend.controllers.purchasing.order-detail"); } else if(this.data.orderType == "reserve_simple"){ urlStr += app.getNetAddresss("plugin.reserve-simple.frontend.reserve-order.get-detail"); } else if (this.data.orderType == "ysSystem") { urlStr += app.getNetAddresss("plugin.ys-system.frontend.history-order.ys-detail"); } else if (this.data.orderType == "debt"){ urlStr += app.getNetAddresss("plugin.debt-shop.frontend.order-detail.index"); urlStr += "&order_id=" + that.data.order_id; urlStr += "&member_type=" + that.data.debt_shop_member_type; } else { urlStr += app.getNetAddresss("order.detail"); } if (this.data.is_clerk) { urlStr += "&order_id=" + that.data.order_id; urlStr += "&is_clerk=" + that.data.is_clerk; } else if (this.data.orderType == "commission_activity") { urlStr += "&activity_id=" + that.data.order_id; } else { urlStr += "&order_id=" + that.data.order_id; } app._getNetWork({ url: urlStr, success: function (resdata) { var res = resdata.data; if (res.result == 1) { let myData = {}; let form = []; if (that.data.orderType == "groupsBuy" || that.data.orderType == "grabGroup") { myData = res.data.orderDetail; } else { myData = res.data; } if (myData.custom && that.data.is_clerk == 1) { form = myData.custom.form; } if(myData.reserve_date){ that.setData({ reserveDate:myData.reserve_date }); } that.setData({ order_data: myData, order_pay_id: myData.order_pay_id, dispatch_type_id: myData.dispatch_type_id, customForm: form, custom_receipt_confirmation_html:myData.receipt_goods_notice }); if(myData.aggregation_cps_recharge_bill && !app._isTextEmpty(myData.aggregation_cps_recharge_bill.recharge_number)){ that.setData({ aggregation_cps_recharge_bill:myData.aggregation_cps_recharge_bill.recharge_number }) } if(that.data.orderType == "zhpGroup"){ for(let i = 0 ;i { 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); }, }); }, onClose() { this.setData({ showQrcode: false, }); }, // 申请归还 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.getNetData(); } else { wx.showToast({ icon: "none", title: res.msg, duration: 1000, }); } }, fail: function (res) { console.log(res); }, }); }, //查看物流 checklogistics(item, btn) { //logistics 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, }); } }, //删除订单 deleteOrder(item, btn, orderidx) { let that = this; wx.showModal({ title: "提示", content: "确定删除此订单?", success(res) { if (res.confirm) { //删除当前选中的地址 that.sentRequest(btn.api, "&order_id=" + item.id, false); } }, }); }, //确认发货 sendGoogs(event) { if (!event || event.detail === "confirm") { let that = this; // if (that.data.expressName == '' && that.data.numberName == '') { // wx.showToast({ // icon: 'success', // title: '请选择快递公司和输入快递单号', // duration: 1000 // }) // return; // } else if (that.data.expressName == '') { // wx.showToast({ // icon: 'success', // title: '请选择快递公司', // duration: 1000 // }) // return; // } else if (that.data.numberName == '') { // wx.showToast({ // icon: 'success', // title: '请输入快递单号', // duration: 1000 // }) // return; // } 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; if (res.result == 1) { that.setData({ dialogVisible: false, }); that.getNetData(); that.triggerEvent("stoprefresh", false); that.triggerEvent("ConfrimOrderNotification", "pay"); wx.showToast({ icon: "success", title: "发货成功", duration: 1000, }); } }, fail: function (res) {}, }); } else if (this.data.orderType == "subsidiary"||this.data.orderType == "storeMang") { let urlStr = ""; urlStr = app.getNetAddresss("plugin.subsidiary.frontend.order.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.getNetData(); that.triggerEvent("stoprefresh", false); that.triggerEvent("ConfrimOrderNotification", "pay"); wx.showToast({ icon: "success", title: "发货成功", duration: 1000, }); } }, 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) { that.triggerEvent("ConfrimOrderNotification", "pay"); that.getNetData(); wx.showToast({ icon: "success", title: "发货成功", duration: 1000, }); that.setData({ dialogVisible: false, }); } }, fail: function (res) { console.log(res); }, }); } } else { this.setData({ dialogVisible: false, }); this.triggerEvent("stoprefresh", false); } }, //快递选择 seleRegional: function () { this.setData({ dateshow_1: true, }); }, onCancelbtn: function () { this.setData({ dateshow_1: false, }); }, onConfirmbtn: function (e) { let index = e.detail.index; let val = e.detail.value; let array = this.data.options; this.setData({ dateshow_1: false, regional: val, expressName: array[index], }); }, 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) { // 跳到评价订单 //comment order: item wx.navigateTo({ url: "/packageB/member/comment/comment?order=" + JSON.stringify(item ? item : {}), }); }, toPay(item, btn) { //status-2合并支付 type-1订单支付 wx.navigateTo({ url: "/packageD/buy/orderPay/orderPay?order_id=" + item.id + "&status=2" + "&api=" + btn.api, }); }, //获取模板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); }, }); }, //退款 _toRefund(item, btn) { console.log(btn.value); //refund if(this.data.order_data.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) { var that = this; wx.showModal({ title: "提示", content: "确定取消此订单?", success(res) { if (res.confirm) { //取消当前选中的地址 that.sentRequest(btn.api, "&order_id=" + item.id, false); } }, }); }, //确认收货 confirmOrder(item, btn) { 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:(res)=> { if (res.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) { app.tips(res.msg); if(item.is_boss){ // is_boss:true是店长,店长跳转门店订单列表页 wx.navigateTo({url: "/packageA/member/myOrder_v2/myOrder_v2?status=0&orderType=store"}); return } this.getNetData(); } else { app.tips(res.msg); } }, fail: function (res) { console.log(res); }, }); }, //退款中 toRefundDetail(item, btn) { //aftersales wx.navigateTo({ url: "/packageD/member/myOrder/Aftersales/Aftersales?refund_id=" + item.refund_id, }); }, 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.HxsentRequest(btn.api, "&order_id=" + item.id + "&order_pay_id=" + that.data.order_pay_id, false); } }, }); }, // 确认核销 HxsentRequest(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.reLaunch({ url: "/packageG/index/index", }); }, 1500); //延迟时间 }, }); } else { wx.showToast({ icon: "none", title: res.msg, duration: 1000, }); } }, fail: function (res) { console.log(res); }, }); }, //退还跳转 gotoRefund(val) { wx.navigateTo({ url: "/packageB/member/OrderReturn/OrderReturn?id=" + val, }); }, //退还跳转 gotoRefundCheck(val) { wx.navigateTo({ url: "/packageB/member/OrderReturnCheck/OrderReturnCheck?id=" + val, }); }, //待确定 gotoMakeSure(val) { wx.navigateTo({ url: "/packageB/member/OrderReturnSure/OrderReturnSure?id=" + val, }); }, //汇款记录 shopRecord(val) { wx.navigateTo({ url: "/packageB/member/OrderRecord/OrderRecord?order_id=" + val + "&order_state=" + this.data.order_data.status_name, }); }, //确认支付 payMoney(item, btn) { let that = this; wx.showModal({ title: "提示", content: "确认支付该订单?", success:(res) =>{ if (res.confirm) { let urlStr = ""; if (this.data.orderType == "supplier" || this.data.orderType == "subsidiary" || this.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) { wx.showToast({ title: "支付成功", icon: "success", 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); }, }); } }, }); }, //取消发货 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") { urlStr += app.getNetAddresss(btn.api); urlStr += "&order_id=" + order.id; } else { urlStr += app.getNetAddresss("plugin.store-cashier.frontend.store.center.order-operation.cancel-send"); urlStr += "&order_id=" + order.id; } app._getNetWork({ url: urlStr, success: function (resdata) { var res = resdata.data; if (res.result == 1) { that.getNetData(); wx.showToast({ title: "取消发货成功", icon: "success", 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); }, }); } }, }); }, //确认收货 collectGoods(order, btn) { let that = this; wx.showModal({ title: "提示", content: "确认收货?", success:(res)=> { if (res.confirm) { let urlStr = ""; if (this.data.orderType == "supplier" || this.data.orderType == "subsidiary" || this.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) { wx.showToast({ title: "收货成功", icon: "success", 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); }, }); } }, }); }, //关闭订单 closeOrderPay(order, btn) { let that = this; wx.showModal({ title: "提示", content: "确定关闭订单?", success:(res)=> { if (res.confirm) { let urlStr = ""; if (this.data.orderType == "supplier" || this.data.orderType == "subsidiary" || this.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; } app._getNetWork({ url: urlStr, success: function (resdata) { var res = resdata.data; if (res.result == 1) { wx.showToast({ title: "关闭订单成功", icon: "success", 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); }, }); } }, }); Dialog.confirm({ title: "标题", message: "确定关闭订单?", }) .then(() => { // on confirm }) .catch(() => { // on cancel }); }, // 评价 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, }); }, confirmHotelOrder() {}, numberNamebtn(e) { let val = e.detail.value; this.setData({ numberName: val.trim(), }); }, goToAdress() { let latitude = this.data.package_deliver.lat; let longitude = this.data.package_deliver.lng; let store_name = this.data.package_deliver.deliver_name || this.data.package_deliver.buyer_name; let point = app.BMapTransqqMap(parseFloat(longitude), parseFloat(latitude)); wx.openLocation({ latitude: point.lat, longitude: point.lng, scale: 18, name: store_name, }); }, // 评价,追评,查看评价按钮 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) } } }); }, // 确认已选择仓库申请仓库 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.getNetData(); } } }); }, });