多租户商城-商户小程序端
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.

496 lines
16 KiB

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