index.vue 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133
  1. <template>
  2. <app-layout>
  3. <app-index v-if="detail.status == 1 && !up" :setting="setting" :detail="detail"></app-index>
  4. <view class="other" v-else :style="{'background-color':`${beApply && !wait ? '#f7f7f7': '#fff'}`}">
  5. <!-- 头部图片 -->
  6. <view class="header">
  7. <image v-if="status" :src="setting.form.bg_url == 'statics/img/app/region/banner.png' ? region.banner : setting.form.bg_url"></image>
  8. </view>
  9. <view class="choose-level" v-if="applyArea">
  10. <view>
  11. <view>选择代理级别</view>
  12. <view @click="choose(1)" class="main-between cross-center choose-level-item">
  13. <view :style="{'color':`${choose_level.id > 0 ? '#353535': '#999'}`}">{{choose_level.name}}</view>
  14. <image v-if="!up" class="more" src="/static/image/icon/icon-down.png"></image>
  15. </view>
  16. </view>
  17. <view>
  18. <view>选择省</view>
  19. <view @click="choose(2)" class="main-between cross-center choose-level-item">
  20. <view :style="{'color':`${choose_province.id > 0 ? '#353535': '#999'}`}">{{choose_province.name}}</view>
  21. <image v-if="!up" class="more" src="/static/image/icon/icon-down.png"></image>
  22. </view>
  23. </view>
  24. <view v-if="choose_level.id > 1">
  25. <view>选择市</view>
  26. <view @click="choose(3)" class="main-between cross-center choose-level-item">
  27. <view class="dir-left-wrap district-list" v-if="choose_district.length > 0 && choose_level.id == 2">
  28. <view style="color: #353535" v-for="(item,index) in choose_district" :key="item.name">
  29. <text v-if="index > 0">/</text>
  30. {{item.name}}
  31. </view>
  32. </view>
  33. <view v-else-if="choose_district.length == 0 && choose_level.id == 2">请选择市</view>
  34. <view v-else :style="{'color':`${choose_city.id > 0 ? '#353535': '#999'}`}">{{choose_city.name}}</view>
  35. <image class="more" src="/static/image/icon/icon-down.png"></image>
  36. </view>
  37. </view>
  38. <view v-if="choose_level.id > 2">
  39. <view>选择区/县</view>
  40. <view @click="choose(4)" class="main-between cross-center choose-level-item">
  41. <view class="dir-left-wrap district-list" v-if="choose_district.length > 0">
  42. <view style="color: #353535" v-for="(item,index) in choose_district" :key="item.name">
  43. <text v-if="index > 0">/</text>
  44. {{item.name}}
  45. </view>
  46. </view>
  47. <view v-else>请选择区/县</view>
  48. <image class="more" src="/static/image/icon/icon-down.png"></image>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="submit-area">
  53. <view @click="getDetail" style="margin-bottom: 0" v-if="applyArea && !up" class="apply-sumbit be-apply">
  54. <button>申请代理</button>
  55. </view>
  56. <view @click="submitUpdate" style="margin-bottom: 0" v-if="applyArea && up" class="apply-sumbit be-apply">
  57. <button>立即升级</button>
  58. </view>
  59. </view>
  60. <!-- 未达成条件 -->
  61. <app-condition :province="choose_province" :city="choose_city" :district="choose_district" @toRead="toRead" @beRead="beRead" @submit="submit" v-if="look" v-on:update="receive" v-on:reset="resetChoose" :read="read" :setting="setting" :rate="rate" :check="check"></app-condition>
  62. <!-- 等待审核 -->
  63. <view v-if="wait" class="wait">
  64. <image :src="bonusImg.wait"></image>
  65. <view v-if="up" class="up">
  66. <text>您正在申请升级为
  67. <text :style="{'color': `${choose_level.id > 1 ? '#666666' : '#ff8f17'}`}">{{detail.province_text}}</text>
  68. </text>
  69. <text style="color: #ff8f17" v-if="detail.level_up.level_desc == '市代理'" v-for="(item,index) in choose_district" :key="item.id">
  70. <text v-if="index > 0">、</text>
  71. {{item.name}}
  72. </text>
  73. <text>的{{detail.level_up.level_desc}},请耐心等待审核...</text>
  74. </view>
  75. <view v-else>代理申请已提交,请耐心等待审核...</view>
  76. <view class="submit-area">
  77. <view @click="toIndex" class="apply-sumbit to-mall">
  78. <button>去商城逛逛</button>
  79. </view>
  80. </view>
  81. </view>
  82. <!-- 申请页面 -->
  83. <view class="apply-area" v-if="beApply && !wait">
  84. <view class="apply">
  85. <view class="apply-input" style="border-top:0">欢迎申请区域代理,请填写申请信息</view>
  86. <view class="apply-input dir-left-nowrap">
  87. <view class="label">姓名</view>
  88. <input v-model="name" placeholder="请填写真实姓名" placeholder-style="color:#cdcdcd"></input>
  89. </view>
  90. <view class="apply-input dir-left-nowrap">
  91. <view class="label">手机号</view>
  92. <input v-model="mobile" type="number" placeholder="请填写手机号" placeholder-style="color:#cdcdcd"></input>
  93. </view>
  94. <view class="apply-input cross-center" v-if="setting.is_agreement == 1">
  95. <view class="read" @click="beRead">
  96. <image src="/static/image/icon/icon-uncheck.png" v-if="read == false"></image>
  97. <image src="/static/image/icon/icon-checkbox-checked-a.png" v-else></image>
  98. </view>
  99. <text>已阅读并同意《</text>
  100. <text class="agreement_title" @click="toRead">{{setting.agreement_title ? setting.agreement_title : '区域代理申请协议'}}</text>
  101. <text>》</text>
  102. </view>
  103. </view>
  104. <view @click="submit" class="apply-sumbit be-apply">
  105. <button>{{setting.form.apply_text ? setting.form.apply_text : '申请成为区域代理'}}</button>
  106. </view>
  107. </view>
  108. <view v-if="refuse || remove" class="refuse">
  109. <image src="./../image/refuse.png"></image>
  110. <view v-if="refuse">您的申请被拒</view>
  111. <view v-if="remove">您被解除代理身份</view>
  112. <view class="refuse-info">
  113. <view>审核时间:
  114. <text v-if="detail.level_up_log && detail.level_up_log.status == 2">{{detail.level_up_log.updated_at}}</text>
  115. <text v-else>{{detail.agreed_at}}</text>
  116. </view>
  117. <view class="refuse-reason" v-if="refuse">拒绝理由:
  118. <text v-if="detail.level_up_log.status == 2" style="word-wrap:break-word;">{{detail.level_up_log.reason ? detail.level_up_log.reason :"无"}}</text>
  119. <text v-else style="word-wrap:break-word;">{{detail.reason ? detail.reason :"无"}}</text>
  120. </view>
  121. <view class="refuse-reason" v-if="remove">解除理由:
  122. <text style="word-wrap:break-word;">{{detail.reason ? detail.reason :"无"}}</text>
  123. </view>
  124. <view class="submit-area">
  125. <view @click="reApply" class="apply-sumbit to-mall">
  126. <button>再次申请</button>
  127. </view>
  128. </view>
  129. </view>
  130. </view>
  131. <!-- 底部图片 -->
  132. <image v-if="beApply && !wait" :style="{'height':`${height}px`}" @load="imageLoad" class="rights" :src="setting.form.bottom_bg_url == 'statics/img/app/region/foot.png' ? region.foot : setting.form.bottom_bg_url"></image>
  133. </view>
  134. <!-- 分红协议(modal模式) -->
  135. <view class="modal cross-center main-center" v-if="protocol">
  136. <view class="protocol">
  137. <view class="protocol-name t-omit">{{setting.agreement_title}}</view>
  138. <view class="protocol-content">
  139. <app-rich-text :content="protocol"></app-rich-text>
  140. </view>
  141. <view @click="protocol=null;read=true">
  142. <view class="read-over">我已阅读</view>
  143. </view>
  144. </view>
  145. </view>
  146. <view class="modal" @click="close" v-show="show_dialog || show_list">
  147. <view :class="['select-dialog', `${iphone_x?'iphone_x':''}`]" @click.stop="">
  148. <view class="select-title">
  149. <view>{{dialog_title}}</view>
  150. <view @click.stop="confirm" class="submit-btn">确定</view>
  151. </view>
  152. <picker-view v-show="show_dialog" :style="{ 'height': `${dialog_title == '选择代理级别' ? '360' : '536'}rpx`}" indicator-style="height: 44px;" @change="bindChange" :value="chooseIndex">
  153. <picker-view-column>
  154. <view
  155. v-for="(item,idx) in choose_list" :key="item.name"
  156. :class="[`picker-view`,{
  157. 'sure-color': newIndex == idx
  158. }]">
  159. {{item.name}}
  160. </view>
  161. </picker-view-column>
  162. </picker-view>
  163. <view class="dialog-list dir-left-wrap" v-if="show_list">
  164. <view @click.stop="chooseDistrict(item,idx)" :class="[`dialog-item`,{'active': item.show}]" v-for="(item,idx) in choose_list" :key="item.name">{{item.name}}</view>
  165. </view>
  166. </view>
  167. </view>
  168. </app-layout>
  169. </template>
  170. <script>
  171. import { mapState } from "vuex";
  172. import appIndex from '../components/app-index/app-index';
  173. import appCondition from '../components/app-condition/app-condition';
  174. import appRichText from "../../../components/basic-component/app-rich/parse.vue";
  175. export default {
  176. data() {
  177. return {
  178. up: false,
  179. iphone_x: false,
  180. detail: {
  181. bonus_rate: 0
  182. },
  183. protocol: null,
  184. setting: {},
  185. name: '',
  186. mobile: '',
  187. applyArea: false,
  188. wait: false,
  189. refuse: false,
  190. remove: false,
  191. read: false,
  192. look: false,
  193. beApply: false,
  194. rate: 0,
  195. template_message: [],
  196. height: 0,
  197. status: false,
  198. province: [],
  199. city: [],
  200. district: [],
  201. level_list: [
  202. {id: '1',name:'省代理'},
  203. {id: '2',name:'市代理'},
  204. {id: '3',name:'区/县代理'}
  205. ],
  206. choose_list: [],
  207. choose_level: {
  208. id: 0,
  209. name: '请选择代理级别'
  210. },
  211. choose_province: {
  212. id: 0,
  213. name: '请选择省'
  214. },
  215. choose_city: {
  216. id: 0,
  217. name: '请选择市'
  218. },
  219. choose_district: [],
  220. show_dialog: false,
  221. show_list: false,
  222. dialog_title: '',
  223. newIndex: 0,
  224. chooseIndex: [0],
  225. first: true,
  226. check: {}
  227. }
  228. },
  229. components: {
  230. 'app-index': appIndex,
  231. "app-rich-text": appRichText,
  232. 'app-condition': appCondition,
  233. },
  234. computed: {
  235. ...mapState({
  236. region: state => state.mallConfig.__wxapp_img.region,
  237. bonusImg: state => state.mallConfig.__wxapp_img.bonus
  238. })
  239. },
  240. methods: {
  241. resetChoose() {
  242. this.look = false;
  243. this.choose_level = {
  244. id: 0,
  245. name: '请选择代理级别'
  246. }
  247. this.choose_province = {
  248. id: 0,
  249. name: '请选择省'
  250. }
  251. this.choose_city = {
  252. id: 0,
  253. name: '请选择市'
  254. }
  255. this.choose_district = []
  256. this.applyArea = true;
  257. },
  258. chooseDistrict(item,index) {
  259. this.choose_list[index].show = !this.choose_list[index].show;
  260. this.$forceUpdate();
  261. },
  262. close() {
  263. this.show_list = false;
  264. this.show_dialog = false;
  265. this.chooseIndex = [0];
  266. this.newIndex = 0;
  267. this.choose_list = [];
  268. },
  269. choose(index) {
  270. this.show_list = false;
  271. this.show_dialog = false;
  272. this.chooseIndex = [0];
  273. this.newIndex = 0;
  274. if(index == 1 && !this.up) {
  275. this.dialog_title = '选择代理级别';
  276. this.choose_list = this.level_list;
  277. for(let i in this.level_list) {
  278. if(this.level_list[i].id == this.choose_level.id) {
  279. this.chooseIndex[0] = +i;
  280. this.newIndex = +i;
  281. }
  282. }
  283. this.show_dialog = true;
  284. }else if(index == 2 && !this.up) {
  285. this.dialog_title = '选择省';
  286. this.choose_list = this.province;
  287. for(let i in this.province) {
  288. if(this.province[i].id == this.choose_province.id) {
  289. this.chooseIndex[0] = +i;
  290. this.newIndex = +i;
  291. }
  292. }
  293. this.show_dialog = true;
  294. }else if(index == 3) {
  295. this.dialog_title = '选择市';
  296. this.choose_list = this.city;
  297. if(this.choose_level.id == 2) {
  298. for(let i in this.choose_list) {
  299. this.choose_list[i].show = false;
  300. for(let j in this.choose_district) {
  301. if(this.choose_list[i].id == this.choose_district[j].id) {
  302. this.choose_list[i].show = true;
  303. }
  304. }
  305. }
  306. this.show_list = true;
  307. }else {
  308. for(let i in this.city) {
  309. if(this.city[i].id == this.choose_city.id) {
  310. this.chooseIndex[0] = +i;
  311. this.newIndex = +i;
  312. }
  313. }
  314. this.show_dialog = true;
  315. }
  316. }else if(index == 4 && !this.up) {
  317. this.dialog_title = '选择区/县';
  318. this.choose_list = this.district;
  319. for(let i in this.choose_list) {
  320. this.choose_list[i].show = false;
  321. for(let j in this.choose_district)
  322. if(this.choose_list[i].id == this.choose_district[j].id) {
  323. this.choose_list[i].show = true;
  324. }
  325. }
  326. this.show_list = true;
  327. }
  328. },
  329. confirm() {
  330. if(this.dialog_title == '选择代理级别') {
  331. this.choose_level = this.choose_list[this.newIndex];
  332. if(this.newIndex != this.chooseIndex[0]) {
  333. if(this.choose_level.id == 3) {
  334. this.choose_city = {
  335. id: 0,
  336. name: '请选择市'
  337. }
  338. this.choose_district = [];
  339. }else if(this.choose_level.id == 2) {
  340. this.choose_city = []
  341. }
  342. }else {
  343. this.chooseIndex[0] = this.newIndex;
  344. }
  345. }else if(this.dialog_title == '选择省') {
  346. this.choose_province = this.choose_list[this.newIndex];
  347. this.city = this.choose_list[this.newIndex].list;
  348. if(this.newIndex != this.chooseIndex[0]) {
  349. if(this.choose_level.id == 3) {
  350. this.choose_city = {
  351. id: 0,
  352. name: '请选择市'
  353. }
  354. this.choose_district = [];
  355. }else if(this.choose_level.id == 2) {
  356. this.choose_city = [];
  357. this.choose_district = [];
  358. }
  359. }else {
  360. this.chooseIndex[0] = this.newIndex;
  361. }
  362. }else if(this.dialog_title == '选择市') {
  363. this.choose_city = this.choose_list[this.newIndex];
  364. this.district = this.choose_list[this.newIndex].list;
  365. if(this.newIndex != this.chooseIndex[0]) {
  366. this.choose_district = []
  367. }else {
  368. this.chooseIndex[0] = this.newIndex;
  369. }
  370. }
  371. if(this.show_list) {
  372. this.choose_district = [];
  373. for(let i in this.choose_list) {
  374. if(this.choose_list[i].show) {
  375. this.choose_district.push(this.choose_list[i])
  376. }
  377. }
  378. }
  379. this.show_dialog = false;
  380. this.show_list = false;
  381. },
  382. bindChange(e) {
  383. this.newIndex = +e.detail.value[0];
  384. },
  385. toRead() {
  386. this.protocol = this.setting.agreement_content;
  387. },
  388. reApply() {
  389. let that = this;
  390. uni.showLoading({
  391. mask: true,
  392. title: '加载中...'
  393. });
  394. that.wait = false;
  395. that.$request({
  396. url: that.detail && that.detail.level_up_log && that.detail.level_up_log.status == 2 ? that.$api.region.clear_up : that.$api.region.clear,
  397. method: 'post'
  398. }).then(response=>{
  399. uni.hideLoading();
  400. if(response.code == 0) {
  401. that.refuse = false;
  402. that.remove = false;
  403. that.applyArea = true;
  404. if(that.detail.level_up_log.status == 2) {
  405. that.choose_province = {
  406. id: that.detail.province_id,
  407. name: that.detail.province_text
  408. }
  409. if(that.detail.level_up.level == 2) {
  410. for(let i in that.province) {
  411. if(that.province[i].id == that.detail.province_id) {
  412. that.city = that.province[i].list
  413. }
  414. }
  415. }
  416. }else {
  417. uni.setNavigationBarTitle({
  418. title: that.setting.form.apply_title_text ? that.setting.form.apply_title_text: '申请成为代理',
  419. })
  420. }
  421. }else {
  422. uni.showToast({
  423. title: response.msg,
  424. icon: 'none',
  425. duration: 1000
  426. });
  427. }
  428. }).catch(response => {
  429. uni.hideLoading();
  430. });
  431. },
  432. receive(e) {
  433. this.beApply = true;
  434. },
  435. beRead() {
  436. this.read = !this.read;
  437. },
  438. toIndex() {
  439. uni.navigateTo({
  440. url: '/pages/index/index'
  441. });
  442. },
  443. imageLoad: function (e) {
  444. var $width = e.detail.width; //获取图片真实宽度
  445. var $height = e.detail.height; //获取图片真实高度
  446. this.height = $height * (750 / $width) / 2
  447. },
  448. submit() {
  449. let that = this;
  450. let is_agree = 0;
  451. if(that.read || that.setting.is_agreement == 0) {
  452. is_agree = 1;
  453. }else {
  454. uni.showToast({
  455. title: that.setting.agreement_title ? '请先查看' + that.setting.agreement_title +'申请协议并同意' : '请先查看区域代理申请协议并同意',
  456. icon: 'none',
  457. duration: 1000
  458. });
  459. return false;
  460. }
  461. if(that.setting.apply_type < 2) {
  462. if( that.name && that.mobile) {
  463. if(that.mobile.length == 11 && (/0?(1)[0-9]{10}/.test(that.mobile))) {
  464. this.$subscribe(this.template_message).then(res => {
  465. this.submitApply(is_agree);
  466. }).catch(res => {
  467. this.submitApply(is_agree);
  468. });
  469. }else {
  470. uni.showToast({
  471. title: '请输入正确的手机号码',
  472. icon: 'none',
  473. duration: 1000
  474. });
  475. }
  476. }else {
  477. uni.showToast({
  478. title: '请完善申请信息',
  479. icon: 'none',
  480. duration: 1000
  481. });
  482. }
  483. }else {
  484. this.$subscribe(this.template_message).then(res => {
  485. this.submitApply(is_agree);
  486. }).catch(res => {
  487. this.submitApply(is_agree);
  488. });
  489. }
  490. },
  491. submitApply(is_agree) {
  492. let that = this;
  493. let city_id = [];
  494. let district_id = [];
  495. if(that.choose_level.id == 3) {
  496. city_id.push(that.choose_city.id)
  497. for(let i in that.choose_district) {
  498. district_id.push(that.choose_district[i].id)
  499. }
  500. }
  501. if(that.choose_level.id == 2) {
  502. for(let i in that.choose_district) {
  503. city_id.push(that.choose_district[i].id.toString())
  504. }
  505. }
  506. that.$request({
  507. url: that.$api.region.apply,
  508. data: {
  509. name: that.name,
  510. mobile: that.mobile,
  511. province_id: that.choose_province.id,
  512. level: that.choose_level.id,
  513. city_id: JSON.stringify(city_id),
  514. district_id: JSON.stringify(district_id),
  515. is_agree: is_agree
  516. },
  517. method: 'post'
  518. }).then(response=>{
  519. that.$hideLoading();
  520. if(response.code == 0) {
  521. uni.showToast({
  522. title: response.msg,
  523. duration: 1000
  524. });
  525. that.name = '';
  526. that.mobile = '';
  527. setTimeout(function() {
  528. uni.showLoading({
  529. mask: true,
  530. title: '加载中...'
  531. });
  532. that.getStatus();
  533. that.look = false;
  534. if(that.setting.apply_type == 1 || that.setting.apply_type == 3) {
  535. that.wait = true;
  536. }
  537. }, 500)
  538. }else {
  539. if (response.msg == '请先查看区域代理申请协议并同意') {
  540. response.msg = '请先查看' + that.setting.agreement_title +'申请协议并同意'
  541. }
  542. uni.showToast({
  543. title: response.msg,
  544. icon: 'none',
  545. duration: 1000
  546. });
  547. }
  548. }).catch(response => {
  549. that.$hideLoading();
  550. });
  551. },
  552. submitUpdate() {
  553. let that = this;
  554. if(that.choose_level.id == 2 && that.choose_district.length == 0 ) {
  555. uni.showToast({
  556. title: '请选择市',
  557. icon: 'none',
  558. duration: 1000
  559. });
  560. return false
  561. }
  562. uni.showLoading({
  563. mask: true,
  564. title: '申请中...'
  565. });
  566. let city = [];
  567. if(that.choose_district.length > 0) {
  568. for(let i in that.choose_district) {
  569. city.push(that.choose_district[i].id)
  570. }
  571. }
  572. that.$request({
  573. url: that.$api.region.level_up,
  574. data: {
  575. city_id: JSON.stringify(city),
  576. level: that.choose_level.id
  577. },
  578. method: 'post'
  579. }).then(response=>{
  580. uni.hideLoading();
  581. if(response.code == 0) {
  582. that.wait = true;
  583. that.applyArea = false;
  584. }else {
  585. uni.showToast({
  586. title: response.msg,
  587. icon: 'none',
  588. duration: 1000
  589. });
  590. }
  591. }).catch(response => {
  592. uni.hideLoading();
  593. });
  594. },
  595. getStatus() {
  596. let that = this;
  597. that.wait = false;
  598. that.status = false;
  599. that.$request({
  600. url: that.$api.region.status,
  601. }).then(response=>{
  602. that.$hideLoading();
  603. uni.hideLoading();
  604. that.first = false;
  605. that.status = true;
  606. if(response.code == 0) {
  607. that.detail = response.data.region;
  608. if(that.up) {
  609. uni.setNavigationBarTitle({
  610. title: '升级区域代理',
  611. })
  612. that.choose_level = {
  613. id: that.detail.level_up.level,
  614. name: that.detail.level_up.level_desc
  615. }
  616. if(that.detail.level_up_log && that.detail.level_up_log.status == 2) {
  617. that.$hideLoading();
  618. uni.hideLoading();
  619. that.beApply = false;
  620. that.refuse = true;
  621. }else {
  622. if(that.detail.level_up.relation.length > 0) {
  623. that.wait = true;
  624. that.choose_district = that.detail.level_up.relation
  625. }else {
  626. that.applyArea = true;
  627. that.choose_province = {
  628. id: that.detail.province_id,
  629. name: that.detail.province_text
  630. }
  631. if(that.detail.level_up.level == 2) {
  632. for(let i in that.province) {
  633. if(that.province[i].id == that.detail.province_id) {
  634. that.city = that.province[i].list
  635. }
  636. }
  637. }
  638. }
  639. }
  640. }else {
  641. if(response.data.region.name) {
  642. that.name = response.data.region.name;
  643. }
  644. if(response.data.region.phone) {
  645. that.mobile = response.data.region.phone;
  646. }
  647. if(that.detail.status == -1) {
  648. that.$hideLoading();
  649. uni.hideLoading();
  650. that.beApply = false;
  651. that.remove = true;
  652. }else if(that.detail.status == 2) {
  653. that.$hideLoading();
  654. uni.hideLoading();
  655. that.beApply = false;
  656. that.refuse = true;
  657. }else if(that.detail.status == 1) {
  658. that.$hideLoading();
  659. uni.hideLoading();
  660. that.beApply = false;
  661. return false;
  662. }else if(that.detail.status == 0) {
  663. that.$hideLoading();
  664. uni.hideLoading();
  665. that.beApply = false;
  666. that.wait = true;
  667. }else {
  668. if(!that.look && !that.beApply) {
  669. uni.setNavigationBarTitle({
  670. title: that.setting.form.apply_title_text ? that.setting.form.apply_title_text: '申请成为代理',
  671. })
  672. that.applyArea = true;
  673. }
  674. }
  675. }
  676. }else {
  677. if(response.msg == '用户未申请区域代理') {
  678. // that.getDetail();
  679. if(!that.look && !that.beApply) {
  680. uni.setNavigationBarTitle({
  681. title: that.setting.form.apply_title_text ? that.setting.form.apply_title_text: '申请成为代理',
  682. })
  683. that.applyArea = true;
  684. }
  685. }else {
  686. that.$hideLoading();
  687. uni.hideLoading();
  688. uni.showToast({
  689. title: response.msg,
  690. icon: 'none',
  691. duration: 1000
  692. });
  693. }
  694. }
  695. }).catch(response => {
  696. that.$hideLoading();
  697. uni.hideLoading();
  698. });
  699. },
  700. getSetting() {
  701. let that = this;
  702. that.$request({
  703. url: that.$api.region.setting,
  704. }).then(response=>{
  705. if(response.code == 0) {
  706. that.getStatus();
  707. that.setting = response.data;
  708. that.template_message = response.data.template_message_region;
  709. uni.setNavigationBarTitle({
  710. title: that.setting.form.title?that.setting.form.title: '区域代理',
  711. })
  712. }else {
  713. that.$hideLoading();
  714. uni.hideLoading();
  715. uni.showToast({
  716. title: response.msg,
  717. icon: 'none',
  718. duration: 1000
  719. });
  720. }
  721. }).catch(response => {
  722. that.$hideLoading();
  723. uni.hideLoading();
  724. });
  725. },
  726. getPlace() {
  727. let that = this;
  728. that.$request({
  729. url: that.$api.city.cityName,
  730. }).then(response=>{
  731. if(response.code == 0) {
  732. that.getSetting();
  733. that.province = response.data.list;
  734. for(let i in that.province) {
  735. if(that.province[i].name == '其他') {
  736. that.province.splice(i,1)
  737. }
  738. }
  739. }else {
  740. that.$hideLoading();
  741. uni.hideLoading();
  742. uni.showToast({
  743. title: response.msg,
  744. icon: 'none',
  745. duration: 1000
  746. });
  747. }
  748. }).catch(response => {
  749. that.$hideLoading();
  750. uni.hideLoading();
  751. });
  752. },
  753. getDetail() {
  754. let that = this;
  755. that.check = {};
  756. if(that.choose_level.id == 0) {
  757. uni.showToast({
  758. title: '请选择代理级别',
  759. icon: 'none',
  760. duration: 1000
  761. });
  762. return false
  763. }
  764. if(that.choose_province.id == 0) {
  765. uni.showToast({
  766. title: '请选择省',
  767. icon: 'none',
  768. duration: 1000
  769. });
  770. return false
  771. }
  772. if((that.choose_level.id == 3 && that.choose_city.id == 0 ) || (that.choose_level.id == 2 && that.choose_district.length == 0 )) {
  773. uni.showToast({
  774. title: '请选择市',
  775. icon: 'none',
  776. duration: 1000
  777. });
  778. return false
  779. }
  780. if(that.choose_level.id == 3 && that.choose_district.length == 0) {
  781. uni.showToast({
  782. title: '请选择代理区域',
  783. icon: 'none',
  784. duration: 1000
  785. });
  786. return false
  787. }
  788. uni.showLoading({
  789. mask: true,
  790. title: '加载中...'
  791. });
  792. that.$request({
  793. url: that.$api.region.index,
  794. data: {
  795. province_id: that.choose_province.id,
  796. level: that.choose_level.id
  797. }
  798. }).then(response=>{
  799. uni.hideLoading();
  800. if(response.code == 0) {
  801. that.look = true;
  802. that.applyArea = false;
  803. that.refuse = false;
  804. that.remove = false;
  805. that.check = response.data;
  806. that.rate = +that.check.now_target / +that.check.target *100;
  807. }else {
  808. uni.showToast({
  809. title: response.msg,
  810. icon: 'none',
  811. duration: 1000
  812. });
  813. }
  814. }).catch(response => {
  815. uni.hideLoading();
  816. });
  817. }
  818. },
  819. onShow() {
  820. let that = this;
  821. if(!that.first) {
  822. that.getStatus();
  823. }
  824. },
  825. onLoad(options) { this.$commonLoad.onload(options);
  826. let that = this;
  827. uni.getSystemInfo({
  828. success: function (res) {
  829. if(res.model.indexOf('iPhone X') > -1 || res.model.indexOf('iPhone 11') > -1 || res.model.indexOf('iPhone11') > -1 || res.model.indexOf('iPhone12') > -1 || res.model.indexOf('Unknown Device') > -1) {
  830. that.iphone_x = true;
  831. }
  832. }
  833. })
  834. that.$showLoading({
  835. type: 'global',
  836. text: '加载中...'
  837. });
  838. if(options.name) {
  839. that.name = options.name
  840. }
  841. if(options.mobile) {
  842. that.mobile = options.mobile
  843. }
  844. if(options.up > 0) {
  845. this.up = true;
  846. }
  847. that.getPlace();
  848. }
  849. }
  850. </script>
  851. <style scoped lang="scss">
  852. .other {
  853. position: absolute;
  854. top: 0;
  855. left: 0;
  856. width: 100%;
  857. height: 100%;
  858. background-color: #fff;
  859. .rights {
  860. width: 100%;
  861. }
  862. .header {
  863. height: #{360rpx};
  864. width: 100%;
  865. image {
  866. width: 100%;
  867. height: 100%;
  868. }
  869. }
  870. .apply-area {
  871. background-color: #f7f7f7;
  872. padding: #{20rpx} 0 #{24rpx};
  873. .apply {
  874. background-color: #fff;
  875. padding: 0 #{24rpx};
  876. margin-bottom: #{24rpx};
  877. .apply-input {
  878. height: #{80rpx};
  879. line-height: #{80rpx};
  880. border-top: #{1rpx} solid #e2e2e2;
  881. font-size: #{28rpx};
  882. color: #353535;
  883. .agreement_title {
  884. color:#ff4544;
  885. max-width: #{360rpx};
  886. overflow: hidden;
  887. text-overflow: ellipsis;
  888. white-space: nowrap;
  889. }
  890. text {
  891. display: inline-block;
  892. }
  893. input {
  894. border: 0;
  895. width: #{560rpx};
  896. height: #{60rpx};
  897. line-height: #{60rpx};
  898. margin-top: #{10rpx};
  899. }
  900. .label {
  901. width: #{126rpx};
  902. }
  903. .read {
  904. width: #{42rpx};
  905. height: #{80rpx};
  906. float: left;
  907. padding-top: #{24rpx};
  908. padding-right: #{10rpx};
  909. image {
  910. height: #{32rpx};
  911. width: #{32rpx};
  912. display: block;
  913. }
  914. }
  915. }
  916. }
  917. }
  918. .refuse {
  919. font-size: #{36rpx};
  920. color: #353535;
  921. text-align: center;
  922. background-color: #fff;
  923. image {
  924. height: #{160rpx};
  925. width: #{160rpx};
  926. margin: #{80rpx} auto #{40rpx};
  927. }
  928. view {
  929. margin-bottom:#{25rpx};
  930. }
  931. .refuse-reason {
  932. margin:#{10rpx} 0 #{76rpx};
  933. }
  934. .refuse-info {
  935. font-size: #{28rpx};
  936. color: #999;
  937. border-top: #{1rpx} solid #e2e2e2;
  938. width: #{520rpx};
  939. margin: 0 auto;
  940. margin-bottom: 0;
  941. padding-top: #{30rpx};
  942. padding-left: #{20rpx};
  943. text-align: left;
  944. text {
  945. color: #666;
  946. margin-left: #{15rpx};
  947. }
  948. }
  949. }
  950. .wait {
  951. color: #666;
  952. font-size: #{32rpx};
  953. text-align: center;
  954. background-color: #fff;
  955. view {
  956. margin-bottom: #{68rpx};
  957. }
  958. .up {
  959. width: #{510rpx};
  960. margin: 0 auto #{68rpx};
  961. }
  962. image {
  963. height: #{270rpx};
  964. width: #{380rpx};
  965. margin: #{120rpx} auto #{60rpx};
  966. }
  967. }
  968. }
  969. .submit-area {
  970. background-color: #fff;
  971. padding-bottom: #{60rpx};
  972. margin-bottom: 0!important;
  973. }
  974. .apply-sumbit {
  975. margin: 0 auto #{60rpx};
  976. button {
  977. height: #{80rpx};
  978. line-height: #{80rpx};
  979. width: #{702rpx};
  980. margin: 0 auto;
  981. border-radius: #{40rpx};
  982. background-color: #ff4544;
  983. color: #fff;
  984. font-size: #{32rpx};
  985. text-align: center;
  986. }
  987. &.be-apply {
  988. width: #{702rpx};
  989. }
  990. }
  991. .apply-sumbit.to-mall,.apply-sumbit.to-mall button {
  992. width: #{320rpx};
  993. margin-bottom: 0;
  994. }
  995. .apply-sumbit.to-apply,.apply-sumbit.to-apply button {
  996. width: #{440rpx};
  997. }
  998. .choose-level {
  999. padding: #{80rpx} #{40rpx};
  1000. font-size: #{32rpx};
  1001. color: #353535;
  1002. background-color: #fff;
  1003. >view {
  1004. border-bottom: #{2rpx} solid #e2e2e2;
  1005. margin-bottom: #{36rpx};
  1006. }
  1007. .choose-level-item {
  1008. color: #999;
  1009. padding-top: #{20rpx};
  1010. padding-bottom: #{34rpx};
  1011. .district-list {
  1012. width: #{530rpx};
  1013. text {
  1014. margin: 0 #{10rpx};
  1015. }
  1016. }
  1017. .more {
  1018. width: #{22rpx};
  1019. height: #{12rpx};
  1020. margin-left: #{12rpx};
  1021. }
  1022. }
  1023. }
  1024. .modal {
  1025. position: fixed;
  1026. top: 0;
  1027. left: 0;
  1028. right: 0;
  1029. height: 100%;
  1030. width: 100%;
  1031. z-index: 99;
  1032. background-color: rgba(0, 0, 0, 0.3);
  1033. .dialog-list {
  1034. padding: #{46rpx} #{30rpx};
  1035. .dialog-item {
  1036. margin: #{10rpx};
  1037. height: #{62rpx};
  1038. line-height: #{60rpx};
  1039. display: inline-block;
  1040. padding: 0 #{32rpx};
  1041. font-size: #{32rpx};
  1042. color: #353535;
  1043. border-radius: #{32rpx};
  1044. border: #{2rpx} solid #bbbbbb;
  1045. &.active {
  1046. color: #ff4544;
  1047. border: #{2rpx} solid #ff4544;
  1048. }
  1049. }
  1050. }
  1051. .protocol {
  1052. position: relative;
  1053. z-index: 99;
  1054. background-color: #fff;
  1055. width: 80%;
  1056. border-radius: #{20rpx};
  1057. .protocol-name {
  1058. text-align: center;
  1059. height: #{100rpx};
  1060. line-height: #{100rpx};
  1061. color: #666;
  1062. }
  1063. .protocol-content {
  1064. padding: #{10rpx} #{20rpx};
  1065. height: #{720rpx};
  1066. overflow: auto;
  1067. color: #353535;
  1068. }
  1069. .read-over {
  1070. height: #{100rpx};
  1071. text-align: center;
  1072. line-height: #{100rpx};
  1073. background-color: #ff4544;
  1074. color: #fff;
  1075. font-size: #{30rpx};
  1076. border-bottom-right-radius: #{20rpx};
  1077. border-bottom-left-radius: #{20rpx};
  1078. }
  1079. image {
  1080. height: #{200rpx};
  1081. width: #{200rpx};
  1082. }
  1083. }
  1084. .select-dialog {
  1085. &.iphone_x {
  1086. padding-bottom: #{50rpx};
  1087. }
  1088. position: fixed;
  1089. border-top-left-radius: #{16rpx};
  1090. border-top-right-radius: #{16rpx};
  1091. width: 100%;
  1092. bottom: 0;
  1093. left: 0;
  1094. background-color: #fff;
  1095. .select-title {
  1096. border-top-left-radius: #{16rpx};
  1097. border-top-right-radius: #{16rpx};
  1098. position: relative;
  1099. width: 100%;
  1100. height: #{100rpx};
  1101. line-height: #{100rpx};
  1102. border-bottom: #{2rpx} solid #e2e2e2;
  1103. text-align: center;
  1104. font-size: #{32rpx};
  1105. .submit-btn {
  1106. position: absolute;
  1107. right: #{24rpx};
  1108. top: 0;
  1109. color: #ff4544;
  1110. }
  1111. }
  1112. picker-view {
  1113. width: 100%;
  1114. .picker-view {
  1115. line-height: #{88rpx};
  1116. text-align:center;
  1117. font-size: #{32rpx};
  1118. &.sure-color {
  1119. font-size: #{36rpx};
  1120. }
  1121. }
  1122. }
  1123. }
  1124. }
  1125. </style>