1
0

level.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. <template>
  2. <view class="app-layout">
  3. <app-layout>
  4. <!-- :style="bg" -->
  5. <view class="app-level" style="background-image: url('https://qiantengteng.9026.com/web/statics/img/mall/bg.png');" v-if="list">
  6. <!--<view class="title" v-if="list.length > 0">
  7. {{list.length > 1 ? (list.length == 2 ? '两' : '三') + '者满足其一即可升级' : '满足以下条件即可升级'}}
  8. </view>-->
  9. <view class="title">等级说明</view>
  10. <view class="list">
  11. <block v-for="(item, index) in list" :key="index">
  12. <view class="item dir-left-nowrap">
  13. <template v-if="index != 0">
  14. <image src="./../image/shuxian.png" class="shuxian left"></image>
  15. <image src="./../image/shuxian.png" class="shuxian right"></image>
  16. </template>
  17. <view class="content box-grow-1" v-if="item.condition_type == 1">下线人数达到
  18. <text>{{item.condition}}</text>
  19. </view>
  20. <view class="content box-grow-1" v-else-if="item.condition_type == 2">当月业绩累计
  21. <text class="price">{{item.condition}}</text> {{userLevel==2?'即可升级':'即可保持'}}
  22. </view>
  23. <!-- <view class="content box-grow-1" v-else-if="item.condition_type == 3">已提现佣金达到
  24. <text class="price">{{item.condition}}</text>
  25. </view>
  26. <view class="content box-grow-1" v-else-if="item.condition_type == 4">累计消费金额达到
  27. <text class="price">{{item.condition}}</text>
  28. </view>-->
  29. <view class="box-grow-0 dir-left-nowrap cross-center right" @click="ruleClick(item)">
  30. <view class="box-grow-0">等级说明</view>
  31. <image class="box-grow-0 arrow-right" src="/static/image/icon/arrow-right.png"></image>
  32. </view>
  33. </view>
  34. </block>
  35. </view>
  36. <block v-if="!review">
  37. <view class="level-btn" @click="levelUp" v-if="autoLevelUp">
  38. 立即升级
  39. </view>
  40. </block>
  41. <block v-else-if="review">
  42. <view class="level-btn">
  43. 请等待审核
  44. </view>
  45. </block>
  46. <view class="dialog dir-left-nowrap main-center cross-center" v-if="dialog.show">
  47. <view class="content dir-top-nowrap cross-center" :style="dialogBg">
  48. <view class="dialog-title">{{dialog.condition_text}}</view>
  49. <view>{{dialog.level_name}}</view>
  50. <view class="btn" :class="'btn-' + dialog.status" @click="cancel">我知道了</view>
  51. </view>
  52. </view>
  53. <view class="dialog dir-left-nowrap main-center cross-center" v-if="rule.show">
  54. <view class="rule dir-top-nowrap cross-center">
  55. <image class="box-grow-0 close" @click="rule.show = false" src="/static/image/icon/icon-close.png"></image>
  56. <view class="rule-title">等级说明</view>
  57. <text class="rule-content">{{rule.content}}</text>
  58. <view class="btn" @click="rule.show = false">我知道了</view>
  59. </view>
  60. </view>
  61. </view>
  62. </app-layout>
  63. </view>
  64. </template>
  65. <script>
  66. import {mapState} from 'vuex';
  67. export default {
  68. name: "level",
  69. onLoad() {
  70. this.loadData();
  71. },
  72. data() {
  73. return {
  74. list: null,
  75. dialog: {
  76. show: false,
  77. status: 0,
  78. level_name: '',
  79. condition_text: '',
  80. },
  81. rule: {
  82. show: false,
  83. content: ''
  84. },
  85. autoLevelUp:false,
  86. review:false,
  87. userLevel:0,
  88. };
  89. },
  90. computed: {
  91. ...mapState({
  92. mallConfig: state => state.mallConfig,
  93. }),
  94. dialogBg() {
  95. if (this.dialog.status) {
  96. return `background-image: url(${this.mallConfig.__wxapp_img.share.dialog_success})`;
  97. } else {
  98. return `background-image: url(${this.mallConfig.__wxapp_img.share.dialog_error})`;
  99. }
  100. },
  101. bg() {
  102. if (this.list) {
  103. if (this.list.length > 0) {
  104. return `background-image: url(${this.mallConfig.__wxapp_img.share.sharebg})`;
  105. } else {
  106. return `background-image: url(${this.mallConfig.__wxapp_img.share.no_level_bg})`;
  107. }
  108. } else {
  109. return ``;
  110. }
  111. },
  112. },
  113. methods: {
  114. loadData() {
  115. this.$showLoading();
  116. this.$request({
  117. url: this.$api.share.level,
  118. }).then(response => {
  119. this.$hideLoading();
  120. if (response.code == 0) {
  121. this.list = response.data.list;
  122. this.autoLevelUp = response.data.autoLevelUp;
  123. this.review = response.data.review;
  124. this.userLevel = response.data.userLevel;
  125. } else {
  126. uni.showModal({
  127. content: response.msg,
  128. showCancel: false
  129. })
  130. }
  131. }).catch(response => {
  132. this.$hideLoading();
  133. })
  134. },
  135. levelUp() {
  136. uni.showLoading({
  137. title: '升级中...'
  138. });
  139. this.$request({
  140. url: this.$api.share.apply_level_up,
  141. }).then(response => {
  142. uni.hideLoading();
  143. if (response.code == 0) {
  144. this.dialog.show = true;
  145. this.dialog.condition_text = response.msg;
  146. this.dialog.status = 1;
  147. this.review = true
  148. } else {
  149. uni.showModal({
  150. content: response.msg,
  151. showCancel: false
  152. })
  153. }
  154. }).catch(response => {
  155. uni.hideLoading();
  156. })
  157. },
  158. cancel() {
  159. this.dialog.show = false;
  160. if (this.dialog.status == 1) {
  161. this.loadData();
  162. }
  163. },
  164. ruleClick(item) {
  165. this.rule.show = true;
  166. this.rule.content = item.rule;
  167. }
  168. }
  169. }
  170. </script>
  171. <style scoped lang="scss">
  172. .app-level {
  173. height: 100vh;
  174. width: 100%;
  175. background-size: cover;
  176. background-repeat: no-repeat;
  177. background-position: center;
  178. .title {
  179. font-size: #{57rpx};
  180. color: #ffffff;
  181. padding: #{80rpx 0};
  182. width: 100%;
  183. text-align: center;
  184. }
  185. .list {
  186. padding: #{0 33rpx};
  187. .item {
  188. position: relative;
  189. background: #ffffff;
  190. border-radius: #{20rpx};
  191. height: #{130rpx};
  192. line-height: #{130rpx};
  193. margin-bottom: #{24rpx};
  194. .shuxian {
  195. width: #{16rpx};
  196. height: #{60rpx};
  197. display: block;
  198. top: #{-43rpx};
  199. position: absolute;
  200. &.left {
  201. left: #{78rpx};
  202. }
  203. &.right {
  204. right: #{78rpx};
  205. }
  206. }
  207. .content {
  208. padding-left: #{60rpx};
  209. text {
  210. color: #e33d41;
  211. &.price:before {
  212. content: '¥';
  213. }
  214. }
  215. }
  216. .right {
  217. font-size: $uni-font-size-weak-two;
  218. color: $uni-general-color-two;
  219. .arrow-right {
  220. width: #{12rpx};
  221. height: #{22rpx};
  222. margin-left: #{12rpx};
  223. margin-right: #{25rpx};
  224. display: block;
  225. }
  226. }
  227. }
  228. }
  229. .level-btn {
  230. text-align: center;
  231. width: #{534rpx};
  232. height: #{88rpx};
  233. line-height: #{88rpx};
  234. margin: #{50rpx 108rpx};
  235. font-size: #{43rpx};
  236. color: #895c4c;
  237. border-radius: #{50rpx};
  238. background-image: linear-gradient(to right, #ffddad , #ffce98);
  239. }
  240. .dialog {
  241. position: fixed;
  242. top: 0;
  243. left: 0;
  244. background: rgba(0, 0, 0, 0.5);
  245. width: 100%;
  246. height: 100%;
  247. .content {
  248. width: #{436rpx};
  249. height: #{492rpx};
  250. background-size: cover;
  251. background-repeat: no-repeat;
  252. background-position: center;
  253. font-size: $uni-font-size-weak-one;
  254. color: #545454;
  255. .dialog-title {
  256. margin-top: #{255rpx};
  257. margin-bottom: #{30rpx};
  258. }
  259. .btn {
  260. margin-top: #{30rpx};
  261. width: #{272rpx};
  262. height: #{60rpx};
  263. color: #ffffff;
  264. border-radius: #{60rpx};
  265. text-align: center;
  266. line-height: #{60rpx};
  267. &.btn-1 {
  268. background: #ff4e47;
  269. }
  270. &.btn-0 {
  271. background: #ffbf7a;
  272. }
  273. }
  274. }
  275. .rule {
  276. width: #{650rpx};
  277. background-color: #ffffff;
  278. border-radius: #{20rpx};
  279. position: relative;
  280. .close {
  281. position: absolute;
  282. right: #{24rpx};
  283. top: #{24rpx};
  284. width: #{30rpx};
  285. height: #{30rpx};
  286. }
  287. .rule-title {
  288. margin: #{40rpx 0};
  289. }
  290. .rule-content {
  291. width: #{calc(100% - 64rpx)};
  292. margin: #{0 32rpx};
  293. padding: #{20rpx 32rpx};
  294. height: #{270rpx};
  295. overflow-y: auto;
  296. border: #{1rpx solid #e2e2e2};
  297. border-radius: #{16rpx};
  298. }
  299. .btn {
  300. width: 100%;
  301. height: #{90rpx};
  302. line-height: #{90rpx};
  303. text-align: center;
  304. color: $uni-general-color-one;
  305. font-size: $uni-font-size-import-two;
  306. border-top: #{1rpx solid #e2e2e2};
  307. margin-top: #{32rpx};
  308. }
  309. }
  310. }
  311. }
  312. </style>