index.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. <template>
  2. <app-layout>
  3. <app-index v-if="detail.status == 1" :setting="setting" :detail="detail"></app-index>
  4. <view class="other" v-else>
  5. <!-- 头部图片 -->
  6. <view class="header">
  7. <image v-if="status" :src="setting.form.bg_url == 'statics/img/app/stock/banner.png' ? stock.banner : setting.form.bg_url"></image>
  8. </view>
  9. <!-- 未达成条件 -->
  10. <app-condition @toRead="toRead" @beRead="beRead" @submit="submit" v-if="look" v-on:update="receive" :read="read" :setting="setting" :rate="rate" :check="check"></app-condition>
  11. <!-- 等待审核 -->
  12. <view v-if="wait" class="wait">
  13. <image :src="bonusImg.wait"></image>
  14. <view>谢谢您的支持,请等待审核...</view>
  15. <view @click="toIndex" class="apply-sumbit to-mall">
  16. <button>去商城逛逛</button>
  17. </view>
  18. </view>
  19. <!-- 申请页面 -->
  20. <view class="apply-area" v-if="beApply && !wait">
  21. <view class="apply">
  22. <view class="apply-input" style="border-top:0">欢迎申请股东分红,请填写申请信息</view>
  23. <view class="apply-input dir-left-nowrap">
  24. <view class="label">姓名</view>
  25. <input v-model="name" placeholder="请填写真实姓名" placeholder-style="color:#cdcdcd"></input>
  26. </view>
  27. <view class="apply-input dir-left-nowrap">
  28. <view class="label">手机号</view>
  29. <input v-model="mobile" type="number" placeholder="请填写手机号" placeholder-style="color:#cdcdcd"></input>
  30. </view>
  31. <view class="apply-input cross-center" v-if="setting.is_agreement == 1">
  32. <view class="read" @click="beRead">
  33. <image src="/static/image/icon/icon-uncheck.png" v-if="read == false"></image>
  34. <image src="/static/image/icon/icon-checkbox-checked-a.png" v-else></image>
  35. </view>
  36. <text>已阅读并同意《</text>
  37. <text class="agreement_title" @click="toRead">{{setting.agreement_title ? setting.agreement_title : '股东分红申请协议'}}</text>
  38. <text>》</text>
  39. </view>
  40. </view>
  41. <view @click="submit" class="apply-sumbit be-apply">
  42. <button>申请成为股东</button>
  43. </view>
  44. </view>
  45. <view v-if="refuse || remove" class="refuse">
  46. <image src="../image/refuse.png"></image>
  47. <view v-if="refuse">您的申请被拒</view>
  48. <view v-if="remove">您被解除股东身份</view>
  49. <view class="refuse-info">
  50. <view>审核时间:
  51. <text>{{detail.updated_at}}</text>
  52. </view>
  53. <view class="refuse-reason" v-if="refuse">拒绝理由:
  54. <text style="word-wrap:break-word;">{{detail.reason ? detail.reason :"无"}}</text>
  55. </view>
  56. <view class="refuse-reason" v-if="remove">解除理由:
  57. <text style="word-wrap:break-word;">{{detail.reason ? detail.reason :"无"}}</text>
  58. </view>
  59. <view @click="reApply" class="apply-sumbit to-mall">
  60. <button>再次申请</button>
  61. </view>
  62. </view>
  63. </view>
  64. <!-- 底部图片 -->
  65. <image v-if="beApply && !wait" :style="{'height':`${height}px`}" @load="imageLoad" class="rights" :src="setting.form.bottom_bg_url == 'statics/img/app/stock/foot.png' ? stock.foot : setting.form.bottom_bg_url"></image>
  66. </view>
  67. <!-- 分红协议(modal模式) -->
  68. <view class="modal cross-center main-center" v-if="protocol">
  69. <view class="protocol">
  70. <view class="protocol-name t-omit">{{setting.agreement_title}}</view>
  71. <view class="protocol-content">
  72. <app-rich-text :content="protocol"></app-rich-text>
  73. </view>
  74. <view @click="protocol=null;read=true">
  75. <view class="read-over">我已阅读</view>
  76. </view>
  77. </view>
  78. </view>
  79. </app-layout>
  80. </template>
  81. <script>
  82. import { mapState } from "vuex";
  83. import appIndex from '../components/app-index/app-index';
  84. import appCondition from '../components/app-condition/app-condition';
  85. import appRichText from "../../../components/basic-component/app-rich/parse.vue";
  86. export default {
  87. data() {
  88. return {
  89. detail: {
  90. bonus_rate: 0
  91. },
  92. protocol: null,
  93. setting: {},
  94. name: '',
  95. mobile: '',
  96. wait: false,
  97. refuse: false,
  98. remove: false,
  99. read: false,
  100. look: false,
  101. beApply: false,
  102. rate: 0,
  103. template_message: [],
  104. height: 0,
  105. status: false,
  106. check: {}
  107. }
  108. },
  109. components: {
  110. 'app-index': appIndex,
  111. "app-rich-text": appRichText,
  112. 'app-condition': appCondition,
  113. },
  114. computed: {
  115. ...mapState({
  116. stock: state => state.mallConfig.__wxapp_img.stock,
  117. bonusImg: state => state.mallConfig.__wxapp_img.bonus,
  118. })
  119. },
  120. methods: {
  121. toRead() {
  122. this.protocol = this.setting.agreement_content;
  123. },
  124. reApply() {
  125. let that = this;
  126. uni.showLoading({
  127. mask: true,
  128. title: '加载中...'
  129. });
  130. that.wait = false;
  131. that.$request({
  132. url: that.$api.stock.clear,
  133. method: 'post'
  134. }).then(response=>{
  135. if(response.code == 0) {
  136. that.getDetail();
  137. }else {
  138. uni.showToast({
  139. title: response.msg,
  140. icon: 'none',
  141. duration: 1000
  142. });
  143. }
  144. }).catch(response => {
  145. uni.hideLoading();
  146. });
  147. },
  148. receive(e) {
  149. this.beApply = true;
  150. },
  151. beRead() {
  152. this.read = !this.read;
  153. },
  154. toIndex() {
  155. uni.navigateTo({
  156. url: '/pages/index/index'
  157. });
  158. },
  159. imageLoad: function (e) {
  160. var $width = e.detail.width; //获取图片真实宽度
  161. var $height = e.detail.height; //获取图片真实高度
  162. this.height = $height * (750 / $width) / 2
  163. },
  164. submit() {
  165. let that = this;
  166. let is_agree = 0;
  167. if(that.read || that.setting.is_agreement == 0) {
  168. is_agree = 1;
  169. }else {
  170. uni.showToast({
  171. title: that.setting.agreement_title ? '请先查看' + that.setting.agreement_title +'申请协议并同意' : '请先查看股东分红申请协议并同意',
  172. icon: 'none',
  173. duration: 1000
  174. });
  175. return false;
  176. }
  177. if(that.setting.apply_type < 3) {
  178. if( that.name && that.mobile) {
  179. if(that.mobile.length == 11 && (/0?(1)[0-9]{10}/.test(that.mobile))) {
  180. this.$subscribe(this.template_message).then(res => {
  181. this.submitApply(is_agree);
  182. }).catch(res => {
  183. this.submitApply(is_agree);
  184. });
  185. }else {
  186. uni.showToast({
  187. title: '请输入正确的手机号码',
  188. icon: 'none',
  189. duration: 1000
  190. });
  191. }
  192. }else {
  193. uni.showToast({
  194. title: '请完善申请信息',
  195. icon: 'none',
  196. duration: 1000
  197. });
  198. }
  199. }else {
  200. this.$subscribe(this.template_message).then(res => {
  201. this.submitApply(is_agree);
  202. }).catch(res => {
  203. this.submitApply(is_agree);
  204. });
  205. }
  206. },
  207. submitApply(is_agree) {
  208. let that = this;
  209. that.$request({
  210. url: that.$api.stock.apply,
  211. data: {
  212. name: that.name,
  213. mobile: that.mobile,
  214. is_agree: is_agree
  215. },
  216. method: 'post'
  217. }).then(response=>{
  218. that.$hideLoading();
  219. if(response.code == 0) {
  220. uni.showToast({
  221. title: response.msg,
  222. duration: 1000
  223. });
  224. that.name = '';
  225. that.mobile = '';
  226. setTimeout(function() {
  227. uni.showLoading({
  228. mask: true,
  229. title: '加载中...'
  230. });
  231. that.getStatus();
  232. that.look = false;
  233. if(that.setting.apply_type == 1 || that.setting.apply_type == 3) {
  234. that.wait = true;
  235. }
  236. }, 500)
  237. }else {
  238. if (response.msg == '请先查看股东分红申请协议并同意') {
  239. response.msg = '请先查看' + that.setting.agreement_title +'申请协议并同意'
  240. }
  241. uni.showToast({
  242. title: response.msg,
  243. icon: 'none',
  244. duration: 1000
  245. });
  246. }
  247. }).catch(response => {
  248. that.$hideLoading();
  249. });
  250. },
  251. getStatus() {
  252. let that = this;
  253. that.wait = false;
  254. that.status = false;
  255. that.$request({
  256. url: that.$api.stock.status,
  257. }).then(response=>{
  258. that.status = true;
  259. if(response.code == 0) {
  260. that.detail = response.data.stock;
  261. if(response.data.stock.name) {
  262. that.name = response.data.stock.name;
  263. }
  264. if(response.data.stock.phone) {
  265. that.mobile = response.data.stock.phone;
  266. }
  267. if(that.detail.status == -1) {
  268. that.$hideLoading();
  269. uni.hideLoading();
  270. that.beApply = false;
  271. that.remove = true;
  272. }else if(that.detail.status == 2) {
  273. that.$hideLoading();
  274. uni.hideLoading();
  275. that.beApply = false;
  276. that.refuse = true;
  277. }else if(that.detail.status == 1) {
  278. that.$hideLoading();
  279. uni.hideLoading();
  280. that.beApply = false;
  281. return false;
  282. }else if(that.detail.status == 0) {
  283. that.$hideLoading();
  284. uni.hideLoading();
  285. that.beApply = false;
  286. that.wait = true;
  287. }else {
  288. that.getDetail();
  289. }
  290. }else {
  291. if(response.msg == '用户未申请股东') {
  292. that.getDetail();
  293. }else {
  294. that.$hideLoading();
  295. uni.hideLoading();
  296. uni.showToast({
  297. title: response.msg,
  298. icon: 'none',
  299. duration: 1000
  300. });
  301. }
  302. }
  303. }).catch(response => {
  304. that.$hideLoading();
  305. uni.hideLoading();
  306. });
  307. },
  308. getSetting() {
  309. let that = this;
  310. that.$request({
  311. url: that.$api.stock.setting,
  312. }).then(response=>{
  313. that.$hideLoading();
  314. uni.hideLoading();
  315. if(response.code == 0) {
  316. that.setting = response.data;
  317. that.template_message = response.data.template_message_stock;
  318. uni.setNavigationBarTitle({
  319. title: that.setting.form.title?that.setting.form.title: '股东分红',
  320. })
  321. }else {
  322. uni.showToast({
  323. title: response.msg,
  324. icon: 'none',
  325. duration: 1000
  326. });
  327. }
  328. }).catch(response => {
  329. that.$hideLoading();
  330. uni.hideLoading();
  331. });
  332. },
  333. getDetail() {
  334. let that = this;
  335. uni.showLoading({
  336. mask: true,
  337. title: '加载中...'
  338. });
  339. that.check = {};
  340. that.$request({
  341. url: that.$api.stock.index,
  342. }).then(response=>{
  343. uni.hideLoading();
  344. if(response.code == 0) {
  345. that.look = true;
  346. that.refuse = false;
  347. that.remove = false;
  348. that.check = response.data;
  349. if(that.check.all_money) {
  350. that.rate = +that.check.all_money / +that.check.condition *100;
  351. }else if(that.check.all_order) {
  352. that.rate = +that.check.all_order / +that.check.condition *100;
  353. }else if(that.check.all_money) {
  354. that.rate = +that.check.all_money / +that.check.condition *100;
  355. }else if(that.check.cash_money) {
  356. that.rate = +that.check.cash_money / +that.check.condition *100;
  357. }else if(that.check.total_money) {
  358. that.rate = +that.check.total_money / +that.check.condition *100;
  359. }
  360. }else {
  361. uni.showToast({
  362. title: response.msg,
  363. icon: 'none',
  364. duration: 1000
  365. });
  366. setTimeout(function(){
  367. that.toIndex();
  368. },1000)
  369. }
  370. }).catch(response => {
  371. uni.hideLoading();
  372. });
  373. }
  374. },
  375. onShow() {
  376. let that = this;
  377. that.getStatus();
  378. },
  379. onLoad(options) { this.$commonLoad.onload(options);
  380. this.$showLoading({
  381. type: 'global',
  382. text: '加载中...'
  383. });
  384. if(options.name) {
  385. this.name = options.name
  386. }
  387. if(options.mobile) {
  388. this.mobile = options.mobile
  389. }
  390. this.getSetting();
  391. }
  392. }
  393. </script>
  394. <style scoped lang="scss">
  395. .other {
  396. position: absolute;
  397. top: 0;
  398. left: 0;
  399. width: 100%;
  400. height: 100%;
  401. background-color: #fff;
  402. .rights {
  403. width: 100%;
  404. }
  405. .header {
  406. height: #{360rpx};
  407. width: 100%;
  408. image {
  409. width: 100%;
  410. height: 100%;
  411. }
  412. }
  413. .apply-area {
  414. background-color: #f7f7f7;
  415. padding: #{20rpx} 0 #{24rpx};
  416. .apply {
  417. background-color: #fff;
  418. padding: 0 #{24rpx};
  419. margin-bottom: #{24rpx};
  420. .apply-input {
  421. height: #{80rpx};
  422. line-height: #{80rpx};
  423. border-top: #{1rpx} solid #e2e2e2;
  424. font-size: #{28rpx};
  425. color: #353535;
  426. .agreement_title {
  427. color:#ff4544;
  428. max-width: 360rpx;
  429. overflow: hidden;
  430. text-overflow: ellipsis;
  431. white-space: nowrap;
  432. }
  433. text {
  434. display: inline-block;
  435. }
  436. input {
  437. border: 0;
  438. width: #{560rpx};
  439. height: #{60rpx};
  440. line-height: #{60rpx};
  441. margin-top: #{10rpx};
  442. }
  443. .label {
  444. width: #{126rpx};
  445. }
  446. .read {
  447. width: #{42rpx};
  448. height: #{80rpx};
  449. float: left;
  450. padding-top: #{24rpx};
  451. padding-right: #{10rpx};
  452. image {
  453. height: #{32rpx};
  454. width: #{32rpx};
  455. display: block;
  456. }
  457. }
  458. }
  459. }
  460. }
  461. .refuse {
  462. font-size: #{36rpx};
  463. color: #353535;
  464. text-align: center;
  465. background-color: #fff;
  466. image {
  467. height: #{160rpx};
  468. width: #{160rpx};
  469. margin: #{80rpx} auto #{40rpx};
  470. }
  471. view {
  472. margin-bottom:#{25rpx};
  473. }
  474. .refuse-reason {
  475. margin:#{10rpx} 0 #{76rpx};
  476. }
  477. .refuse-info {
  478. font-size: #{28rpx};
  479. color: #999;
  480. border-top: #{1rpx} solid #e2e2e2;
  481. width: #{520rpx};
  482. margin: 0 auto;
  483. margin-bottom: 0;
  484. padding-top: #{30rpx};
  485. padding-left: #{20rpx};
  486. text-align: left;
  487. text {
  488. color: #666;
  489. margin-left: #{15rpx};
  490. }
  491. }
  492. }
  493. .wait {
  494. color: #666;
  495. font-size: #{32rpx};
  496. text-align: center;
  497. view {
  498. margin-bottom: #{68rpx};
  499. }
  500. image {
  501. height: #{270rpx};
  502. width: #{380rpx};
  503. margin: #{120rpx} auto #{60rpx};
  504. }
  505. }
  506. .apply-sumbit {
  507. margin: 0 auto;
  508. button {
  509. height: #{80rpx};
  510. line-height: #{80rpx};
  511. width: #{702rpx};
  512. margin: 0 auto;
  513. border-radius: #{40rpx};
  514. background-color: #ff4544;
  515. color: #fff;
  516. font-size: #{32rpx};
  517. text-align: center;
  518. }
  519. }
  520. .apply-sumbit.be-apply {
  521. width: #{702rpx};
  522. }
  523. .apply-sumbit.to-mall,.apply-sumbit.to-mall button {
  524. width: #{320rpx};
  525. }
  526. .apply-sumbit.to-apply,.apply-sumbit.to-apply button {
  527. width: #{440rpx};
  528. }
  529. }
  530. .modal {
  531. position: fixed;
  532. top: 0;
  533. left: 0;
  534. right: 0;
  535. height: 100%;
  536. width: 100%;
  537. z-index: 99;
  538. background-color: rgba(0, 0, 0, 0.3);
  539. .protocol {
  540. position: relative;
  541. z-index: 99;
  542. background-color: #fff;
  543. width: 80%;
  544. border-radius: #{20rpx};
  545. .protocol-name {
  546. text-align: center;
  547. height: #{100rpx};
  548. line-height: #{100rpx};
  549. color: #666;
  550. }
  551. .protocol-content {
  552. padding: #{10rpx} #{20rpx};
  553. height: #{720rpx};
  554. overflow: auto;
  555. color: #353535;
  556. }
  557. .read-over {
  558. height: #{100rpx};
  559. text-align: center;
  560. line-height: #{100rpx};
  561. background-color: #ff4544;
  562. color: #fff;
  563. font-size: #{30rpx};
  564. border-bottom-right-radius: #{20rpx};
  565. border-bottom-left-radius: #{20rpx};
  566. }
  567. image {
  568. height: #{200rpx};
  569. width: #{200rpx};
  570. }
  571. }
  572. }
  573. </style>