vipCard.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725
  1. <template>
  2. <view class="box">
  3. <view class="headerBox">
  4. <view class="vip">
  5. <view class="headerTop">
  6. <image src="../../static/img/vipheader.png" mode="" style="width: 80rpx;height: 80rpx;"></image>
  7. <view class="headerRight">
  8. <view class="nameBox">
  9. <view class="name">{{vipData.name}}</view>
  10. <image src="../../static/img/icon_vip.png" mode=""
  11. style="width: 112rpx;height: 34rpx;margin-left: 10rpx;"></image>
  12. </view>
  13. <view class="phone">{{userInfo.mobilePhone}}</view>
  14. </view>
  15. </view>
  16. <view class="kahaoBox">
  17. <image src="../../static/img/icon_kahao.png" mode=""
  18. style="width: 28rpx;height: 28rpx;margin-right: 10rpx;"></image>
  19. <view class="kahao">卡号 {{vipData.cardCode}}</view>
  20. </view>
  21. </view>
  22. <view class="tab">
  23. <view>
  24. <view class="tabLine" :class="{tabActive:tabIndex==1}" @click="tabClick(1)">计次</view>
  25. <view :class="{line:tabIndex==1}"></view>
  26. </view>
  27. <viw>
  28. <view class="tabLine" :class="{tabActive:tabIndex==2}" @click="tabClick(2)">储值</view>
  29. <view :class="{line:tabIndex==2}"></view>
  30. </viw>
  31. </view>
  32. </view>
  33. <!-- 计次 -->
  34. <view class="mainBox" v-if="tabIndex==1">
  35. <view class="btnBox" @click="dis=!dis">
  36. <image v-if="dis" src="../../static/img/icon_selectY.png" mode="" style="width: 36rpx;height: 36rpx;">
  37. </image>
  38. <image v-else src="../../static/img/icon_selectN.png" mode="" style="width: 36rpx;height: 36rpx;">
  39. </image>
  40. <view style="margin-left: 10rpx;color: #3C3C3C;font-size: 24rpx;">不展示剩余为0项</view>
  41. </view>
  42. <view v-for="(item,index) in vipData.cardTimeList">
  43. <view v-if="AmountQtyJs(item.list)" class="itemBox">
  44. <view class="itemTop">
  45. <view class="itemName">{{item.PackName}}</view>
  46. <view class="tiaokuan" @click="useCl(item.useComment)">使用条款</view>
  47. </view>
  48. <view class="itemBottom" :class="{active:item.open}">
  49. <view class="shopName">{{item.shopName}}</view>
  50. <image @click="changeState(item)" v-if="item.open==false" src="../../static/img/icon_arrow_down.png"
  51. mode="" style="width: 34rpx;height: 22rpx;"></image>
  52. <image @click="changeState(item)" v-if="item.open==true" src="../../static/img/icon_arrow_up.png"
  53. mode="" style="width: 34rpx;height: 22rpx;"></image>
  54. </view>
  55. <view v-if="item.open">
  56. <!-- 不展示剩余为0项 -->
  57. <view class="itemBg" v-if="dis&&v.AmountQty!=0" v-for="(v,index2) in item.list" :key="index2">
  58. <view class="nameTop" v-if="v.FlowType==2"><span class="type">项目</span> {{v.FlowName}}</view>
  59. <view class="nameTop" v-if="v.FlowType==1"><span class="type">商品</span> {{v.FlowName}}</view>
  60. <view class="timeBottom">
  61. <view class="time" v-if="v.ExpireTime">有效期:{{v.ExpireTime.slice(0,10)}}</view>
  62. <view class="time" v-else>有效期:永久</view>
  63. <view>剩余/总:<span
  64. style="color: #FF3B30;">{{v.AmountQty}}</span>/{{v.TotalQty}}
  65. </view>
  66. </view>
  67. </view>
  68. <!-- 展示所有 -->
  69. <view class="itemBg" v-if="!dis" v-for="(v,index2) in item.list" :key="index2">
  70. <view class="nameTop" v-if="v.FlowType==2"><span class="type">项目</span> {{v.FlowName}}</view>
  71. <view class="nameTop" v-if="v.FlowType==1"><span class="type">商品</span> {{v.FlowName}}</view>
  72. <view class="timeBottom">
  73. <view class="time" v-if="v.ExpireTime">有效期:{{v.ExpireTime.slice(0,10)}}</view>
  74. <view class="time" v-else>有效期:永久</view>
  75. <view>剩余/总:<span
  76. style="color: #FF3B30;">{{v.AmountQty}}</span>/{{v.TotalQty}}
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. <!-- 无数据空白页 -->
  84. <nodata v-if="vipData.cardTimeList.length==0"></nodata>
  85. <!-- 使用条款-->
  86. <view class="shiyongBox" v-if="shiyongShow" @click="shiyongShow=false">
  87. <view class="shiyongCont" @click.stop="">
  88. <view class="shiyongContTop">
  89. <view class="shiyongContTopTitle">使用条款</view>
  90. <image src="../../static/img/icon_close.png" alt="" class="shiyongContTopX"
  91. @click="shiyongShow=false"></image>
  92. </view>
  93. <view class="shiyonghtml">
  94. <view v-html="useComment" v-if="useComment"></view>
  95. <view v-else class="shiyongno">使用条款暂无内容</view>
  96. </view>
  97. </view>
  98. </view>
  99. </view>
  100. <!-- 储值 -->
  101. <view class="mainBox" v-if="tabIndex==2">
  102. <view class="btnBox" @click="disCz=!disCz">
  103. <image v-if="disCz" src="../../static/img/icon_selectY.png" mode="" style="width: 36rpx;height: 36rpx;">
  104. </image>
  105. <image v-else src="../../static/img/icon_selectN.png" mode="" style="width: 36rpx;height: 36rpx;">
  106. </image>
  107. <view style="margin-left: 10rpx;color: #3C3C3C;font-size: 24rpx;">不展示剩余为0项</view>
  108. </view>
  109. <view v-for="(item,index) in vipData.carMoneyList">
  110. <!-- 不展示剩余为0项 -->
  111. <view v-if="disCz&&item.Money!=0" class="itemBox">
  112. <view class="itemTop">
  113. <view class="itemName">{{item.PacKName}}</view>
  114. <view class="tiaokuan" @click="useCl(item.useComment)">使用条款</view>
  115. </view>
  116. <view class="itemBottom" :class="{active:item.open}">
  117. <view class="shopName">{{item.ShopName}}</view>
  118. <view class="moneyBox"><span style="font-size: 24rpx; color: #FF3B30; padding-top: 2rpx;">¥</span><span class="money">{{item.Money}}</span> <span
  119. style="color: #999999;font-size: 24rpx;">( 充{{item.ChargeMoney}}送{{item.GiftMoney}} )</span>
  120. </view>
  121. <image @click="changeState(item)" v-if="item.open==false" src="../../static/img/icon_arrow_down.png"
  122. mode="" style="width: 34rpx;height: 22rpx;"></image>
  123. <image @click="changeState(item)" v-if="item.open==true" src="../../static/img/icon_arrow_up.png"
  124. mode="" style="width: 34rpx;height: 22rpx;"></image>
  125. </view>
  126. <view class="itemBg" v-if="item.open" v-for="(v,index2) in item.payList" :key="index2">
  127. <view class="timeBottom">
  128. <view class="time" v-if="v.CreateTime">{{v.CreateTime}}</view>
  129. <view v-if="v.Type==2">-{{v.Money}}</view>
  130. <view class="count" v-else>+{{v.Money}}</view>
  131. </view>
  132. </view>
  133. </view>
  134. <!-- 展示所有 -->
  135. <view v-if="!disCz" class="itemBox">
  136. <view class="itemTop">
  137. <view class="itemName">{{item.PacKName}}</view>
  138. <view class="tiaokuan" @click="useCl(item.useComment)">使用条款</view>
  139. </view>
  140. <view class="itemBottom" :class="{active:item.open}">
  141. <view class="shopName">{{item.ShopName}}</view>
  142. <view class="moneyBox"><span style="font-size: 24rpx; color: #FF3B30; padding-top: 2rpx;">¥</span><span class="money">{{item.Money}}</span> <span
  143. style="color: #999999;font-size: 24rpx;">( 充{{item.ChargeMoney}}送{{item.GiftMoney}} )</span>
  144. </view>
  145. <image @click="changeState(item)" v-if="item.open==false" src="../../static/img/icon_arrow_down.png"
  146. mode="" style="width: 34rpx;height: 22rpx;"></image>
  147. <image @click="changeState(item)" v-if="item.open==true" src="../../static/img/icon_arrow_up.png"
  148. mode="" style="width: 34rpx;height: 22rpx;"></image>
  149. </view>
  150. <view class="itemBg" v-if="item.open" v-for="(v,index2) in item.payList" :key="index2">
  151. <view class="timeBottom">
  152. <view class="time" v-if="v.CreateTime">{{v.CreateTime}}</view>
  153. <view v-if="v.Type==2">-{{v.Money}}</view>
  154. <view class="count" v-else>+{{v.Money}}</view>
  155. </view>
  156. </view>
  157. </view>
  158. </view>
  159. <!-- 无数据空白页 -->
  160. <nodata v-if="vipData.carMoneyList.length==0"></nodata>
  161. <!-- 使用条款-->
  162. <view class="shiyongBox" v-if="shiyongShow" @click="shiyongShow=false">
  163. <view class="shiyongCont" @click.stop="">
  164. <view class="shiyongContTop">
  165. <view class="shiyongContTopTitle">使用条款</view>
  166. <image src="../../static/img/icon_close.png" alt="" class="shiyongContTopX"
  167. @click="shiyongShow=false"></image>
  168. </view>
  169. <view class="shiyonghtml">
  170. <view v-html="useComment" v-if="useComment"></view>
  171. <view v-else class="shiyongno">使用条款暂无内容</view>
  172. </view>
  173. </view>
  174. </view>
  175. </view>
  176. <!-- 手机号授权 -->
  177. <view class="authorizBox" v-if="authorizShow" @click="authorizShow=false">
  178. <view class="authorizCont" @click.stop="">
  179. <view class="authorizName">{{wxOpenData.miniAppName}}</view>
  180. <view class="authorizMs">您好,欢迎访问本店,授权手机号登录能获取我们最新的促销活动哦~</view>
  181. <button class="authorizContbutton" type="default" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">授权</button>
  182. </view>
  183. <view style="text-align: center;padding-top: 56rpx;">
  184. <image src="../../../static/timg/icon_guanbi@2x.png" mode="" class="authorizCloseImg"></image>
  185. </view>
  186. </view>
  187. </view>
  188. </template>
  189. <script>
  190. import nodata from '../../components/nodata/nodata.vue'
  191. export default {
  192. components: {
  193. nodata,
  194. },
  195. data() {
  196. return {
  197. tabIndex: '1',
  198. vipData: {},
  199. userInfo: '',
  200. shiyongShow: false,
  201. useComment: '',
  202. dis: true,
  203. disCz: true,
  204. authorizShow:false,
  205. userInfo:'',
  206. ext:'',
  207. wxOpenData:'',
  208. }
  209. },
  210. onLoad() {
  211. //this.userInfo = uni.getStorageSync("userInfo");
  212. this.userInfo=this.$store.state.userInfo;
  213. this.ext=this.$common.getExtStoreId();
  214. if(this.userInfo){
  215. this.myOrderCoupon();
  216. }else{
  217. this.$common.automaticlogin().then(val => {
  218. this.userInfo=this.$store.state.userInfo;
  219. this.wxOpenData=this.$store.state.wxOpenData;
  220. this.themeColor = uni.getStorageSync("themeColor");
  221. this.myOrderCoupon();
  222. })
  223. }
  224. },
  225. methods: {
  226. AmountQtyJs (item) {
  227. var state = false
  228. if (this.dis) {
  229. item.forEach(v => {
  230. if (v.AmountQty != 0) {
  231. state = true
  232. }
  233. })
  234. } else {
  235. state = true
  236. }
  237. return state
  238. },
  239. useCl(useComment) {
  240. this.useComment = useComment;
  241. this.shiyongShow = true;
  242. },
  243. myOrderCoupon() {
  244. uni.showLoading({
  245. title: '加载中'
  246. })
  247. this.$http('openweiXinCardInfoController/queryCardTimeAndMondyList', {
  248. // page: this.page,
  249. // limit: 10,
  250. }, 'POST').then(res => {
  251. uni.hideLoading();
  252. // var list = res.data.Items
  253. var list = res.data
  254. list.cardTimeList.forEach((item, index) => {
  255. for (const key in item) {
  256. item['open'] = false
  257. }
  258. })
  259. list.carMoneyList.forEach((item, index) => {
  260. for (const key in item) {
  261. item['open'] = false
  262. }
  263. })
  264. this.vipData = list
  265. })
  266. },
  267. tabClick(tag) {
  268. this.tabIndex = tag
  269. },
  270. changeState(item) {
  271. item.open = !item.open
  272. },
  273. gonavigateTo(url) {
  274. uni.navigateTo({
  275. url: url
  276. })
  277. },
  278. decryptPhoneNumber: function(e) {
  279. console.log(e);
  280. this.code=e.detail.code
  281. this.wxPhoneLogin()
  282. this.authorizShow=false;
  283. },
  284. wxPhoneLogin(){
  285. var that=this;
  286. this.$http('miniApp2/sys/wxPhoneLogin', {
  287. appId:this.ext.appId,
  288. unionId:this.ext.unionId,
  289. code:this.code,
  290. openId:this.wxOpenData.openid
  291. },'POST').then(res => {
  292. var data = res.data;
  293. if(data.loginInfo){
  294. this.userInfo=data.loginInfo.openUser;
  295. this.wxOpenData=data.loginInfo;
  296. this.$store.commit('mutationswxOpenData', data.loginInfo)
  297. this.$store.commit('mutationsuserInfo', this.userInfo)
  298. this.myOrderCoupon()
  299. }
  300. })
  301. },
  302. },
  303. // 下拉刷新
  304. onPullDownRefresh() {
  305. // this.page = 1
  306. this.myOrderCoupon()
  307. setTimeout(function() {
  308. uni.stopPullDownRefresh();
  309. }, 1000);
  310. },
  311. }
  312. </script>
  313. <style scoped>
  314. .box {
  315. min-height: 100vh;
  316. padding-bottom: 60rpx;
  317. }
  318. .headerBox {
  319. background-color: #171723;
  320. height: 525rpx;
  321. width: 100vw;
  322. padding: 30rpx 0rpx;
  323. /* position: fixed;
  324. left: 0;
  325. top: 0;
  326. z-index: 999; */
  327. }
  328. .vip {
  329. background: url(http://dmsphoto.66km.com.cn/thFiles/0EEEE7DB-02ED-41B4-A633-2F2669E0DF7E.png);
  330. background-size: 100% 100%;
  331. height: 320rpx;
  332. /* width: 100vw; */
  333. margin: 0rpx 24rpx;
  334. padding: 48rpx 30rpx;
  335. display: flex;
  336. flex-direction: column;
  337. justify-content: space-between;
  338. }
  339. .headerTop {
  340. display: flex;
  341. justify-content: flex-start;
  342. }
  343. .headerRight {
  344. padding-left: 18rpx;
  345. }
  346. .nameBox {
  347. display: flex;
  348. justify-content: flex-start;
  349. align-items: center;
  350. }
  351. .name {
  352. font-size: 30rpx;
  353. font-weight: bold;
  354. color: #523509;
  355. line-height: 42rpx;
  356. }
  357. .phone {
  358. margin-top: 12rpx;
  359. font-size: 24rpx;
  360. font-weight: bold;
  361. color: #523509;
  362. line-height: 33rpx;
  363. }
  364. .kahaoBox {
  365. display: flex;
  366. justify-content: flex-start;
  367. align-items: center;
  368. }
  369. .kahao {
  370. font-size: 24rpx;
  371. font-weight: bold;
  372. color: #523509;
  373. line-height: 33rpx;
  374. }
  375. .tab {
  376. background: #FFFFFF;
  377. margin-top: 30rpx;
  378. display: flex;
  379. justify-content: space-around;
  380. line-height: 60rpx;
  381. height: 60rpx;
  382. border-radius: 26rpx 26rpx 0rpx 0rpx;
  383. padding: 28rpx;
  384. }
  385. .tabLine {
  386. font-size: 30rpx;
  387. line-height: 42rpx;
  388. color: #3C3C3C;
  389. text-align: center;
  390. }
  391. .line{
  392. width: 40rpx;
  393. margin: 0rpx 10rpx;
  394. height: 4rpx;
  395. background: #FF0000;
  396. margin-top: 8rpx;
  397. }
  398. .tabActive {
  399. color: #3C3C3C;
  400. font-weight: bold;
  401. }
  402. .mainBox {
  403. /* margin-top: 590rpx; */
  404. background-color: #F4F5F7;
  405. padding: 24rpx;
  406. min-height: 100vh;
  407. }
  408. .btnBox {
  409. display: flex;
  410. }
  411. .itemBox {
  412. background-color: #FFFFFF;
  413. border-radius: 10rpx;
  414. padding: 30rpx 20rpx;
  415. margin-top: 20rpx;
  416. }
  417. .itemTop {
  418. display: flex;
  419. justify-content: space-between;
  420. align-items: baseline;
  421. }
  422. .itemBottom {
  423. display: flex;
  424. justify-content: space-between;
  425. align-items: center;
  426. margin-top: 15rpx;
  427. }
  428. .active {
  429. margin-bottom: 30rpx;
  430. }
  431. .itemName {
  432. font-size: 30rpx;
  433. font-weight: bold;
  434. color: #333333;
  435. line-height: 42rpx;
  436. }
  437. .tiaokuan {
  438. width: 136rpx;
  439. height: 52rpx;
  440. background: #FFFFFF;
  441. border-radius: 28rpx;
  442. border: 1rpx solid #DDDDDD;
  443. color: #666666;
  444. font-size: 24rpx;
  445. text-align: center;
  446. line-height: 52rpx;
  447. }
  448. .shopName {
  449. border-radius: 5rpx;
  450. border: 1rpx solid #DDDDDD;
  451. color: #999999;
  452. font-size: 24rpx;
  453. padding: 2rpx 12rpx;
  454. }
  455. .itemBg {
  456. padding: 30rpx 0rpx;
  457. border-top: 1rpx solid #EEEEEE;
  458. }
  459. .nameTop {
  460. font-size: 28rpx;
  461. font-weight: 400;
  462. color: #333333;
  463. line-height: 40rpx;
  464. margin-bottom: 20rpx;
  465. }
  466. .type {
  467. width: 72rpx;
  468. height: 36rpx;
  469. border-radius: 5rpx;
  470. border: 1rpx solid #F19D01;
  471. margin-right: 10rpx;
  472. font-size: 24rpx;
  473. color: #F19D01;
  474. line-height: 36rpx;
  475. padding: 2rpx 12rpx;
  476. text-align: center;
  477. }
  478. .timeBottom {
  479. display: flex;
  480. justify-content: space-between;
  481. color: #999999;
  482. font-size: 24rpx;
  483. }
  484. .money {
  485. font-size: 36rpx;
  486. font-weight: bold;
  487. color: #FF0000;
  488. line-height: 50rpx;
  489. }
  490. .moneyBox{
  491. flex-grow: 1;
  492. display: flex;
  493. justify-content: flex-end;
  494. margin-right: 10rpx;
  495. align-items: center;
  496. }
  497. .count {
  498. color: #FF0000;
  499. }
  500. .shiyongBox {
  501. width: 100%;
  502. height: 100vh;
  503. background: rgba(0, 0, 0, 0.4);
  504. position: fixed;
  505. left: 0;
  506. top: 0;
  507. z-index: 9999;
  508. }
  509. .shiyongCont {
  510. width: 100%;
  511. height: 70vh;
  512. background: #ffffff;
  513. left: 0;
  514. bottom: 0;
  515. position: absolute;
  516. border-radius: 24rpx 24rpx 0rpx 0rpx;
  517. }
  518. .shiyongContTopX {
  519. width: 36rpx;
  520. height: 36rpx;
  521. }
  522. .shiyongContTop {
  523. display: flex;
  524. justify-content: space-between;
  525. padding: 24rpx;
  526. color: #3C3C3C;
  527. font-size: 30rpx;
  528. border-bottom: 1rpx solid #EEEEEE;
  529. align-items: center;
  530. }
  531. .shiyongContTopTitle {
  532. font-size: 30rpx;
  533. color: #3C3C3C;
  534. font-weight: bold;
  535. }
  536. .shiyonghtml {
  537. padding: 24rpx;
  538. height: calc(70vh - 100px);
  539. overflow-y: scroll;
  540. }
  541. .shiyongno {
  542. color: #666666;
  543. font-size: 26rpx;
  544. }
  545. .authorizBox{
  546. width: 100vw;
  547. height: 100vh;
  548. background: rgba(0, 0, 0, 0.5);
  549. position: fixed;
  550. top: 0;
  551. left: 0;
  552. }
  553. .authorizCont{
  554. margin-top: 30vh;
  555. width: 564rpx;
  556. height: 408rpx;
  557. background: #FFFFFF;
  558. border-radius: 24rpx;
  559. margin-left: 93rpx;
  560. position: relative;
  561. }
  562. .authorizCloseImg{
  563. width: 62rpx;
  564. height: 62rpx;
  565. }
  566. .sqLogoBox{
  567. width: 180rpx;
  568. height: 180rpx;
  569. background: #FFFFFF;
  570. border-radius: 90rpx;
  571. text-align: center;
  572. position: absolute;
  573. top: -50rpx;
  574. left: 192rpx;
  575. }
  576. .authorizName{
  577. color: #333333;
  578. line-height: 42rpx;
  579. font-size: 30rpx;
  580. text-align: center;
  581. padding-top: 58rpx;
  582. }
  583. .authorizMs{
  584. color: #999999;
  585. line-height: 36rpx;
  586. font-size: 26rpx;
  587. width: 452rpx;
  588. padding-top: 24rpx;
  589. text-align: center;
  590. margin-left: 56rpx;
  591. }
  592. .authorizContbutton{
  593. width: 422rpx;
  594. height: 88rpx;
  595. background: #D53533;
  596. border-radius: 44rpx;
  597. line-height: 88rpx;
  598. text-align: center;
  599. font-size:30rpx;
  600. color: #FFFFFF;
  601. margin-top: 62rpx;
  602. margin-left:71rpx;
  603. }
  604. </style>