1 |
- (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["plugins/region/index/index"],{"31da":function(e,i,t){},3560:function(e,i,t){"use strict";(function(e){t("2d0a");o(t("66fd"));var i=o(t("c644"));function o(e){return e&&e.__esModule?e:{default:e}}e(i.default)}).call(this,t("543d")["createPage"])},"430c":function(e,i,t){"use strict";t.r(i);var o=t("dfa6"),n=t.n(o);for(var s in o)"default"!==s&&function(e){t.d(i,e,(function(){return o[e]}))}(s);i["default"]=n.a},"5a9e":function(e,i,t){"use strict";var o;t.d(i,"b",(function(){return n})),t.d(i,"c",(function(){return s})),t.d(i,"a",(function(){return o}));var n=function(){var e=this,i=e.$createElement;e._self._c;e._isMounted||(e.e0=function(i){e.protocol=null,e.read=!0})},s=[]},"786e":function(e,i,t){"use strict";var o=t("31da"),n=t.n(o);n.a},c644:function(e,i,t){"use strict";t.r(i);var o=t("5a9e"),n=t("430c");for(var s in n)"default"!==s&&function(e){t.d(i,e,(function(){return n[e]}))}(s);t("786e");var a,c=t("f0c5"),h=Object(c["a"])(n["default"],o["b"],o["c"],!1,null,"17baade8",null,!1,o["a"],a);i["default"]=h.exports},dfa6:function(e,i,t){"use strict";(function(e){Object.defineProperty(i,"__esModule",{value:!0}),i.default=void 0;var o=t("2f62");function n(e,i){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);i&&(o=o.filter((function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable}))),t.push.apply(t,o)}return t}function s(e){for(var i=1;i<arguments.length;i++){var t=null!=arguments[i]?arguments[i]:{};i%2?n(Object(t),!0).forEach((function(i){a(e,i,t[i])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):n(Object(t)).forEach((function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))}))}return e}function a(e,i,t){return i in e?Object.defineProperty(e,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[i]=t,e}var c=function(){t.e("plugins/region/components/app-index/app-index").then(function(){return resolve(t("23ee"))}.bind(null,t)).catch(t.oe)},h=function(){t.e("plugins/region/components/app-condition/app-condition").then(function(){return resolve(t("f248"))}.bind(null,t)).catch(t.oe)},l=function(){Promise.all([t.e("common/vendor"),t.e("components/basic-component/app-rich/parse")]).then(function(){return resolve(t("4851"))}.bind(null,t)).catch(t.oe)},d={data:function(){return{up:!1,iphone_x:!1,detail:{bonus_rate:0},protocol:null,setting:{},name:"",mobile:"",applyArea:!1,wait:!1,refuse:!1,remove:!1,read:!1,look:!1,beApply:!1,rate:0,template_message:[],height:0,status:!1,province:[],city:[],district:[],level_list:[{id:"1",name:"省代理"},{id:"2",name:"市代理"},{id:"3",name:"区/县代理"}],choose_list:[],choose_level:{id:0,name:"请选择代理级别"},choose_province:{id:0,name:"请选择省"},choose_city:{id:0,name:"请选择市"},choose_district:[],show_dialog:!1,show_list:!1,dialog_title:"",newIndex:0,chooseIndex:[0],first:!0,check:{}}},components:{"app-index":c,"app-rich-text":l,"app-condition":h},computed:s({},(0,o.mapState)({region:function(e){return e.mallConfig.__wxapp_img.region},bonusImg:function(e){return e.mallConfig.__wxapp_img.bonus}})),methods:{resetChoose:function(){this.look=!1,this.choose_level={id:0,name:"请选择代理级别"},this.choose_province={id:0,name:"请选择省"},this.choose_city={id:0,name:"请选择市"},this.choose_district=[],this.applyArea=!0},chooseDistrict:function(e,i){this.choose_list[i].show=!this.choose_list[i].show,this.$forceUpdate()},close:function(){this.show_list=!1,this.show_dialog=!1,this.chooseIndex=[0],this.newIndex=0,this.choose_list=[]},choose:function(e){if(this.show_list=!1,this.show_dialog=!1,this.chooseIndex=[0],this.newIndex=0,1!=e||this.up)if(2!=e||this.up){if(3==e)if(this.dialog_title="选择市",this.choose_list=this.city,2==this.choose_level.id){for(var i in this.choose_list)for(var t in this.choose_list[i].show=!1,this.choose_district)this.choose_list[i].id==this.choose_district[t].id&&(this.choose_list[i].show=!0);this.show_list=!0}else{for(var o in this.city)this.city[o].id==this.choose_city.id&&(this.chooseIndex[0]=+o,this.newIndex=+o);this.show_dialog=!0}else if(4==e&&!this.up){for(var n in this.dialog_title="选择区/县",this.choose_list=this.district,this.choose_list)for(var s in this.choose_list[n].show=!1,this.choose_district)this.choose_list[n].id==this.choose_district[s].id&&(this.choose_list[n].show=!0);this.show_list=!0}}else{for(var a in this.dialog_title="选择省",this.choose_list=this.province,this.province)this.province[a].id==this.choose_province.id&&(this.chooseIndex[0]=+a,this.newIndex=+a);this.show_dialog=!0}else{for(var c in this.dialog_title="选择代理级别",this.choose_list=this.level_list,this.level_list)this.level_list[c].id==this.choose_level.id&&(this.chooseIndex[0]=+c,this.newIndex=+c);this.show_dialog=!0}},confirm:function(){if("选择代理级别"==this.dialog_title?(this.choose_level=this.choose_list[this.newIndex],this.newIndex!=this.chooseIndex[0]?3==this.choose_level.id?(this.choose_city={id:0,name:"请选择市"},this.choose_district=[]):2==this.choose_level.id&&(this.choose_city=[]):this.chooseIndex[0]=this.newIndex):"选择省"==this.dialog_title?(this.choose_province=this.choose_list[this.newIndex],this.city=this.choose_list[this.newIndex].list,this.newIndex!=this.chooseIndex[0]?3==this.choose_level.id?(this.choose_city={id:0,name:"请选择市"},this.choose_district=[]):2==this.choose_level.id&&(this.choose_city=[],this.choose_district=[]):this.chooseIndex[0]=this.newIndex):"选择市"==this.dialog_title&&(this.choose_city=this.choose_list[this.newIndex],this.district=this.choose_list[this.newIndex].list,this.newIndex!=this.chooseIndex[0]?this.choose_district=[]:this.chooseIndex[0]=this.newIndex),this.show_list)for(var e in this.choose_district=[],this.choose_list)this.choose_list[e].show&&this.choose_district.push(this.choose_list[e]);this.show_dialog=!1,this.show_list=!1},bindChange:function(e){this.newIndex=+e.detail.value[0]},toRead:function(){this.protocol=this.setting.agreement_content},reApply:function(){var i=this;e.showLoading({mask:!0,title:"加载中..."}),i.wait=!1,i.$request({url:i.detail&&i.detail.level_up_log&&2==i.detail.level_up_log.status?i.$api.region.clear_up:i.$api.region.clear,method:"post"}).then((function(t){if(e.hideLoading(),0==t.code)if(i.refuse=!1,i.remove=!1,i.applyArea=!0,2==i.detail.level_up_log.status){if(i.choose_province={id:i.detail.province_id,name:i.detail.province_text},2==i.detail.level_up.level)for(var o in i.province)i.province[o].id==i.detail.province_id&&(i.city=i.province[o].list)}else e.setNavigationBarTitle({title:i.setting.form.apply_title_text?i.setting.form.apply_title_text:"申请成为代理"});else e.showToast({title:t.msg,icon:"none",duration:1e3})})).catch((function(i){e.hideLoading()}))},receive:function(e){this.beApply=!0},beRead:function(){this.read=!this.read},toIndex:function(){e.navigateTo({url:"/pages/index/index"})},imageLoad:function(e){var i=e.detail.width,t=e.detail.height;this.height=t*(750/i)/2},submit:function(){var i=this,t=this,o=0;if(!t.read&&0!=t.setting.is_agreement)return e.showToast({title:t.setting.agreement_title?"请先查看"+t.setting.agreement_title+"申请协议并同意":"请先查看区域代理申请协议并同意",icon:"none",duration:1e3}),!1;o=1,t.setting.apply_type<2?t.name&&t.mobile?11==t.mobile.length&&/0?(1)[0-9]{10}/.test(t.mobile)?this.$subscribe(this.template_message).then((function(e){i.submitApply(o)})).catch((function(e){i.submitApply(o)})):e.showToast({title:"请输入正确的手机号码",icon:"none",duration:1e3}):e.showToast({title:"请完善申请信息",icon:"none",duration:1e3}):this.$subscribe(this.template_message).then((function(e){i.submitApply(o)})).catch((function(e){i.submitApply(o)}))},submitApply:function(i){var t=this,o=[],n=[];if(3==t.choose_level.id)for(var s in o.push(t.choose_city.id),t.choose_district)n.push(t.choose_district[s].id);if(2==t.choose_level.id)for(var a in t.choose_district)o.push(t.choose_district[a].id.toString());t.$request({url:t.$api.region.apply,data:{name:t.name,mobile:t.mobile,province_id:t.choose_province.id,level:t.choose_level.id,city_id:JSON.stringify(o),district_id:JSON.stringify(n),is_agree:i},method:"post"}).then((function(i){t.$hideLoading(),0==i.code?(e.showToast({title:i.msg,duration:1e3}),t.name="",t.mobile="",setTimeout((function(){e.showLoading({mask:!0,title:"加载中..."}),t.getStatus(),t.look=!1,1!=t.setting.apply_type&&3!=t.setting.apply_type||(t.wait=!0)}),500)):("请先查看区域代理申请协议并同意"==i.msg&&(i.msg="请先查看"+t.setting.agreement_title+"申请协议并同意"),e.showToast({title:i.msg,icon:"none",duration:1e3}))})).catch((function(e){t.$hideLoading()}))},submitUpdate:function(){var i=this;if(2==i.choose_level.id&&0==i.choose_district.length)return e.showToast({title:"请选择市",icon:"none",duration:1e3}),!1;e.showLoading({mask:!0,title:"申请中..."});var t=[];if(i.choose_district.length>0)for(var o in i.choose_district)t.push(i.choose_district[o].id);i.$request({url:i.$api.region.level_up,data:{city_id:JSON.stringify(t),level:i.choose_level.id},method:"post"}).then((function(t){e.hideLoading(),0==t.code?(i.wait=!0,i.applyArea=!1):e.showToast({title:t.msg,icon:"none",duration:1e3})})).catch((function(i){e.hideLoading()}))},getStatus:function(){var i=this;i.wait=!1,i.status=!1,i.$request({url:i.$api.region.status}).then((function(t){if(i.$hideLoading(),e.hideLoading(),i.first=!1,i.status=!0,0==t.code)if(i.detail=t.data.region,i.up){if(e.setNavigationBarTitle({title:"升级区域代理"}),i.choose_level={id:i.detail.level_up.level,name:i.detail.level_up.level_desc},i.detail.level_up_log&&2==i.detail.level_up_log.status)i.$hideLoading(),e.hideLoading(),i.beApply=!1,i.refuse=!0;else if(i.detail.level_up.relation.length>0)i.wait=!0,i.choose_district=i.detail.level_up.relation;else if(i.applyArea=!0,i.choose_province={id:i.detail.province_id,name:i.detail.province_text},2==i.detail.level_up.level)for(var o in i.province)i.province[o].id==i.detail.province_id&&(i.city=i.province[o].list)}else if(t.data.region.name&&(i.name=t.data.region.name),t.data.region.phone&&(i.mobile=t.data.region.phone),-1==i.detail.status)i.$hideLoading(),e.hideLoading(),i.beApply=!1,i.remove=!0;else if(2==i.detail.status)i.$hideLoading(),e.hideLoading(),i.beApply=!1,i.refuse=!0;else{if(1==i.detail.status)return i.$hideLoading(),e.hideLoading(),i.beApply=!1,!1;0==i.detail.status?(i.$hideLoading(),e.hideLoading(),i.beApply=!1,i.wait=!0):i.look||i.beApply||(e.setNavigationBarTitle({title:i.setting.form.apply_title_text?i.setting.form.apply_title_text:"申请成为代理"}),i.applyArea=!0)}else"用户未申请区域代理"==t.msg?i.look||i.beApply||(e.setNavigationBarTitle({title:i.setting.form.apply_title_text?i.setting.form.apply_title_text:"申请成为代理"}),i.applyArea=!0):(i.$hideLoading(),e.hideLoading(),e.showToast({title:t.msg,icon:"none",duration:1e3}))})).catch((function(t){i.$hideLoading(),e.hideLoading()}))},getSetting:function(){var i=this;i.$request({url:i.$api.region.setting}).then((function(t){0==t.code?(i.getStatus(),i.setting=t.data,i.template_message=t.data.template_message_region,e.setNavigationBarTitle({title:i.setting.form.title?i.setting.form.title:"区域代理"})):(i.$hideLoading(),e.hideLoading(),e.showToast({title:t.msg,icon:"none",duration:1e3}))})).catch((function(t){i.$hideLoading(),e.hideLoading()}))},getPlace:function(){var i=this;i.$request({url:i.$api.city.cityName}).then((function(t){if(0==t.code)for(var o in i.getSetting(),i.province=t.data.list,i.province)"其他"==i.province[o].name&&i.province.splice(o,1);else i.$hideLoading(),e.hideLoading(),e.showToast({title:t.msg,icon:"none",duration:1e3})})).catch((function(t){i.$hideLoading(),e.hideLoading()}))},getDetail:function(){var i=this;return i.check={},0==i.choose_level.id?(e.showToast({title:"请选择代理级别",icon:"none",duration:1e3}),!1):0==i.choose_province.id?(e.showToast({title:"请选择省",icon:"none",duration:1e3}),!1):3==i.choose_level.id&&0==i.choose_city.id||2==i.choose_level.id&&0==i.choose_district.length?(e.showToast({title:"请选择市",icon:"none",duration:1e3}),!1):3==i.choose_level.id&&0==i.choose_district.length?(e.showToast({title:"请选择代理区域",icon:"none",duration:1e3}),!1):(e.showLoading({mask:!0,title:"加载中..."}),void i.$request({url:i.$api.region.index,data:{province_id:i.choose_province.id,level:i.choose_level.id}}).then((function(t){e.hideLoading(),0==t.code?(i.look=!0,i.applyArea=!1,i.refuse=!1,i.remove=!1,i.check=t.data,i.rate=+i.check.now_target/+i.check.target*100):e.showToast({title:t.msg,icon:"none",duration:1e3})})).catch((function(i){e.hideLoading()})))}},onShow:function(){var e=this;e.first||e.getStatus()},onLoad:function(i){this.$commonLoad.onload(i);var t=this;e.getSystemInfo({success:function(e){(e.model.indexOf("iPhone X")>-1||e.model.indexOf("iPhone 11")>-1||e.model.indexOf("iPhone11")>-1||e.model.indexOf("iPhone12")>-1||e.model.indexOf("Unknown Device")>-1)&&(t.iphone_x=!0)}}),t.$showLoading({type:"global",text:"加载中..."}),i.name&&(t.name=i.name),i.mobile&&(t.mobile=i.mobile),i.up>0&&(this.up=!0),t.getPlace()}};i.default=d}).call(this,t("543d")["default"])}},[["3560","common/runtime","common/vendor"]]]);
|