detail.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. <template>
  2. <app-layout>
  3. <view class="page">
  4. <image class="bg" ref="bg" :src="memberImg.bg"></image>
  5. <view class="member-list">
  6. <swiper class="member-bannner" :current="index" @change="change" previous-margin="20px" next-margin="20px">
  7. <swiper-item class="member-item" v-for="item in list" :key="item.id">
  8. <image class="member-img" :src="item.bg_pic_url ? item.bg_pic_url : item.pic_url"></image>
  9. </swiper-item>
  10. </swiper>
  11. <view class="member-name main-center cross-center">{{detail.name}}</view>
  12. <view class="triangle"></view>
  13. </view>
  14. <view class="rights">
  15. <view class="main-center title">
  16. <image src="./../image/left.png"></image>
  17. <view class="title-name">权益介绍</view>
  18. <image src="./../image/right-right.png"></image>
  19. </view>
  20. <view class="rights-list">
  21. <view :class="[`rights-item`,_num == item.id ? `active` : ``]" v-for="(item,index) in detail.rights" :key="item.id">
  22. <view @click="tab(item.id,index)">
  23. <image class="rights-img" :src="item.pic_url"></image>
  24. <view class="t-omit" style="display:block;">{{item.title}}</view>
  25. </view>
  26. <view class="explain" v-if="_num == item.id" :style="{'left': `${explainLeft}`}">
  27. <view class="explain-triangle" :style="{'left': `${triangleLeft}%`}"></view>
  28. <image class="explain-img" src="./../image/right.png"></image>
  29. <view class="explain-text">
  30. <view class="explain-title">特权说明</view>
  31. <app-rich-text class="text" :content="item.content"></app-rich-text>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </app-layout>
  39. </template>
  40. <script>
  41. import appRichText from "../../../components/basic-component/app-rich/parse.vue";
  42. import { mapState } from "vuex";
  43. export default {
  44. data() {
  45. return {
  46. _num: 0,
  47. explainLeft: '0rpx',
  48. move: false,
  49. prop: 0,
  50. name: '',
  51. money: '',
  52. triangleLeft: 8,
  53. member: true,
  54. show: true,
  55. index: 0,
  56. list: [],
  57. detail: [],
  58. }
  59. },
  60. name: "detail",
  61. components: {
  62. "app-rich-text": appRichText,
  63. },
  64. computed: {
  65. ...mapState({
  66. theme: state => state.mallConfig.theme,
  67. memberImg: state => state.mallConfig.__wxapp_img.member,
  68. })
  69. },
  70. methods: {
  71. toMove() {
  72. this.move = true
  73. },
  74. tab(num,index) {
  75. let that = this;
  76. if((index+1) % 3 == 1) {
  77. that.triangleLeft = 8
  78. that.explainLeft = '0rpx'
  79. }else if((index+1) % 3 == 2) {
  80. that.explainLeft = '-248rpx'
  81. that.triangleLeft = 50
  82. }else {
  83. that.explainLeft = '-496rpx'
  84. that.triangleLeft = 86
  85. }
  86. if(that._num == num) {
  87. that.show = false;
  88. that._num = 0;
  89. return false
  90. }else {
  91. let index;
  92. that._num = num;
  93. for (let i = 0; i < that.detail.rights.length; i++) {
  94. if (num == that.detail.rights[i].id) {
  95. index = i;
  96. }
  97. }
  98. that.show = true;
  99. that.move = false;
  100. that.$forceUpdate();
  101. }
  102. },
  103. change(e) {
  104. let that = this;
  105. let index = e.detail.current;
  106. this.detail = this.list[index];
  107. this.show = false;
  108. },
  109. getList() {
  110. let that = this;
  111. that.$showLoading({
  112. type: 'global',
  113. text: '加载中...'
  114. });
  115. that.$request({
  116. url: that.$api.member.all,
  117. method: 'get',
  118. }).then(response=>{
  119. that.$hideLoading();
  120. if(response.code == 0) {
  121. that.list = response.data.list;
  122. that.index = 0;
  123. if (that.level > 0) {
  124. for (let i = 0; i < that.list.length; i++) {
  125. if (that.level == that.list[i].level) {
  126. that.index = i
  127. }
  128. }
  129. }
  130. that.detail = that.list[that.index];
  131. that._num = that.list[that.index].rights[0].id;
  132. that.content = that.list[that.index].rights[0].content;
  133. if (that.list[that.index].rights.length == 2) {
  134. that.x = 33
  135. } else if (that.list[that.index].rights.length == 1) {
  136. that.x = 50;
  137. }
  138. that.toView = 'to' + (that.detail.id);
  139. }else {
  140. uni.showToast({
  141. title: response.msg,
  142. icon: 'none',
  143. duration: 1000
  144. });
  145. }
  146. }).catch(response => {
  147. that.$hideLoading();
  148. });
  149. },
  150. },
  151. onLoad(options) {
  152. let that = this;
  153. if (options.level > 0) {
  154. that.level = options.level;
  155. } else {
  156. that.level = 0;
  157. }
  158. if (options.prop > 0) {
  159. that.prop = options.prop * 3;
  160. } else {
  161. that.prop = 0;
  162. }
  163. that.getList();
  164. }
  165. }
  166. </script>
  167. <style scoped lang="scss">
  168. .page {
  169. position: absolute;
  170. left: 0;
  171. top: 0;
  172. background-color: #fff;
  173. width: 100%;
  174. height: 100%;
  175. .bg {
  176. height: #{464rpx};
  177. width: 100%;
  178. }
  179. .member-list {
  180. height: #{464rpx};
  181. width: 100%;
  182. position: absolute;
  183. left: 0;
  184. top: #{36rpx};
  185. z-index: 0;
  186. display: block;
  187. .member-bannner {
  188. height: #{320rpx};
  189. .member-item {
  190. display: flex;
  191. justify-content: center;
  192. .member-img {
  193. width: #{620rpx};
  194. height: #{320rpx};
  195. border-radius: #{16rpx};
  196. }
  197. }
  198. }
  199. .member-name {
  200. font-size: #{32rpx};
  201. color: #fff;
  202. position: absolute;
  203. width: 100%;
  204. text-align: center;
  205. z-index: 10;
  206. height: #{100rpx};
  207. }
  208. .triangle {
  209. position: absolute;
  210. bottom: #{36rpx};
  211. left: 0;
  212. right: 0;
  213. margin: 0 auto;
  214. width: 0;
  215. height: 0;
  216. border-left: #{18rpx} solid transparent;
  217. border-right: #{18rpx} solid transparent;
  218. border-bottom: #{24rpx} solid #fff;
  219. }
  220. }
  221. .rights {
  222. position: relative;
  223. background-color: #fff;
  224. border-top-left-radius: #{16rpx};
  225. border-top-right-radius: #{16rpx};
  226. padding-bottom: #{50rpx};
  227. .title {
  228. font-size: #{36rpx};
  229. color: #666666;
  230. margin-top: #{55rpx};
  231. height: #{50rpx};
  232. line-height: #{50rpx};
  233. .title-name {
  234. margin: 0 #{30rpx};
  235. }
  236. image {
  237. display: block;
  238. margin-top: #{15rpx};
  239. height: #{20rpx};
  240. width: #{110rpx};
  241. }
  242. }
  243. .rights-list {
  244. margin-top: #{58rpx};
  245. text-align: left;
  246. position: relative;
  247. .rights-item {
  248. width: #{150rpx};
  249. margin: 0 #{50rpx};
  250. font-size: #{26rpx};
  251. color: #353535;
  252. vertical-align: top;
  253. text-align: center;
  254. display: inline-block;
  255. .rights-img {
  256. margin-top: #{30rpx};
  257. margin-bottom: #{12rpx};
  258. height: #{80rpx};
  259. width: #{80rpx};
  260. }
  261. }
  262. .rights-item.active {
  263. font-size: #{32rpx};
  264. font-weight: bold;
  265. .rights-img {
  266. margin-top: 0;
  267. width: #{120rpx};
  268. height: #{120rpx};
  269. }
  270. }
  271. .explain {
  272. width: #{640rpx};
  273. border-radius: #{16rpx};
  274. padding: #{56rpx} #{50rpx} #{50rpx} #{126rpx};
  275. margin: #{50rpx} auto #{20rpx};
  276. font-size: #{28rpx};
  277. color: #666;
  278. position: relative;
  279. background-color: #f7f7f7;
  280. .explain-img {
  281. height: #{46rpx};
  282. width: #{46rpx};
  283. position: absolute;
  284. top: #{56rpx};
  285. left: #{40rpx};
  286. }
  287. .explain-title {
  288. font-size: #{32rpx};
  289. color: #353535;
  290. text-align: left;
  291. margin-bottom: 24px;
  292. }
  293. .explain-triangle {
  294. border-bottom: #{24rpx} solid #f7f7f7;
  295. margin-left: 0;
  296. top: #{-22rpx};
  297. position: absolute;
  298. width: 0;
  299. height: 0;
  300. border-left: #{18rpx} solid transparent;
  301. border-right: #{18rpx} solid transparent;
  302. }
  303. }
  304. }
  305. }
  306. }
  307. </style>