integral_order.js 17 KB

1
  1. require('./common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/points_mall/integral_order"],{"04cf":function(t,e,a){},"2c2b":function(t,e,a){"use strict";var i=a("04cf"),n=a.n(i);n.a},"7c77":function(t,e,a){"use strict";a.d(e,"b",(function(){return n})),a.d(e,"c",(function(){return s})),a.d(e,"a",(function(){return i}));var i={uniDatetimePicker:function(){return Promise.all([a.e("common/vendor"),a.e("uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker")]).then(a.bind(null,"2f2d"))}},n=function(){var t=this,e=t.$createElement,a=(t._self._c,t.cartInfo.attrInfo?parseFloat(t.cartInfo.attrInfo.integral):null),i=t.cartInfo.attrInfo?parseFloat(t.cartInfo.attrInfo.integral)&&parseFloat(t.cartInfo.attrInfo.price):null,n=t.cartInfo.attrInfo?parseFloat(t.cartInfo.attrInfo.price):null,s=t.cartInfo.attrInfo?null:parseFloat(t.cartInfo.integral),o=t.cartInfo.attrInfo?null:parseFloat(t.cartInfo.integral)&&parseFloat(t.cartInfo.price),r=t.cartInfo.attrInfo?null:parseFloat(t.cartInfo.price),u=t.confirm.length,l=u?t.__map(t.confirm,(function(e,a){var i=t.__get_orig(e),n="dateranges"==e.name?e.value.length:null,s="uploadPicture"==e.name?e.value.length:null;return{$orig:i,g1:n,g2:s}})):null,c=parseFloat(t.resData.total_integral),d=parseFloat(t.resData.total_integral)&&parseFloat(t.resData.total_price),f=parseFloat(t.resData.total_price),p=t.totalPrice.toString();t.$mp.data=Object.assign({},{$root:{m0:a,m1:i,m2:n,m3:s,m4:o,m5:r,g0:u,l0:l,m6:c,m7:d,m8:f,g3:p}})},s=[]},"957d":function(t,e,a){"use strict";(function(t){var i=a("4ea4");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=i(a("448a")),s=i(a("6fc6")),o=a("5c29"),r=a("74b1"),u=a("4818"),l=(a("f8b7"),a("401c"),a("8e8a")),c=a("26cb"),d=i(a("5c3b")),f={},p={components:{payment:function(){Promise.all([a.e("common/vendor"),a.e("components/payment/index")]).then(function(){return resolve(a("a3c7"))}.bind(null,a)).catch(a.oe)},couponListWindow:function(){Promise.all([a.e("common/vendor"),a.e("components/couponListWindow/index")]).then(function(){return resolve(a("3274"))}.bind(null,a)).catch(a.oe)},addressWindow:function(){a.e("components/addressWindow/index").then(function(){return resolve(a("a8a7"))}.bind(null,a)).catch(a.oe)},orderGoods:function(){Promise.all([a.e("common/vendor"),a.e("components/orderGoods/index")]).then(function(){return resolve(a("0dcd"))}.bind(null,a)).catch(a.oe)},home:function(){Promise.all([a.e("common/vendor"),a.e("components/home/index")]).then(function(){return resolve(a("377d"))}.bind(null,a)).catch(a.oe)},timeranges:function(){a.e("components/timeranges/index").then(function(){return resolve(a("655e"))}.bind(null,a)).catch(a.oe)},areaWindow:function(){Promise.all([a.e("common/vendor"),a.e("components/areaWindow/index")]).then(function(){return resolve(a("1b9e"))}.bind(null,a)).catch(a.oe)}},mixins:[d.default],data:function(){return{addressInfoArea:[],cityShow:2,display:!1,timeranges:[],isShow:!1,confirm:[],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}],formContent:"",payType:"weixin",openType:1,active:0,coupon:{coupon:!1,list:[],statusTile:"立即使用"},address:{address:!1},addressInfo:{},pinkId:0,addressId:0,couponId:0,cartId:"",BargainId:0,combinationId:0,seckillId:0,userInfo:{},mark:"",couponTitle:"请选择",coupon_price:0,useIntegral:!1,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,cartInfo:{},priceGroup:{},animated:!1,totalPrice:0,integralRatio:"0",pagesUrl:"",orderKey:"",offlinePostage:"",isAuto:!1,isShowAuth:!1,from:"",news:1,invTitle:"不开发票",special_invoice:!1,invoice_func:!1,header_type:"",invShow:!1,invList:[],invChecked:"",urlQuery:"",pay_close:!1,resData:{},product_type:1,newImg:[],selectIndex:0,timerangesIndex:0}},computed:(0,c.mapGetters)(["isLogin"]),onLoad:function(t){if(this.from="routine",!t.unique)return this.$util.Tips({title:"请选择要购买的商品"},{tab:3,url:1});this.unique=t.unique,this.num=t.num,this.couponId=t.couponId||0,this.pinkId=t.pinkId?parseInt(t.pinkId):0,this.addressId=t.addressId||0,this.cartId=t.cartId,this.is_address=!!t.is_address,this.news=t.new&&"0"!==t.new?1:0,this.invChecked=t.invoice_id||"",this.header_type=t.header_type||"1",this.couponTitle=t.couponTitle||"请选择",this.textareaStatus=!0,this.isLogin&&0==this.toPay?this.getFun():(0,l.toLogin)()},onShow:function(){t.removeStorageSync("form_type_cart");var e=this;t.$on("handClick",(function(a){a&&(e.system_store=a.address),t.$off("handClick")}));var a=(0,s.default)(new Date(Number((new Date).getTime()))).format("HH:mm").split(":"),i=a;i.push(0);var o=[];[].concat((0,n.default)(i),(0,n.default)(a)).forEach((function(t){o.push(Number(t))})),this.timeranges=o},methods:{OnAreaAddress:function(t){var e="";e=4==t.length?t[0].label+"/"+t[1].label+"/"+t[2].label+"/"+t[3].label:3==t.length?t[0].label+"/"+t[1].label+"/"+t[2].label:2==t.length?t[0].label+"/"+t[1].label:t[0].label,this.confirm[this.timerangesIndex].value=e,f[this.timerangesIndex]=t},changeRegion:function(t){this.confirm[t].value||(this.addressInfoArea=[]),this.timerangesIndex=t,this.cityShow=Number(this.confirm[t].valConfig.tabVal)+1,this.display=!0,f[t]&&(this.addressInfoArea=f[t])},changeAddressClose:function(){this.display=!1},maskClick:function(t){},getFun:function(){this.getaddressInfo(),this.getConfirm(),this.$nextTick((function(){this.$refs.addressWindow.getAddressList()}))},onLoadFun:function(){this.getFun(),this.isShowAuth=!1},authColse:function(t){this.isShowAuth=t},jumpCon:function(e){t.navigateTo({url:"/pages/goods_details/index?id=".concat(e)})},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(a){e.newImg.push(a.data.url),e.$set(e.confirm[t],"value",e.newImg)}))},getInvoiceList:function(){var e=this;t.showLoading({title:"正在加载…"}),(0,u.invoiceList)().then((function(a){t.hideLoading(),e.invList=a.data.map((function(t){return t.id=t.id.toString(),t}));var i=e.invList.find((function(t){return t.id==e.invChecked}));if(i){var n="";n+=1===i.header_type?"个人":"企业",n+=1===i.type?"普通":"专用",n+="发票",e.invTitle=n}})).catch((function(e){t.showToast({title:e,icon:"none"})}))},onChangeFun:function(t){var e=t,a=e.action||null,i=void 0!=e.value?e.value:null;a&&this[a]&&this[a](i)},payClose:function(){this.pay_close=!1},payCheck:function(t){this.payType=t,this.SubOrder()},goPay:function(){return this.addressId||this.product_type?parseFloat(this.resData.integral)<parseFloat(this.resData.total_integral)?this.$util.Tips({title:"积分不足!"}):(parseFloat(this.resData.total_price)&&(this.pay_close=!0),void(parseFloat(this.resData.total_price)||this.SubOrder())):this.$util.Tips({title:"请选择收货地址"})},SubOrder:function(){var e=this;if(parseFloat(this.resData.total_price)&&!e.payType)return e.$util.Tips({title:"请选择支付方式"});for(var a=0;a<e.confirm.length;a++){var i=e.confirm[a];if(-1==["radios"].indexOf(i.name)&&(i.titleShow.val||-1==["uploadPicture","dateranges"].indexOf(i.name)&&i.value&&i.value.trim())){if(("texts"===i.name&&0==i.valConfig.tabVal||-1!=["dates","times","selects","citys","checkboxs"].indexOf(i.name))&&(!i.value||i.value&&!i.value.trim()))return e.$util.Tips({title:"请填写".concat(i.titleConfig.value)});if("timeranges"===i.name&&!i.value)return e.$util.Tips({title:"请选择".concat(i.titleConfig.value)});if("dateranges"===i.name&&!i.value.length)return e.$util.Tips({title:"请选择".concat(i.titleConfig.value)});if("texts"===i.name&&4==i.valConfig.tabVal&&i.value<=0)return e.$util.Tips({title:"请填写大于0的".concat(i.titleConfig.value)});if("texts"===i.name&&3==i.valConfig.tabVal&&!/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(i.value))return e.$util.Tips({title:"请填写正确的".concat(i.titleConfig.value)});if("texts"===i.name&&1==i.valConfig.tabVal&&!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(i.value))return e.$util.Tips({title:"请填写正确的".concat(i.titleConfig.value)});if("texts"===i.name&&2==i.valConfig.tabVal&&!/^[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(i.value))return e.$util.Tips({title:"请填写正确的".concat(i.titleConfig.value)});if("uploadPicture"===i.name&&!i.value.length)return e.$util.Tips({title:"请上传".concat(i.titleConfig.value)})}}var n={custom_form:e.confirm,addressId:e.addressId,mark:e.mark,unique:this.cartInfo.unique,num:this.resData.num,from:e.from,payType:e.payType};if(parseFloat(this.resData.total_price)){if("yue"==n.payType&&parseFloat(e.resData.now_money)<parseFloat(e.totalPrice))return e.$util.Tips({title:"余额不足!"});t.showLoading({title:"订单支付中"}),(0,o.openPaySubscribe)().then((function(){e.payment(n)}))}else(0,r.integralOrderCreate)(n).then((function(e){t.redirectTo({url:"/pages/points_mall/integral_order_status?order_id=".concat(e.data.result.orderId)})})).catch((function(a){return t.hideLoading(),e.$util.Tips({title:a})}))},payment:function(e){var a=this;(0,r.integralOrderCreate)(e).then((function(e){var i=e.data.status,n=e.data.result.orderId,s=e.data.result.jsConfig,o="/pages/points_mall/integral_order_status?order_id="+n;switch(i){case"ORDER_EXIST":case"EXTEND_ORDER":case"PAY_ERROR":return t.hideLoading(),a.$util.Tips({title:e.msg},{tab:5,url:o});case"SUCCESS":return t.hideLoading(),a.BargainId||a.combinationId||a.pinkId||a.seckillId||a.discountId?a.$util.Tips({title:e.msg,icon:"success"},{tab:4,url:o}):a.$util.Tips({title:e.msg,icon:"success"},{tab:5,url:o});case"WECHAT_PAY":a.toPay=!0,t.requestPayment({timeStamp:s.timestamp,nonceStr:s.nonceStr,package:s.package,signType:s.signType,paySign:s.paySign,success:function(e){return t.hideLoading(),a.BargainId||a.combinationId||a.pinkId||a.seckillId||a.discountId?a.$util.Tips({title:"支付成功",icon:"success"},{tab:4,url:o}):a.$util.Tips({title:"支付成功",icon:"success"},{tab:5,url:o})},fail:function(e){return t.hideLoading(),a.$util.Tips({title:"取消支付"},{tab:5,url:o+"&status=2"})},complete:function(i){if(t.hideLoading(),"requestPayment:cancel"==e.errMsg)return a.$util.Tips({title:"取消支付"},{tab:5,url:o+"&status=2"})}});break;case"PAY_DEFICIENCY":return t.hideLoading(),a.$util.Tips({title:e.msg},{tab:5,url:o+"&status=1"});case"WECHAT_H5_PAY":t.hideLoading(),a.$util.Tips({title:"订单创建成功!"},{tab:4,url:o+"&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(n,"&link=").concat(s.qrCode)});break}})).catch((function(e){return t.hideLoading(),a.$util.Tips({title:e})}))},changeClose:function(){this.$set(this.address,"address",!1)},changePayType:function(t){this.payType=t},computedPrice:function(){var t=this,e=this.shippingType;postOrderComputed(this.orderKey,{addressId:this.addressId,useIntegral:this.useIntegral?1:0,couponId:this.couponId,shipping_type:parseInt(e)+1,payType:this.payType}).then((function(a){var i=a.data.result;i&&(t.totalPrice=i.pay_price,t.integral_price=i.deduction_price,t.coupon_price=i.coupon_price,t.integral=t.useIntegral?i.SurplusIntegral:t.userInfo.integral,t.$set(t.priceGroup,"storePostage",1==e?0:i.pay_postage),t.$set(t.priceGroup,"storePostageDiscount",i.storePostageDiscount))}))},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)},OnChangeAddress:function(t){this.textareaStatus=!0,this.addressId=t,this.address.address=!1,this.getaddressInfo()},bindHideKeyboard:function(t){this.mark=t.detail.value},objToArr:function(t){var e=Object.keys(t),a=e.map((function(e){return t[e]}));return a},getConfirm:function(){var t=this,e=this;(0,r.integralOrderConfirm)({unique:this.unique,num:this.num}).then((function(a){var i=t.objToArr(a.data.custom_form);i.forEach((function(t,e,a){if(f[e]="","texts"==t.name)t.defaultValConfig.value?t.value=t.defaultValConfig.value:t.value="";else if("radios"==t.name)t.value=t.wordsConfig.list[0].val;else if("uploadPicture"==t.name)t.value=[];else if("dateranges"==t.name)if(0==t.valConfig.tabVal)if(0==t.valConfig.tabData){var i=(0,s.default)(new Date(Number((new Date).getTime()))).format("YYYY-MM-DD");t.value=[i,i]}else{var n=(0,s.default)(new Date(Number(new Date(t.valConfig.specifyDate[0]).getTime()))).format("YYYY-MM-DD"),o=(0,s.default)(new Date(Number(new Date(t.valConfig.specifyDate[1]).getTime()))).format("YYYY-MM-DD");t.value=[n,o]}else t.value=[];else if(-1!=["times","dates","timeranges"].indexOf(t.name))if(0==t.valConfig.tabVal)if(0==t.valConfig.tabData)if("times"==t.name)t.value=(0,s.default)(new Date(Number((new Date).getTime()))).format("HH:mm");else if("dates"==t.name)t.value=(0,s.default)(new Date(Number((new Date).getTime()))).format("YYYY-MM-DD");else{var r=(0,s.default)(new Date(Number((new Date).getTime()))).format("HH:mm");t.value=r+" - "+r}else"times"==t.name||"dates"==t.name?t.value=t.valConfig.specifyDate:t.value=t.valConfig.specifyDate[0]+" - "+t.valConfig.specifyDate[1];else t.value="";else t.value=""})),i.sort((function(t,e){return t.timestamp-e.timestamp})),e.$set(e,"confirm",i);var n=parseInt(a.data.productInfo.product_type);e.$set(e,"product_type",0==n||4==n?0:1),e.$set(e,"resData",a.data),e.$set(e,"cartInfo",a.data.productInfo),e.$set(e,"totalPrice",a.data.total_price),e.cartArr[0].payStatus=a.data.pay_weixin_open||0,e.cartArr[1].payStatus=a.data.ali_pay_status||0,e.cartArr[1].payStatus=0,e.cartArr[2].number=a.data.now_money,e.cartArr[2].payStatus=1==a.data.yue_pay_status?a.data.yue_pay_status:0,a.data.offline_pay_status&&(2==a.data.offline_pay_status?e.cartArr[3].payStatus=0:e.cartArr[3].payStatus=1)})).catch((function(e){return t.$util.Tips({title:e})}))},bindDateChange:function(t,e){this.confirm[e].value=t.target.value},bindTimeChange:function(t,e){this.confirm[e].value=t.target.value},bindSelectChange:function(t,e,a){this.confirm[e].value=a.wordsConfig.list[t.detail.value].val},getTimeranges:function(t){this.isShow=!0,this.timerangesIndex=t},confrim:function(t){this.isShow=!1,this.confirm[this.timerangesIndex].value=t.time;var e=[];t.val.forEach((function(t){e.push(Number(t))})),this.timeranges=e},cancels:function(){this.isShow=!1},radioChange:function(t,e,a){this.confirm[e].value=a.wordsConfig.list[t.detail.value].val},checkboxChange:function(t,e,a){var i=t.detail.value,n="";a.wordsConfig.list.forEach((function(t,e){i.forEach((function(a){e==a&&(n=n+(n?",":"")+t.val)}))})),this.confirm[e].value=n},getBargainId:function(){var t=this.cartInfo,e=0,a=0;t.forEach((function(t,i,n){e=n[i].bargain_id,a=n[i].combination_id})),this.$set(this,"BargainId",parseInt(e)),this.$set(this,"combinationId",parseInt(a)),3==this.cartArr.length&&(e||a||this.seckillId)&&(this.cartArr[2].payStatus=0,this.$set(this,"cartArr",this.cartArr))},getaddressInfo:function(){var t=this;t.addressId?(0,u.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,u.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}))},couponTap:function(){var t=this;this.coupon.coupon=!0,this.coupon.list.forEach((function(e,a){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(){this.textareaStatus=!1,this.address.address=!0,this.pagesUrl="/pages/points_mall/user_address?unique=".concat(this.unique,"&num=").concat(this.num)},clickTextArea:function(){var t=this;this.$nextTick((function(){t.$refs.getFocus.focus()}))}}};e.default=p}).call(this,a("543d")["default"])},a8dc:function(t,e,a){"use strict";(function(t,e){var i=a("4ea4");a("59a4");i(a("66fd"));var n=i(a("daa8"));t.__webpack_require_UNI_MP_PLUGIN__=a,e(n.default)}).call(this,a("bc2e")["default"],a("543d")["createPage"])},c4e7:function(t,e,a){"use strict";a.r(e);var i=a("957d"),n=a.n(i);for(var s in i)["default"].indexOf(s)<0&&function(t){a.d(e,t,(function(){return i[t]}))}(s);e["default"]=n.a},daa8:function(t,e,a){"use strict";a.r(e);var i=a("7c77"),n=a("c4e7");for(var s in n)["default"].indexOf(s)<0&&function(t){a.d(e,t,(function(){return n[t]}))}(s);a("2c2b");var o=a("f0c5"),r=Object(o["a"])(n["default"],i["b"],i["c"],!1,null,"2f5489c4",null,!1,i["a"],void 0);e["default"]=r.exports}},[["a8dc","common/runtime","common/vendor"]]]);