update.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <app-layout>
  3. <image :src="region.detail" class="bg"></image>
  4. <view class="info">
  5. <image class="avatar" :src="detail.avatar"></image>
  6. <image v-if="detail.level_up_log && detail.level_up_log.status == 1" class="success-img" :src="bonus.success"></image>
  7. <view v-if="detail.level_up_log && detail.level_up_log.status == 1" class="update main-between cross-center">
  8. <text>恭喜您已升级成为{{detail.province_text}}的
  9. <text v-if="detail.level == 1">省代理</text>
  10. <text v-if="detail.level == 2">市代理</text>
  11. </text>
  12. </view>
  13. <view v-if="detail.is_up == 1" class="update main-between cross-center">
  14. <view v-if="detail.level_up_log && detail.level_up_log.status == 0">正在申请成为{{detail.province_text}}的{{detail.level_up.level_desc}}</view>
  15. <view v-else>可升级为{{detail.province_text}}的{{detail.level_up.level_desc}}</view>
  16. <view @click="toUpdate" class="update-btn">{{detail.level_up_log && detail.level_up_log.status == 0 ? '去查看':'去升级'}}</view>
  17. </view>
  18. <view class="title main-center cross-center">
  19. <image src="./../image/title-left.png"></image>
  20. <view>代理级别</view>
  21. <image src="./../image/title-right.png"></image>
  22. </view>
  23. <view class="level-info">
  24. <text v-if="detail.level == 1">省代理</text>
  25. <text v-if="detail.level == 2">市代理</text>
  26. <text v-if="detail.level == 3">区/县代理</text>
  27. <text class="placeholder">|</text>
  28. <text v-if="detail.bonus_rate">{{setting.form.rate ? setting.form.rate : '分红比例'}}{{detail.bonus_rate}}%</text>
  29. </view>
  30. <view class="title main-center cross-center">
  31. <image src="./../image/title-left.png"></image>
  32. <view>代理地区</view>
  33. <image src="./../image/title-right.png"></image>
  34. </view>
  35. <view>
  36. <text>{{detail.province_text}}</text>
  37. <text v-if="detail.level > 2 && detail.city_text">
  38. <text class="placeholder">-</text>
  39. {{detail.city_text}}
  40. </text>
  41. </view>
  42. <view class="relation-list" v-if="detail.level > 1 && !(detail.relation.length == 1 && detail.relation[0].name == detail.province_text)">
  43. <text v-for="(item,index) in detail.relation" :key="index">
  44. <text class="placeholder" v-if="index > 0">/</text>
  45. {{item.name}}
  46. </text>
  47. </view>
  48. </view>
  49. </app-layout>
  50. </template>
  51. <script>
  52. import { mapState } from "vuex";
  53. export default {
  54. data() {
  55. return {
  56. detail: {},
  57. setting: {},
  58. first: true,
  59. }
  60. },
  61. computed: {
  62. ...mapState({
  63. region: state => state.mallConfig.__wxapp_img.region,
  64. bonus: state => state.mallConfig.__wxapp_img.bonus,
  65. })
  66. },
  67. methods: {
  68. toUpdate() {
  69. uni.navigateTo({
  70. url: '/plugins/region/index/index?up=1'
  71. });
  72. },
  73. getList() {
  74. let that = this;
  75. that.$request({
  76. url: that.$api.region.status,
  77. }).then(response=>{
  78. if(response.code == 0) {
  79. that.first = false;
  80. that.$hideLoading();
  81. that.detail = response.data.region;
  82. if(that.detail.status != 1) {
  83. uni.redirectTo({
  84. url: '/plugins/region/index/index'
  85. })
  86. }
  87. if(that.detail.level_up_log.status == 1) {
  88. that.clearLevel();
  89. }
  90. }else {
  91. that.$hideLoading();
  92. uni.showToast({
  93. title: response.msg,
  94. icon: 'none',
  95. duration: 1000
  96. });
  97. }
  98. }).catch(response => {
  99. that.$hideLoading();
  100. });
  101. },
  102. clearLevel() {
  103. let that = this;
  104. that.$request({
  105. url: that.$api.region.clear_up,
  106. method: 'post'
  107. }).then(response=>{
  108. })
  109. },
  110. getSetting() {
  111. let that = this;
  112. that.$request({
  113. url: that.$api.region.setting,
  114. }).then(response=>{
  115. if(response.code == 0) {
  116. that.getList();
  117. that.setting = response.data;
  118. }else {
  119. uni.showToast({
  120. title: response.msg,
  121. icon: 'none',
  122. duration: 1000
  123. });
  124. }
  125. }).catch(response => {
  126. that.$hideLoading();
  127. uni.hideLoading();
  128. });
  129. },
  130. },
  131. onLoad(options) { this.$commonLoad.onload(options);
  132. let that = this;
  133. that.$showLoading({
  134. type: 'global',
  135. text: '加载中...'
  136. });
  137. that.getSetting();
  138. },
  139. onShow() {
  140. if(!this.first) {
  141. this.getList();
  142. }
  143. }
  144. }
  145. </script>
  146. <style scoped lang="scss">
  147. .bg {
  148. height: #{280rpx};
  149. width: 100%;
  150. }
  151. .success-img {
  152. display: block;
  153. height:#{320rpx};
  154. width:#{420rpx};
  155. margin: 0 auto #{20rpx};
  156. }
  157. .info {
  158. position: relative;
  159. z-index: 10;
  160. width: #{702rpx};
  161. margin: #{-148rpx} auto 0;
  162. border-radius: #{16rpx};
  163. background-color: #fff;
  164. box-shadow: 0 #{10rpx} #{10rpx} rgba(0, 0, 0, 0.05);
  165. text-align: center;
  166. padding-bottom: #{100rpx};
  167. font-size: #{32rpx};
  168. color: #353535;
  169. .avatar {
  170. width: #{140rpx};
  171. height: #{140rpx};
  172. border-radius: #{70rpx};
  173. border: #{4rpx} solid #fff;
  174. margin: #{-68rpx} auto 0;
  175. }
  176. .update {
  177. height: #{80rpx};
  178. width: #{590rpx};
  179. margin: #{56rpx} auto 0;
  180. padding: 0 #{28rpx};
  181. border-radius: #{8rpx};
  182. color: #ff4544;
  183. font-size: #{26rpx};
  184. background-color: #feeeee;
  185. .update-btn {
  186. width: #{100rpx};
  187. height: #{40rpx};
  188. line-height: #{40rpx};
  189. border-radius: #{20rpx};
  190. text-align: center;
  191. font-size: #{22rpx};
  192. color: #fff;
  193. background-color: #ff4544;
  194. }
  195. }
  196. .title {
  197. margin-top: #{60rpx};
  198. margin-bottom: #{50rpx};
  199. font-size: #{28rpx};
  200. color: #999999;
  201. image {
  202. width: #{120rpx};
  203. height: #{24rpx};
  204. display: block;
  205. }
  206. view {
  207. margin: 0 #{32rpx};
  208. }
  209. }
  210. .level-info {
  211. font-size: #{32rpx};
  212. color: #353535;
  213. margin: 0 0 #{14rpx};
  214. }
  215. .relation-list {
  216. width: #{590rpx};
  217. margin: #{10rpx} auto 0;
  218. }
  219. .placeholder {
  220. margin: 0 #{10rpx};
  221. }
  222. }
  223. </style>