1
0

level.vue 11 KB

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