renew.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. <template>
  2. <view class="container">
  3. <view class="member"></view>
  4. <view class="content">
  5. <view class="member_card">
  6. <view class="info flex_item">
  7. <view class="info-portrait"><image :src="userInfo.avatar"></image></view>
  8. <view class="info-tpl">
  9. <view class="tpl">{{userInfo.nickname}}</view>
  10. <view class="tip">美卡有效期至{{userInfo.level_valid_time}}</view>
  11. </view>
  12. </view>
  13. <view class="list flex">
  14. <view class="text">十菜美卡</view>
  15. <view class="btn" @click="navTo('/pages/user/member')">立即续费</view>
  16. </view>
  17. </view>
  18. <view class="assets">
  19. <view class="title">
  20. <image class="" src="/static/img/img33.png"></image>
  21. <view class="name">资产概况</view>
  22. </view>
  23. <view class="list flex">
  24. <view class="tpl">
  25. <view class="tip">{{userInfo.freight_coupon_count}}<text>次</text></view>
  26. <view>免费配送</view>
  27. </view>
  28. <view class="tpl">
  29. <view class="tip">{{userInfo.discount_coupon_count}}<text>张</text></view>
  30. <view>专享优惠券</view>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="assets">
  35. <view class="title">
  36. <image class="" src="/static/img/img33.png"></image>
  37. <view class="name">美卡特权</view>
  38. </view>
  39. <view class="privileges flex">
  40. <view class="privileges_list" v-for="(ls, index) in list" @click="clickNav(index)">
  41. <view class="img"><image :src="ls.img"></image></view>
  42. <view class="text">{{ls.text}}</view>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="discount flex" id="block1">
  47. <view class="tpl">
  48. <view class="name">美卡专享价</view>
  49. <view class="text">800+超值低价商品等你来拿</view>
  50. </view>
  51. <view class="tip">
  52. <view class="money">¥172</view>
  53. <view class="money">平均可省</view>
  54. </view>
  55. </view>
  56. <view class="goods">
  57. <view class="list flex_item" v-for="ls in goods" @click="ToDetail(ls)">
  58. <view class="list-img"><image :src="ls.image"></image></view>
  59. <view class="list-info">
  60. <view class="name clamp">{{ls.store_name}}</view>
  61. <view class="describe clamp">{{ls.store_info}}</view>
  62. <view class="text" v-if="ls.keyword != ''"><text v-for="lss in ls.keyword">{{lss}}</text></view>
  63. <view class="price-box flex">
  64. <view class="price">
  65. <view class="grey">¥{{ls.price}}</view>
  66. <view class="red">¥{{ls.ot_price}}<text>市场价</text></view>
  67. </view>
  68. <view class="gocar position-relative" @click.stop="Addcar(ls)">
  69. <image src="/static/img/img21.png"></image>
  70. <view class="corner" v-if="ls.cart_num > 0">
  71. <text>{{ls.cart_num}}</text>
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. <view class="submit">查看800+美卡专享价商品</view>
  79. </view>
  80. </view>
  81. </template>
  82. <script>
  83. import { mapState } from 'vuex';
  84. import { getProducts } from '@/api/product.js';
  85. import { cartAdd } from '@/api/product.js';
  86. export default {
  87. data() {
  88. return {
  89. list:[
  90. {
  91. img: '/static/img/img51.png',
  92. text: '美卡专享价'
  93. },
  94. {
  95. img: '/static/img/img52.png',
  96. text: '美卡优惠卡包'
  97. },
  98. {
  99. img: '/static/img/img53.png',
  100. text: '免配送券'
  101. },
  102. {
  103. img: '/static/img/img54.png',
  104. text: '更多'
  105. }
  106. ],
  107. goods:'',
  108. block_1ScrollTop: '',
  109. };
  110. },
  111. onLoad() {
  112. this.loadDate();
  113. },
  114. onShow() {
  115. this.loadDate();
  116. },
  117. mounted() {
  118. var query = uni.createSelectorQuery();
  119. //获取对应模块到顶部的距离
  120. query
  121. .select('#block1')
  122. .boundingClientRect(res => {
  123. this.block_1ScrollTop = res.top;
  124. })
  125. .exec();
  126. },
  127. computed: {
  128. ...mapState('user',['userInfo'])
  129. },
  130. methods: {
  131. clickNav(index) {
  132. uni.pageScrollTo({
  133. scrollTop: this.block_1ScrollTop
  134. });
  135. },
  136. loadDate(){
  137. let obj = this;
  138. getProducts({
  139. page: 1,
  140. limit: 5,
  141. news: '',
  142. keyword: '',
  143. type:1
  144. }).then(e => {
  145. obj.goods = e.data;
  146. });
  147. },
  148. //加入购物车
  149. Addcar(item) {
  150. let obj = this;
  151. cartAdd({
  152. cartNum: '1', //商品数量
  153. uniqueId:'', //商品标签
  154. new: 0, //商品是否新增加到购物车1为不加入0为加入
  155. mer_id: '',
  156. productId: item.id//商品编号
  157. })
  158. .then(function(e) {
  159. uni.showToast({
  160. title: '成功加入购物车',
  161. type: 'top',
  162. duration: 500,
  163. icon: 'none'
  164. });
  165. obj.loadDate();
  166. })
  167. .catch(e => {
  168. console.log(e);
  169. });
  170. },
  171. // 商品详情页
  172. ToDetail(item) {
  173. uni.navigateTo({
  174. url: `/pages/product/product?id=`+item.id
  175. });
  176. },
  177. navTo(url) {
  178. uni.navigateTo({
  179. url
  180. });
  181. }
  182. }
  183. };
  184. </script>
  185. <style lang="scss">
  186. page {
  187. height: 100%;
  188. background-color: $page-color-base;
  189. .container {
  190. height: 100%;
  191. }
  192. }
  193. .member {
  194. background: #1c2532;
  195. height: 250rpx;
  196. width: 100%;
  197. border-bottom-left-radius: 20%;
  198. border-bottom-right-radius: 20%;
  199. }
  200. .content {
  201. width: 100%;
  202. height: 100%;
  203. margin-top: -120rpx;
  204. .member_card {
  205. width: 90%;
  206. margin: 0rpx auto;
  207. height: 300rpx;
  208. padding: 45rpx 45rpx;
  209. background: #2DBD59;
  210. border: 2rpx solid #FFE487;
  211. border-radius: 25rpx;
  212. .info{
  213. font-size: 26rpx;
  214. .info-portrait{
  215. width: 100rpx;
  216. height: 100rpx;
  217. border-radius: 100%;
  218. image{
  219. width: 100%;
  220. height: 100%;
  221. border-radius: 100%;
  222. }
  223. }
  224. .info-tpl{
  225. padding-left: 15rpx;
  226. .tpl{
  227. color: #FEEDA1;
  228. font-size: 32rpx;
  229. }
  230. .tip{
  231. color: #FFFFFF;
  232. padding-top: 10rpx;
  233. }
  234. }
  235. }
  236. .list{
  237. margin-top: 50rpx;
  238. .text{
  239. color: #FEEDA1;
  240. }
  241. .btn{
  242. background: #FFE487;
  243. color: #6E482B;
  244. padding: 15rpx 25rpx;
  245. border-radius: 50rpx;
  246. }
  247. }
  248. }
  249. }
  250. .assets{
  251. background: #FFFFFF;
  252. width: 100%;
  253. margin-top: 25rpx;
  254. padding: 25rpx 0rpx;
  255. text-align: center;
  256. .title{
  257. width: 85%;
  258. height: 3rpx;
  259. margin: 0rpx auto;
  260. image{
  261. width: 100%;
  262. height: 100%;
  263. }
  264. .name{
  265. position: relative;
  266. bottom: 40rpx;
  267. font-weight: bold;
  268. }
  269. }
  270. .list{
  271. margin-top: 100rpx;
  272. padding: 0rpx 120rpx;
  273. font-size: 24rpx;
  274. margin-bottom: 40rpx;
  275. .tpl{
  276. color: #666666;
  277. .tip{
  278. font-size: 40rpx;
  279. font-weight: bold;
  280. color: #303133;
  281. padding-bottom: 15rpx;
  282. text{
  283. font-size: 24rpx;
  284. font-weight: normal;
  285. }
  286. }
  287. }
  288. }
  289. .privileges{
  290. margin-top: 100rpx;
  291. font-size: 24rpx;
  292. margin-bottom: 40rpx;
  293. position: relative;
  294. width: 100%;
  295. .privileges_list{
  296. text-align: center;
  297. width: 200rpx !important;
  298. .img{
  299. height: 80rpx;
  300. text-align: center;
  301. image{
  302. width: 80rpx;
  303. height: 100%;
  304. }
  305. }
  306. .text{
  307. padding-top: 15rpx;
  308. }
  309. }
  310. }
  311. }
  312. .discount{
  313. width: 100%;
  314. padding: 50rpx 25rpx;
  315. .tpl{
  316. .name{
  317. font-size: 36rpx;
  318. color: #333333;
  319. font-weight: bold;
  320. }
  321. .text{
  322. color: #999999;
  323. font-size: 24rpx;
  324. padding-top: 15rpx;
  325. }
  326. }
  327. .tip{
  328. background: #1C2532;
  329. border-radius: 40rpx;
  330. padding: 18rpx 24rpx;
  331. border-bottom-right-radius: 10rpx !important;
  332. .money{
  333. background:linear-gradient(270deg,rgba(204,178,121,1) 0%, rgba(245,234,197,1) 100%);
  334. -webkit-background-clip:text;
  335. -webkit-text-fill-color:transparent;
  336. font-weight: bold;
  337. font-size: 36rpx;
  338. }
  339. }
  340. }
  341. .goods{
  342. padding: 0rpx 25rpx;
  343. width: 92%;
  344. margin: 0rpx auto;
  345. background: #FFFFFF;
  346. border-radius: 15rpx;
  347. margin-bottom: 50rpx;
  348. .list{
  349. border-bottom: 2rpx solid #F0F0F0;
  350. padding: 25rpx 0rpx;
  351. .list-img{
  352. width: 225rpx;
  353. height: 225rpx;
  354. image{
  355. width: 100%;
  356. height: 100%;
  357. }
  358. }
  359. .list-info{
  360. padding-left: 25rpx;
  361. width: 60%;
  362. .name{
  363. color: #333333;
  364. font-size: 30rpx;
  365. font-weight:500;
  366. }
  367. .describe{
  368. color: #999999;
  369. font-size: 24rpx;
  370. margin: 15rpx 0rpx;
  371. padding-bottom: 15rpx;
  372. }
  373. .text{
  374. color: #FF383E;
  375. // padding: 15rpx 0rpx;
  376. text{
  377. border-radius: 10rpx;
  378. border: 2rpx solid #FF383E;
  379. font-size: 20rpx;
  380. padding: 2rpx 15rpx;
  381. }
  382. }
  383. .price-box{
  384. .price{
  385. font-size: 26rpx;
  386. .grey{
  387. color: #666666;
  388. text-decoration:line-through;
  389. }
  390. .red{
  391. color: #2DBD59;
  392. text{
  393. margin-left: 15rpx;
  394. background: #2DBD59;
  395. color: #FFFFFF;
  396. border-radius: 10rpx;
  397. padding: 3rpx 15rpx;
  398. }
  399. }
  400. }
  401. .gocar{
  402. width: 50rpx;
  403. height: 50rpx;
  404. image{
  405. width: 100%;
  406. height: 100%;
  407. }
  408. }
  409. }
  410. }
  411. }
  412. }
  413. .submit{
  414. background: #FFE487;
  415. width: 92%;
  416. margin: 0rpx auto;
  417. padding: 25rpx 0rpx;
  418. text-align: center;
  419. margin-bottom: 100rpx;
  420. border-radius: 15rpx;
  421. font-weight:bold;
  422. color:rgba(51,51,51,1);
  423. font-size: 30rpx;
  424. }
  425. </style>