order.js 18 KB

1
  1. require('../../common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/goods/lottery/grids/order"],{"506a":function(t,e,i){"use strict";(function(t){var s=i("4ea4");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=i("bcf5"),a=i("4818"),o=i("5c29"),r=i("f8b7"),d=(i("401c"),i("8e8a")),c=i("26cb"),u=s(i("5c3b")),l={components:{payment:function(){Promise.all([i.e("common/vendor"),i.e("components/payment/index")]).then(function(){return resolve(i("a3c7"))}.bind(null,i)).catch(i.oe)},couponListWindow:function(){Promise.all([i.e("common/vendor"),i.e("components/couponListWindow/index")]).then(function(){return resolve(i("3274"))}.bind(null,i)).catch(i.oe)},addressWindow:function(){i.e("components/addressWindow/index").then(function(){return resolve(i("a8a7"))}.bind(null,i)).catch(i.oe)},orderGoods:function(){Promise.all([i.e("common/vendor"),i.e("components/orderGoods/index")]).then(function(){return resolve(i("0dcd"))}.bind(null,i)).catch(i.oe)},home:function(){Promise.all([i.e("common/vendor"),i.e("components/home/index")]).then(function(){return resolve(i("377d"))}.bind(null,i)).catch(i.oe)},deliveryMethod:function(){i.e("pages/goods/components/deliveryMethod/index").then(function(){return resolve(i("f6e7"))}.bind(null,i)).catch(i.oe)}},mixins:[u.default],data:function(){return{giveData:{give_integral:0,give_coupon:[]},giveCartInfo:[],confirm:[],id:0,isaddress:!1,textareaStatus:!0,cartArr:[{name:"微信支付",icon:"icon-weixin2",value:"weixin",title:"使用微信快捷支付",payStatus:1},{name:"支付宝支付",icon:"icon-zhifubao",value:"alipay",title:"使用线上支付宝支付",payStatus:1},{name:"余额支付",icon:"icon-yuezhifu",value:"yue",title:"可用余额:",payStatus:1},{name:"线下支付",icon:"icon-yuezhifu1",value:"offline",title:"选择线下付款方式",payStatus:2}],formContent:"",payType:"weixin",openType:1,active:0,coupon:{coupon:!1,list:[],statusTile:"立即使用"},address:{address:!1},addressInfo:{},addressId:0,couponId:0,cartId:"",BargainId:0,combinationId:0,seckillId:0,discountId:0,userInfo:{},mark:"",couponTitle:"请选择",coupon_price:0,promotions_detail:[],integral_price:0,integral:0,ChangePrice:0,formIds:[],status:0,is_address:!1,toPay:!1,shippingType:0,system_store:{},storePostage:0,contacts:"",contactsTel:"",mydata:{},storeList:[],store_self_mention:0,store_func_status:!1,cartInfo:[],priceGroup:{},animated:!1,totalPrice:0,integralRatio:"0",pagesUrl:"",orderKey:"",offlinePostage:"",isAuto:!1,isShowAuth:!1,from:"",news:1,invTitle:"不开发票",special_invoice:!1,integral_ratio_status:1,header_type:"",invShow:!1,invList:[],invChecked:"",urlQuery:"",pay_close:!1,noCoupon:0,valid_count:0,discount_id:0,storeId:0,product_type:1,newImg:[],isDisplay:[],deliveryType:1,goodsType:0,product_id:0}},computed:(0,c.mapGetters)(["isLogin"]),onLoad:function(e){if(this.from="routine",!e.cartId)return this.$util.Tips({title:"请先抽奖"},{tab:3,url:1});this.cartId=e.cartId,this.luckRecordId=e.luckRecordId,t.setStorageSync("news",this.news),this.header_type=e.header_type||"1",this.textareaStatus=!0,this.isLogin&&0==this.toPay?this.getCheckShipping():(0,d.toLogin)()},onShow:function(){t.removeStorageSync("form_type_cart");var e=this;t.$on("handClick",(function(i){i&&(e.system_store=i.address,e.storeId=e.system_store.id,e.cartId=i.cartId,e.news=i.new,e.couponId=i.couponId,e.getConfirm()),t.$off("handClick")}))},methods:{authColse:function(t){this.isShowAuth=t},showMaoLocation:function(e){t.openLocation({latitude:Number(e.latitude),longitude:Number(e.longitude),name:e.name,address:"".concat(e.address,"-").concat(e.detailed_address),success:function(){}})},call:function(e){t.makePhoneCall({phoneNumber:e})},deliveryFun:function(t,e){this.deliveryType=t,this.$refs.deliveryMethod.module=!1,2==t?this.storeId=e.id:(3==t&&(this.storeId=e.id,2==this.isDisplay.length&&this.isDisplay.includes("2")&&this.isDisplay.includes("3")&&(this.getaddressInfo(),this.$nextTick((function(){this.$refs.addressWindow.getAddressList()})))),this.system_store=e),1==t||3==t?this.addressType(0,t):this.addressType(1,t)},onDelivery:function(){this.$refs.deliveryMethod.module=!0},storeFun:function(t){this.getList(1,t)},getCheckShipping:function(){var e=this,i={cartId:this.cartId,new:this.news};(0,n.checkShipping)(i).then((function(t){t.data.type.sort((function(t,e){return t-e})),e.deliveryType=t.data.type[0],e.isDisplay=t.data.type,e.isDisplay.includes("2")&&1==e.isDisplay.length||2==e.deliveryType||3==e.deliveryType&&e.storeId>0&&!e.system_store.name?(e.addressType(1,e.deliveryType),3==e.deliveryType&&(e.getaddressInfo(),e.$nextTick((function(){this.$refs.addressWindow.getAddressList()})))):(e.getaddressInfo(),e.getConfirm(),e.$nextTick((function(){this.$refs.addressWindow.getAddressList()})))})).catch((function(e){t.showToast({title:e,icon:"none"})}))},DelPic:function(t,e){this.confirm[t].value;this.confirm[t].value.splice(e,1),this.$set(this.confirm[t],"value",this.confirm[t].value)},uploadpic:function(t){var e=this;this.$util.uploadImageOne("upload/image",(function(i){e.newImg.push(i.data.url),e.$set(e.confirm[t],"value",e.newImg)}))},invCancel:function(){this.invChecked="",this.invTitle="不开发票",this.invShow=!1},invChange:function(t){this.invChecked=t,this.invShow=!1;var e=this.invList.find((function(e){return e.id===t})),i="";i+=1===e.header_type?"个人":"企业",i+=1===e.type?"普通":"专用",i+="发票",this.invTitle=i},invClose:function(){this.invShow=!1,this.getInvoiceList()},getInvoiceList:function(){var e=this;t.showLoading({title:"正在加载…"}),(0,a.invoiceList)().then((function(i){t.hideLoading(),e.invList=i.data.map((function(t){return t.id=t.id.toString(),t}));var s=e.invList.find((function(t){return t.id==e.invChecked}));if(s){var n="";n+=1===s.header_type?"个人":"企业",n+=1===s.type?"普通":"专用",n+="发票",e.invTitle=n}})).catch((function(e){t.showToast({title:e,icon:"none"})}))},onLoadFun:function(){this.getCheckShipping(),this.isShowAuth=!1},onChangeFun:function(t){var e=t,i=e.action||null,s=void 0!=e.value?e.value:null;i&&this[i]&&this[i](s)},payClose:function(){this.pay_close=!1},goPay:function(){this.$refs.payment.goPay(this.cartArr[2].number,"yue")},payCheck:function(t){this.payType=t,this.SubOrder()},payAddress:function(){t.navigateTo({url:"/pages/users/user_address/index?id="+this.id+"&new="+this.news+"&cartId="+this.cartId+"&pinkId="+this.pinkId+"&couponId="+this.couponId+"&delivery_type="+this.deliveryType+"&addressId="+this.addressId+"&store_id="+this.storeId+"&store_name="+this.system_store.name+"&product_id="+this.product_id})},getList:function(e,i){var s=this,n=t.getStorageSync("user_longitude"),a=t.getStorageSync("user_latitude"),o={latitude:a,longitude:n,page:1,limit:100,product_id:this.product_id,is_store:i};(0,r.storeListApi)(o).then((function(t){var i=t.data.list.list||[];s.$set(s,"storeList",i),s.$set(s,"storeId",s.storeId?s.storeId:i[0].id),i.forEach((function(t){s.storeId==t.id&&s.$set(s,"system_store",t)})),1!=e&&s.getConfirm()})).catch((function(t){}))},changeClose:function(){this.$set(this.address,"address",!1)},showStoreList:function(){this.storeList.length>0&&t.navigateTo({url:"/pages/store/store_list/index?type=1&cartId=".concat(this.cartId,"&new=").concat(this.news,"&pinkId=").concat(this.pinkId,"&couponId=").concat(this.couponId)})},changePayType:function(t){this.payType=t},addressType:function(t,e){var i=t;this.shippingType=parseInt(i),1==i?this.getList(0,e):this.getConfirm()},bindPickerChange:function(t){var e=t.detail.value;this.shippingType=e},ChangCouponsClone:function(){this.$set(this.coupon,"coupon",!1)},changeTextareaStatus:function(){for(var t=0,e=this.coupon.list.length;t<e;t++)this.coupon.list[t].use_title="",this.coupon.list[t].is_use=0;this.textareaStatus=!0,this.status=0,this.$set(this.coupon,"list",this.coupon.list)},ChangCoupons:function(t){for(var e=t,i=this.coupon.list,s="请选择",n=0,a=0,o=i.length;a<o;a++)a!=e&&(i[a].use_title="",i[a].is_use=0);i[e].is_use?(i[e].use_title="",i[e].is_use=0):(i[e].use_title="不使用",i[e].is_use=1,s=i[e].coupon_title,n=i[e].id),this.couponTitle=s,this.couponId=n,this.$set(this.coupon,"coupon",!1),this.$set(this.coupon,"list",i),this.getConfirm(1)},ChangeIntegral:function(){this.useIntegral=!this.useIntegral},OnChangeAddress:function(t){this.textareaStatus=!0,this.addressId=t,this.address.address=!1,this.getConfirm(),this.getaddressInfo()},bindHideKeyboard:function(t){this.mark=t.detail.value},getConfirm:function(t){var e,i=this,s=this,a=parseInt(this.shippingType)+1,o=0;1==a?(o=s.addressId,e=1==this.deliveryType?0:s.storeId):(o="",e=s.storeId),(0,n.orderConfirm)(s.cartId,s.news,o,a,e,s.couponId,s.luckRecordId).then((function(e){1==e.data.upgrade_addr&&(s.id=e.data.addressInfo.id,i.isaddress=!0),1!=t&&s.$set(s,"confirm",e.data.custom_form),s.$set(s,"goodsType",e.data.type),s.$set(s,"userInfo",e.data.userInfo),s.$set(s,"integral",e.data.userInfo.integral),s.$set(s,"contacts",e.data.userInfo.real_name),s.$set(s,"contactsTel",e.data.userInfo.record_phone||""),s.$set(s,"integralRatio",e.data.integralRatio),s.$set(s,"offlinePostage",e.data.offlinePostage),s.$set(s,"orderKey",e.data.orderKey),s.$set(s,"valid_count",e.data.valid_count),s.$set(s,"discount_id",e.data.discount_id),s.$set(s,"priceGroup",e.data.priceGroup),s.$set(s,"seckillId",parseInt(e.data.seckill_id)),s.$set(s,"BargainId",parseInt(e.data.bargain_id)),s.$set(s,"combinationId",parseInt(e.data.combination_id)),s.$set(s,"discountId",parseInt(e.data.discount_id)),s.$set(s,"special_invoice",e.data.special_invoice),s.$set(s,"integral_ratio_status",e.data.integral_ratio_status),s.$set(s,"store_self_mention",e.data.store_self_mention),s.$set(s,"store_func_status",e.data.store_func_status),s.giveData.give_integral=e.data.give_integral,s.giveData.give_coupon=e.data.give_coupon;var n=e.data.cartInfo,a=[],o=[];n.forEach((function(t){1==t.is_gift?o.push(t):a.push(t)})),s.$set(s,"cartInfo",a),s.$set(s,"giveCartInfo",o);var r=-1;o.forEach((function(t){if(0==t.product_type)return r=0})),s.$set(s,"product_type",0==e.data.product_type||0==r?0:1),s.cartArr[0].payStatus=e.data.pay_weixin_open||0,s.cartArr[1].payStatus=e.data.ali_pay_status||0,s.cartArr[1].payStatus=0,s.cartArr[2].number=e.data.userInfo.now_money,s.cartArr[2].payStatus=1==e.data.yue_pay_status?e.data.yue_pay_status:0,2==e.data.offline_pay_status?s.cartArr[3].payStatus=0:s.cartArr[3].payStatus=1,s.getBargainId(),i.addressId||i.couponId})).catch((function(t){return i.$util.Tips({title:t})}))},getBargainId:function(){3==this.cartArr.length&&(this.BargainId||this.combinationId||this.seckillId||this.discountId)&&(this.cartArr[2].payStatus=0,this.$set(this,"cartArr",this.cartArr))},getaddressInfo:function(){var t=this;t.addressId?(0,a.getAddressDetail)(t.addressId).then((function(e){e.data.is_default=parseInt(e.data.is_default),t.addressInfo=e.data||{},t.addressId=e.data.id||0,t.address.addressId=e.data.id||0})):(0,a.getAddressDefault)().then((function(e){e.data.is_default=parseInt(e.data.is_default),t.addressInfo=e.data||{},t.addressId=e.data.id||0,t.address.addressId=e.data.id||0}))},payItem:function(t){var e=this,i=t;e.active=i,e.animated=!0,e.payType=e.cartArr[i].value,setTimeout((function(){e.car()}),500)},couponTap:function(){var t=this;this.coupon.coupon=!0,this.coupon.list.forEach((function(e,i){e.id==t.couponId?e.is_use=1:e.is_use=0})),this.$set(this.coupon,"list",this.coupon.list)},car:function(){this.animated=!1},onAddress:function(e){e?(this.textareaStatus=!1,this.address.address=!0,this.pagesUrl="/pages/users/user_address_list/index?news="+this.news+"&cartId="+this.cartId+"&pinkId="+this.pinkId+"&couponId="+this.couponId+"&delivery_type="+this.deliveryType+"&addressId="+this.addressId+"&store_id="+this.storeId+"&store_name="+this.system_store.name+"&product_id="+this.product_id):t.navigateTo({url:"/pages/users/user_address/index?new="+this.news+"&cartId="+this.cartId+"&pinkId="+this.pinkId+"&couponId="+this.couponId+"&delivery_type="+this.deliveryType+"&addressId="+this.addressId+"&store_id="+this.storeId+"&store_name="+this.system_store.name+"&product_id="+this.product_id})},payment:function(e){var i=this,s=this;(0,n.orderCreate)(s.orderKey,e).then((function(e){var n=e.data.status,a=e.data.result.orderId,o=e.data.result.jsConfig,r="/pages/goods/order_pay_status/index?order_id="+a+"&msg="+e.msg+"&type=3&totalPrice="+i.totalPrice;switch(n){case"ORDER_EXIST":case"EXTEND_ORDER":case"PAY_ERROR":return t.hideLoading(),s.$util.Tips({title:e.msg},{tab:5,url:r});case"SUCCESS":return t.hideLoading(),s.BargainId||s.combinationId||s.pinkId||s.seckillId||s.discountId?s.$util.Tips({title:e.msg,icon:"success"},{tab:4,url:r}):s.$util.Tips({title:e.msg,icon:"success"},{tab:5,url:r});case"WECHAT_PAY":s.toPay=!0;var d="";d=t.requestOrderPayment?"requestOrderPayment":"requestPayment",t[d]({timeStamp:o.timestamp,nonceStr:o.nonceStr,package:o.package,signType:o.signType,paySign:o.paySign,success:function(e){return t.hideLoading(),s.BargainId||s.combinationId||s.pinkId||s.seckillId||s.discountId?s.$util.Tips({title:"支付成功",icon:"success"},{tab:4,url:r}):s.$util.Tips({title:"支付成功",icon:"success"},{tab:5,url:r})},fail:function(e){return t.hideLoading(),s.$util.Tips({title:"取消支付"},{tab:5,url:r+"&status=2"})},complete:function(i){if(t.hideLoading(),"requestPayment:cancel"==e.errMsg)return s.$util.Tips({title:"取消支付"},{tab:5,url:r+"&status=2"})}});break;case"PAY_DEFICIENCY":return t.hideLoading(),s.$util.Tips({title:e.msg},{tab:5,url:r+"&status=1"});case"WECHAT_H5_PAY":t.hideLoading(),s.$util.Tips({title:"订单创建成功!"},{tab:4,url:r+"&status=0"}),setTimeout((function(){location.href=e.data.result.jsConfig.mweb_url}),2e3);break;case"ALIPAY_PAY":t.navigateTo({url:"/pages/users/alipay_invoke/index?id=".concat(a,"&link=").concat(o.qrCode)});break}})).catch((function(e){return t.hideLoading(),s.$util.Tips({title:e})}))},clickTextArea:function(){this.$refs.textarea.focus()},bindDateChange:function(t,e){this.confirm[e].value=t.target.value},bindTimeChange:function(t,e){this.confirm[e].value=t.target.value},SubOrder:function(e){var i,s=this;if(!s.payType)return s.$util.Tips({title:"请选择支付方式"});if(!s.addressId&&!s.shippingType&&!s.product_type)return s.$util.Tips({title:"请选择收货地址"});if(1==s.shippingType){if(""==s.contacts||""==s.contactsTel)return s.$util.Tips({title:"请填写联系人或联系人电话"});if(!/^1(3|4|5|7|8|9|6)\d{9}$/.test(s.contactsTel))return s.$util.Tips({title:"请填写正确的手机号"});if(!/^[\u4e00-\u9fa5\w]{2,16}$/.test(s.contacts))return s.$util.Tips({title:"请填写您的真实姓名"});if(0==s.storeList.length)return s.$util.Tips({title:"暂无门店,请选择其他方式"})}for(var n=0;n<s.confirm.length;n++){var a=s.confirm[n];if(a.status||"img"!==a.label&&a.value&&a.value.trim()){if(("text"===a.label||"data"===a.label||"time"===a.label)&&(!a.value||a.value&&!a.value.trim()))return s.$util.Tips({title:"请填写".concat(a.title)});if("number"===a.label&&a.value<=0)return s.$util.Tips({title:"请填写大于0的".concat(a.title)});if("email"===a.label&&!/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(a.value))return s.$util.Tips({title:"请填写正确的".concat(a.title)});if("phone"===a.label&&!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(a.value))return s.$util.Tips({title:"请填写正确的".concat(a.title)});if("id"===a.label&&!/^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/i.test(a.value))return s.$util.Tips({title:"请填写正确的".concat(a.title)});if("img"===a.label&&!a.value.length)return s.$util.Tips({title:"请上传".concat(a.title)})}}if(i={custom_form:s.confirm,real_name:s.contacts,phone:s.contactsTel,addressId:s.addressId,formId:"",couponId:0==s.priceGroup.couponPrice?0:s.couponId,payType:s.payType,useIntegral:s.useIntegral,bargainId:s.BargainId,combinationId:s.combinationId,discountId:s.discountId,pinkId:s.pinkId,seckill_id:s.seckillId,mark:s.mark,store_id:1==s.deliveryType?0:s.system_store.id||0,from:s.from,shipping_type:s.$util.$h.Add(s.shippingType,1),new:s.news,invoice_id:s.invChecked},"yue"==i.payType&&parseFloat(s.userInfo.now_money)<parseFloat(s.totalPrice))return s.$util.Tips({title:"余额不足!"});t.showLoading({title:"订单支付中"}),(0,o.openPaySubscribe)().then((function(){s.payment(i)}))}}};e.default=l}).call(this,i("543d")["default"])},"57b4":function(t,e,i){"use strict";i.r(e);var s=i("506a"),n=i.n(s);for(var a in s)["default"].indexOf(a)<0&&function(t){i.d(e,t,(function(){return s[t]}))}(a);e["default"]=n.a},"62db":function(t,e,i){"use strict";i.r(e);var s=i("84c0"),n=i("57b4");for(var a in n)["default"].indexOf(a)<0&&function(t){i.d(e,t,(function(){return n[t]}))}(a);i("8dfc");var o=i("f0c5"),r=Object(o["a"])(n["default"],s["b"],s["c"],!1,null,"1e4f6e51",null,!1,s["a"],void 0);e["default"]=r.exports},"84c0":function(t,e,i){"use strict";i.d(e,"b",(function(){return s})),i.d(e,"c",(function(){return n})),i.d(e,"a",(function(){}));var s=function(){var t=this,e=t.$createElement,i=(t._self._c,0==t.product_type?(t.isDisplay.length>1||1==t.isDisplay.length&&1!=t.deliveryType)&&t.store_func_status:null),s=0==t.product_type&&1!=t.deliveryType&&3!=t.deliveryType?t.storeList.length:null,n=0==t.product_type&&1!=t.deliveryType&&3!=t.deliveryType?t.storeList.length:null,a=t.confirm.length,o=a?t.__map(t.confirm,(function(e,i){var s=t.__get_orig(e),n="img"==e.label?e.value.length:null;return{$orig:s,g4:n}})):null,r=t.valid_count>0&&!t.discount_id||t.valid_count==t.cartInfo.length&&t.discount_id||2==t.deliveryType&&!t.shippingType||3==t.deliveryType&&t.shippingType||0!=t.product_type,d=t.totalPrice.toString();t.$mp.data=Object.assign({},{$root:{g0:i,g1:s,g2:n,g3:a,l0:o,g5:r,g6:d}})},n=[]},"8dfc":function(t,e,i){"use strict";var s=i("cba2"),n=i.n(s);n.a},a455:function(t,e,i){"use strict";(function(t,e){var s=i("4ea4");i("59a4");s(i("66fd"));var n=s(i("62db"));t.__webpack_require_UNI_MP_PLUGIN__=i,e(n.default)}).call(this,i("bc2e")["default"],i("543d")["createPage"])},cba2:function(t,e,i){}},[["a455","common/runtime","common/vendor"]]]);