多租户商城-商户小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

493 lines
15 KiB

2 years ago
2 years ago
  1. <template>
  2. <view class="memberCenter" v-if="ifShow">
  3. <global-loading />
  4. <view class="memberBox">
  5. <view class="posBox">
  6. <view class="memberBoxTop">
  7. <view class="memberTopPos" :style="{backgroundImage:'url('+levelInfo.memberLevelBackground+')'}">
  8. <view class="memberTopBg">
  9. <view class="flex-items">
  10. <view class="avatarBox">
  11. <image :src="memberData.headImage"></image>
  12. </view>
  13. <view class="nameBox">
  14. <view class="name fs36">{{memberData.name}}</view>
  15. <view class="level">
  16. <image :src="levelInfo.memberLevelIcon"></image>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="integralInfo flex-items flex-sp-between mar-top-20">
  21. <view class="itemBox">
  22. <view class="integraNum fs32 font-color-333 fs-weight-400">{{ memberData.totalCredit }}</view>
  23. <view class="fs24 font-color-333 fs-weight-400">累计积分</view>
  24. </view>
  25. <view class="itemBox">
  26. <view class="integraNum fs32 font-color-333 fs-weight-400">{{ memberData.totalCredit - memberData.credit }}</view>
  27. <view class="fs24 font-color-333 fs-weight-400">累计消费</view>
  28. </view>
  29. <view class="itemBox">
  30. <view class="integraNum fs32 font-color-333 fs-weight-400">{{ memberData.credit }}</view>
  31. <view class="fs24 font-color-333 fs-weight-400">剩余积分</view>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="signBox flex-items flex-sp-between mar-top-30" @click="goToSign">
  40. <view class="signLeft flex-items flex-sp-between">
  41. <view class="signIcon"></view>
  42. <view class="signText fs28 font-color-C5AA7B">积分签到</view>
  43. </view>
  44. <view class="u-arrow u-arrow-right"></view>
  45. </view>
  46. <view class="signTabs mar-top-30 flex-items">
  47. <view :class="{active: tabActive === 1}" class="tabItem flex-items flex-center" @click="changeTab(1)">
  48. <view class="icon detailIcon"></view>
  49. <text>积分明细</text>
  50. </view>
  51. <view :class="{active: tabActive === 2}" class="tabItem flex-items flex-center" @click="changeTab(2)">
  52. <view class="icon exchangeIcon"></view>
  53. <text>积分兑换</text>
  54. </view>
  55. </view>
  56. <view class="signInfo mar-top-20" v-if="tabActive === 1">
  57. <view class="signInBox">
  58. <view class="signItem flex-items flex-sp-between" v-for="(item, index) of integralRecord" :key="index">
  59. <view class="leftBox flex-items">
  60. <image src="https://ceres.zkthink.com/static/images/signIcon1.png"></image>
  61. <view class="leftInfo">
  62. <label class="fs28 font-color-333">{{item.recordContent}}</label>
  63. <view class="fs24 font-color-999">{{item.createTime}}</view>
  64. </view>
  65. </view>
  66. <view class="rightBtn">{{item.recordType === 1 ? '+' : '-'}}{{item.credit}}</view>
  67. </view>
  68. <view class="emptyCart-box flex-items-plus flex-column" v-if="integralRecord.length === 0">
  69. <image class="emptyCart-img" src="https://ceres.zkthink.com/static/images/searchEmpty.png"></image>
  70. <label class="font-color-999 fs26 mar-top-30">暂无记录~</label>
  71. </view>
  72. </view>
  73. </view>
  74. <view class="signExchange mar-top-20" v-else>
  75. <view class="exchangeInfoBox">
  76. <view class="exchangeItem flex-items flex-sp-between" v-for="(item, index) of creditCouponList" :key="index">
  77. <view class="exchangeLeft flex-items">
  78. <view class="discountBox mar-right-20">
  79. <view class="fs24" v-if="item.couponType === 1">{{item.fullMoney === 0 ? `无门槛减${item.reduceMoney}` : `${item.fullMoney}元减${item.reduceMoney}`}}</view>
  80. <view class="fs24" v-else>{{item.fullMoney === 0 ? `无门槛打${item.reduceMoney}` : `${item.fullMoney}元打${item.reduceMoney}`}}</view>
  81. <view class="fs30">{{item.couponType === 1 ? '满减券' : '折扣券'}}</view>
  82. </view>
  83. <view class="exchangeInfo">
  84. <view class="fs28 font-color-333" v-if="item.couponType === 1">{{item.fullMoney === 0 ? `无门槛减${item.reduceMoney}` : `${item.fullMoney}元减${item.reduceMoney}`}}</view>
  85. <view class="fs28 font-color-333" v-else>{{item.fullMoney === 0 ? `无门槛打${item.reduceMoney}` : `${item.fullMoney}元打${item.reduceMoney}`}}</view>
  86. <view class="fs24 state" v-if="item.stockNumber > 0">还剩{{item.stockNumber}}</view>
  87. <view class="fs24 state finish" v-else>已兑完</view>
  88. <view class="integral fs32">{{ item.credit }}积分</view>
  89. </view>
  90. </view>
  91. <view class="exchangeRight">
  92. <view class="exchangeBtn fs28 font-color-FFF" v-if="item.state === 0 && item.stockNumber !== 0" @click="goExchangeDetail(item)">兑换</view>
  93. <view class="exchangeBtn available fs28 font-color-FFF" v-if="item.stockNumber === 0">已兑完</view>
  94. <view class="exchangeBtn available fs28 font-color-FFF" v-if="item.state === 1" @click="goExchangeDetail(item)">已兑换</view>
  95. </view>
  96. </view>
  97. <view class="emptyCart-box flex-items-plus flex-column" v-if="creditCouponList.length === 0">
  98. <image class="emptyCart-img" src="https://ceres.zkthink.com/static/images/searchEmpty.png"></image>
  99. <label class="font-color-999 fs26 mar-top-30">暂无优惠券~</label>
  100. </view>
  101. </view>
  102. </view>
  103. <tui-modal :show="isConvertible" :custom="true" :fadein="true">
  104. <view class="Put-box1">
  105. <view class="text-align fs34 fs-bold">
  106. {{$t('common.notice_dialog_title')}}
  107. </view>
  108. <view class="mar-top-40 text-align">
  109. 您的积分不够哦请获取更多的积分!
  110. </view>
  111. <view class="flex-display flex-sp-between">
  112. <view class="btn" @click="goToSign">
  113. 去签到
  114. </view>
  115. </view>
  116. <view v-if="isConvertible" @click="isConvertible = false" class="cancelDel">
  117. <image src="https://ceres.zkthink.com/static/images/cancelClose.png" mode=""></image>
  118. </view>
  119. </view>
  120. </tui-modal>
  121. </view>
  122. </template>
  123. <script>
  124. import tuiModal from "@/components/modal/modal";
  125. const NET = require('../../utils/request')
  126. const API = require('../../config/api')
  127. export default {
  128. name: "index",
  129. components: {
  130. tuiModal
  131. },
  132. data() {
  133. return {
  134. memberData: {},
  135. equityList: [],
  136. integralRecord: [],
  137. creditCouponList: [],
  138. levelInfo: {},
  139. tabActive: 1,
  140. isConvertible: false,
  141. integralInfo: {
  142. page: 1,
  143. pageSize: 10,
  144. session: ""
  145. },
  146. couponListInfo: {
  147. page: 1,
  148. pageSize: 10,
  149. session: ""
  150. },
  151. ifShow: false
  152. }
  153. },
  154. onLoad(option) {
  155. this.memberData = uni.getStorageSync('storage_userInfo');
  156. this.GetUser()
  157. if (option.tabActive) {
  158. this.tabActive = parseInt(option.tabActive)
  159. }
  160. this.getIntegralList()
  161. this.getCreditCouponList()
  162. this.getMemberByMemberLevel()
  163. },
  164. methods: {
  165. GetUser() {
  166. NET.request(API.GetUser, {}, 'GET').then(res => {
  167. this.memberData = res.data
  168. uni.setStorageSync('storage_userInfo', this.memberData);
  169. }).catch(res => {
  170. })
  171. },
  172. getIntegralList() {
  173. // 获取签到信息
  174. // uni.showLoading({
  175. // mask: true,
  176. // title: '加载中...',
  177. // })
  178. NET.request(API.selectCreditRecord, this.integralInfo, 'POST').then(res => {
  179. // uni.hideLoading()
  180. this.ifShow = true
  181. this.integralRecord = res.data.list
  182. }).catch(res => {
  183. })
  184. },
  185. // 获取可兑换优惠券列表
  186. getCreditCouponList() {
  187. NET.request(API.selectCreditCouponList, this.couponListInfo, 'POST').then(res => {
  188. this.creditCouponList = res.data.list
  189. }).catch(res => {
  190. })
  191. },
  192. // 去首页
  193. goToShopping () {
  194. uni.switchTab({
  195. url: '../../pages/tabbar/index/index'
  196. })
  197. },
  198. getPercent(num, total){
  199. num = parseFloat(num);
  200. total = parseFloat(total);
  201. if (isNaN(num) || isNaN(total)) {
  202. return "-";
  203. }
  204. return total <= 0? "0%" : Math.round((num / total) * 10000) / 100.0;
  205. },
  206. // 获取会员等级
  207. getMemberByMemberLevel() {
  208. NET.request(`${API.getMemberByMemberLevel}/${this.memberData.memberLevelId}`,{}, 'GET').then(res => {
  209. this.levelInfo = res.data
  210. uni.setStorageSync('storage_levelInfo', this.levelInfo);
  211. }).catch(res => {
  212. })
  213. },
  214. // 签到
  215. goToSign() {
  216. uni.navigateTo({
  217. url: '../../pages_category_page1/integral/sign'
  218. })
  219. },
  220. // 跳转到兑换优惠详情
  221. goExchangeDetail (item) {
  222. if (this.memberData.credit < item.credit) {
  223. this.isConvertible = true
  224. } else {
  225. uni.navigateTo({
  226. url: `../integral/exchangeDetail?data=${JSON.stringify(item)}`
  227. })
  228. }
  229. },
  230. // 切换tab
  231. changeTab(type) {
  232. this.tabActive = type
  233. }
  234. }
  235. }
  236. </script>
  237. <style lang="scss" scoped>
  238. page {
  239. background: #F8F8F8;
  240. }
  241. .memberCenter {
  242. border-top: 2rpx solid #4b4b4b;
  243. background: url("https://ceres.zkthink.com/static/images/addBankBg.png") no-repeat left top;
  244. background-size: contain;
  245. min-height: 800rpx;
  246. padding: 0 20rpx;
  247. .memberBox {
  248. min-height: 230rpx;
  249. margin-top: 120rpx;
  250. width: 100%;
  251. border-radius: 25rpx;
  252. background-size: contain;
  253. position: relative;
  254. box-sizing: border-box;
  255. .posBox {
  256. position: absolute;
  257. width: 100%;
  258. left: 0;
  259. top: -80rpx;
  260. }
  261. .memberBoxTop {
  262. position: relative;
  263. .memberTopPos{
  264. //background: url("https://ceres.zkthink.com/static/images/integralBg.png") no-repeat left top;
  265. background-size: cover;
  266. height: 302rpx;
  267. border-radius: 24rpx;
  268. box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.05);
  269. .memberTopBg {
  270. padding: 40rpx 30rpx;
  271. .integralInfo {
  272. padding: 0 50rpx;
  273. .itemBox {
  274. text-align: center;
  275. }
  276. }
  277. }
  278. }
  279. }
  280. .avatarBox {
  281. margin-left: 30rpx;
  282. image {
  283. width: 110rpx;
  284. height: 110rpx;
  285. border: 5rpx solid #FFFFFF;
  286. border-radius: 50%;
  287. }
  288. }
  289. .nameBox {
  290. margin-left: 20rpx;
  291. .name {
  292. color: #333333;
  293. margin-right: 30rpx;
  294. }
  295. .level {
  296. image {
  297. width: 172rpx;
  298. height: 50rpx;
  299. }
  300. }
  301. }
  302. }
  303. .signBox {
  304. background: #f9f6ed;
  305. height: 96rpx;
  306. border-radius: 24rpx;
  307. padding: 0 20rpx;
  308. .signLeft {
  309. .signIcon {
  310. background: url("https://ceres.zkthink.com/static/images/signIcon.png") no-repeat center left;
  311. background-size: contain;
  312. height: 120rpx;
  313. width: 96rpx;
  314. margin-right: 20rpx;
  315. }
  316. }
  317. .u-arrow {
  318. width: 24rpx;
  319. height: 24rpx;
  320. border-top: 3rpx solid #C5AA7B;
  321. border-right: 3rpx solid #C5AA7B;
  322. }
  323. }
  324. .signTabs {
  325. .tabItem {
  326. width: 50%;
  327. height: 96rpx;
  328. border-radius: 16rpx;
  329. text {
  330. color: #999999;
  331. font-size: 28rpx;
  332. }
  333. .icon {
  334. width: 40rpx;
  335. height: 40rpx;
  336. margin-right: 15rpx;
  337. }
  338. .detailIcon {
  339. background: url("https://ceres.zkthink.com/static/images/detailIcon.png") no-repeat center center;
  340. background-size: contain;
  341. }
  342. .exchangeIcon {
  343. background: url("https://ceres.zkthink.com/static/images/exchangeIcon.png") no-repeat center center;
  344. background-size: contain;
  345. }
  346. }
  347. .active {
  348. background: #333333;
  349. .detailIcon {
  350. background: url("https://ceres.zkthink.com/static/images/detailIcon1.png") no-repeat center center;
  351. background-size: contain;
  352. }
  353. .exchangeIcon {
  354. background: url("https://ceres.zkthink.com/static/images/exchangeIcon1.png") no-repeat center center;
  355. background-size: contain;
  356. }
  357. text {
  358. color: #FFEBC4;
  359. }
  360. }
  361. }
  362. .signInfo {
  363. background: #FFFFFF;
  364. border-radius: 16rpx;
  365. box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.05);
  366. padding: 30rpx;
  367. .signInBox {
  368. .signItem {
  369. border-top: 2rpx solid #F3F4F5;
  370. padding: 30rpx 0;
  371. .leftBox {
  372. image {
  373. width: 90rpx;
  374. height: 90rpx;
  375. margin-right: 30rpx;
  376. }
  377. }
  378. }
  379. .signItem:first-child {
  380. border-top: none;
  381. }
  382. .rightBtn {
  383. width: 160rpx;
  384. height: 58rpx;
  385. line-height: 58rpx;
  386. background: #FFF9F6;
  387. border-radius: 10rpx;
  388. color: #C83732;
  389. text-align: center;
  390. font-weight: 300;
  391. font-size: 24rpx;
  392. }
  393. }
  394. }
  395. .signExchange {
  396. box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.05);
  397. background: #FFFFFF;
  398. border-radius: 16rpx;
  399. padding: 40rpx 30rpx;
  400. .exchangeInfoBox {
  401. .exchangeItem {
  402. padding-bottom: 20rpx;
  403. margin-bottom: 20rpx;
  404. border-bottom: 2rpx #F3F4F5 solid;
  405. .exchangeLeft {
  406. .discountBox {
  407. color: #FDFED6;
  408. width: 300rpx;
  409. height: 146rpx;
  410. background: url('https://ceres.zkthink.com/static/images/exchangeItem.png') no-repeat left top;
  411. background-size: contain;
  412. padding: 30rpx 25rpx;
  413. }
  414. .exchangeInfo {
  415. .state {
  416. text-align: center;
  417. background: #333333;
  418. color: #FFEBC4;
  419. font-size: 24rpx;
  420. margin: 8rpx 0 4rpx 0;
  421. padding: 8rpx 14rpx;
  422. border-radius: 8rpx;
  423. }
  424. .finish {
  425. color: #CCCCCC;
  426. border: 2rpx solid #CCCCCC;
  427. background: none;
  428. }
  429. .integral {
  430. color: #D72E2E;
  431. }
  432. }
  433. }
  434. .exchangeRight {
  435. height: 146rpx;
  436. display: flex;
  437. flex-direction: column;
  438. justify-content: flex-end;
  439. .exchangeBtn {
  440. width: 120rpx;
  441. height: 48rpx;
  442. line-height: 48rpx;
  443. text-align: center;
  444. background: linear-gradient(90deg, #C83732 0%, #E25C44 100%);
  445. box-shadow: 0 6rpx 12rpx rgba(233, 0, 0, 0.3);
  446. border-radius: 24rpx;
  447. }
  448. .available {
  449. background: linear-gradient(90deg, #C83732 0%, #E25C44 100%);
  450. box-shadow: 0 6rpx 12rpx rgba(233, 0, 0, 0.3);
  451. }
  452. }
  453. }
  454. .exchangeItem:last-child {
  455. border-bottom: none;
  456. }
  457. }
  458. }
  459. .cancelDel {
  460. position: absolute;
  461. bottom: -100rpx;
  462. left: 45%;
  463. image {
  464. width: 60upx;
  465. height: 60upx;
  466. }
  467. }
  468. .Put-box1 {
  469. .btn {
  470. margin-top: 50rpx;
  471. width: 100%;
  472. height: 84rpx;
  473. line-height: 84rpx;
  474. text-align: center;
  475. background: #333333;
  476. color: #FFEBC4;
  477. }
  478. }
  479. .emptyCart-box{
  480. margin: 60upx 0;
  481. .emptyCart-img{
  482. width: 113upx;
  483. height: 98upx;
  484. }
  485. }
  486. }
  487. </style>