vipCard.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  1. <template>
  2. <view class="box">
  3. <view class="headerBox">
  4. <view class="vip">
  5. <view class="headerTop">
  6. <image src="http://dmsphoto.66km.com.cn/thFiles/785A657B-2FA6-4B22-A356-D555BFE2E18D.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}" @click="changeState(item)">
  49. <view class="shopName">{{item.shopName}}</view>
  50. <image v-if="item.open==false" src="../../static/img/icon_arrow_down.png"
  51. mode="" style="width: 34rpx;height: 22rpx;"></image>
  52. <image 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="shiyongShowHlde"></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="moneyBox"><span style="font-size: 24rpx; color: #FF3B30; padding-top: 2rpx;"></span><span class="money">{{item.Money}}</span> <span
  117. style="color: #999999;font-size: 24rpx;">( 充{{item.ChargeMoney}}{{item.GiftMoney}}</span>
  118. </view>
  119. <view class="itemBottom" :class="{active:item.open}" @click="changeState(item)">
  120. <view class="shopName">{{item.ShopName}}</view>
  121. <image v-if="item.open==false" src="../../static/img/icon_arrow_down.png"
  122. mode="" style="width: 34rpx;height: 22rpx;"></image>
  123. <image 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="moneyBox"><span style="font-size: 24rpx; color: #FF3B30; padding-top: 2rpx;"></span><span class="money">{{item.Money}}</span> <span
  141. style="color: #999999;font-size: 24rpx;">( 充{{item.ChargeMoney}}{{item.GiftMoney}}</span>
  142. </view>
  143. <view class="itemBottom" :class="{active:item.open}" @click="changeState(item)">
  144. <view class="shopName">{{item.ShopName}}</view>
  145. <image v-if="item.open==false" src="../../static/img/icon_arrow_down.png"
  146. mode="" style="width: 34rpx;height: 22rpx;"></image>
  147. <image 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="shiyongShowHlde"></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. if(!this.userInfo){
  222. this.authorizShow=true
  223. }
  224. this.myOrderCoupon();
  225. })
  226. }
  227. },
  228. methods: {
  229. shiyongShowHlde(){
  230. this.shiyongShow=false;
  231. },
  232. AmountQtyJs (item) {
  233. var state = false
  234. if (this.dis) {
  235. item.forEach(v => {
  236. if (v.AmountQty != 0) {
  237. state = true
  238. }
  239. })
  240. } else {
  241. state = true
  242. }
  243. return state
  244. },
  245. useCl(useComment) {
  246. this.useComment = useComment;
  247. this.shiyongShow = true;
  248. },
  249. myOrderCoupon() {
  250. uni.showLoading({
  251. title: '加载中'
  252. })
  253. this.$http('openweiXinCardInfoController/queryCardTimeAndMondyList', {
  254. // page: this.page,
  255. // limit: 10,
  256. }, 'POST').then(res => {
  257. uni.hideLoading();
  258. // var list = res.data.Items
  259. var list = res.data
  260. list.cardTimeList.forEach((item, index) => {
  261. for (const key in item) {
  262. item['open'] = false
  263. }
  264. })
  265. list.carMoneyList.forEach((item, index) => {
  266. for (const key in item) {
  267. item['open'] = false
  268. }
  269. })
  270. this.vipData = list
  271. })
  272. },
  273. tabClick(tag) {
  274. this.tabIndex = tag
  275. },
  276. changeState(item) {
  277. item.open = !item.open
  278. },
  279. gonavigateTo(url) {
  280. uni.navigateTo({
  281. url: url
  282. })
  283. },
  284. decryptPhoneNumber: function(e) {
  285. console.log(e);
  286. this.code=e.detail.code
  287. this.wxPhoneLogin()
  288. this.authorizShow=false;
  289. },
  290. wxPhoneLogin(){
  291. var that=this;
  292. this.$http('miniApp2/sys/wxPhoneLogin', {
  293. appId:this.ext.appId,
  294. unionId:this.ext.unionId,
  295. code:this.code,
  296. openId:this.wxOpenData.openid
  297. },'POST').then(res => {
  298. var data = res.data;
  299. if(data.loginInfo){
  300. this.userInfo=data.loginInfo.openUser;
  301. this.wxOpenData=data.loginInfo;
  302. this.$store.commit('mutationswxOpenData', data)
  303. this.$store.commit('mutationsuserInfo', this.userInfo)
  304. this.myOrderCoupon()
  305. }
  306. })
  307. },
  308. },
  309. // 下拉刷新
  310. onPullDownRefresh() {
  311. // this.page = 1
  312. this.myOrderCoupon()
  313. setTimeout(function() {
  314. uni.stopPullDownRefresh();
  315. }, 1000);
  316. },
  317. }
  318. </script>
  319. <style scoped>
  320. .box {
  321. min-height: 100vh;
  322. padding-bottom: 60rpx;
  323. }
  324. .headerBox {
  325. background-color: #171723;
  326. height: 525rpx;
  327. width: 100vw;
  328. padding: 30rpx 0rpx;
  329. /* position: fixed;
  330. left: 0;
  331. top: 0;
  332. z-index: 999; */
  333. }
  334. .vip {
  335. background: url(http://dmsphoto.66km.com.cn/thFiles/0EEEE7DB-02ED-41B4-A633-2F2669E0DF7E.png);
  336. background-size: 100% 100%;
  337. height: 320rpx;
  338. /* width: 100vw; */
  339. margin: 0rpx 24rpx;
  340. padding: 48rpx 30rpx;
  341. display: flex;
  342. flex-direction: column;
  343. justify-content: space-between;
  344. }
  345. .headerTop {
  346. display: flex;
  347. justify-content: flex-start;
  348. }
  349. .headerRight {
  350. padding-left: 18rpx;
  351. }
  352. .nameBox {
  353. display: flex;
  354. justify-content: flex-start;
  355. align-items: center;
  356. }
  357. .name {
  358. font-size: 30rpx;
  359. font-weight: bold;
  360. color: #523509;
  361. line-height: 42rpx;
  362. }
  363. .phone {
  364. margin-top: 12rpx;
  365. font-size: 24rpx;
  366. font-weight: bold;
  367. color: #523509;
  368. line-height: 33rpx;
  369. }
  370. .kahaoBox {
  371. display: flex;
  372. justify-content: flex-start;
  373. align-items: center;
  374. }
  375. .kahao {
  376. font-size: 24rpx;
  377. font-weight: bold;
  378. color: #523509;
  379. line-height: 33rpx;
  380. }
  381. .tab {
  382. background: #FFFFFF;
  383. margin-top: 30rpx;
  384. display: flex;
  385. justify-content: space-around;
  386. line-height: 60rpx;
  387. height: 60rpx;
  388. border-radius: 26rpx 26rpx 0rpx 0rpx;
  389. padding: 28rpx;
  390. }
  391. .tabLine {
  392. font-size: 30rpx;
  393. line-height: 42rpx;
  394. color: #3C3C3C;
  395. text-align: center;
  396. }
  397. .line{
  398. width: 40rpx;
  399. margin: 0rpx 10rpx;
  400. height: 4rpx;
  401. background: #FF0000;
  402. margin-top: 8rpx;
  403. }
  404. .tabActive {
  405. color: #3C3C3C;
  406. font-weight: bold;
  407. }
  408. .mainBox {
  409. /* margin-top: 590rpx; */
  410. background-color: #F4F5F7;
  411. padding: 24rpx;
  412. min-height: 100vh;
  413. }
  414. .btnBox {
  415. display: flex;
  416. }
  417. .itemBox {
  418. background-color: #FFFFFF;
  419. border-radius: 10rpx;
  420. padding: 30rpx 20rpx;
  421. margin-top: 20rpx;
  422. }
  423. .itemTop {
  424. display: flex;
  425. justify-content: space-between;
  426. align-items: baseline;
  427. }
  428. .itemBottom {
  429. display: flex;
  430. justify-content: space-between;
  431. align-items: center;
  432. margin-top: 15rpx;
  433. }
  434. .active {
  435. margin-bottom: 30rpx;
  436. }
  437. .itemName {
  438. font-size: 30rpx;
  439. font-weight: bold;
  440. color: #333333;
  441. line-height: 42rpx;
  442. }
  443. .tiaokuan {
  444. width: 136rpx;
  445. height: 52rpx;
  446. background: #FFFFFF;
  447. border-radius: 28rpx;
  448. border: 1rpx solid #DDDDDD;
  449. color: #666666;
  450. font-size: 24rpx;
  451. text-align: center;
  452. line-height: 52rpx;
  453. }
  454. .shopName {
  455. border-radius: 5rpx;
  456. border: 1rpx solid #DDDDDD;
  457. color: #999999;
  458. font-size: 24rpx;
  459. padding: 2rpx 12rpx;
  460. /* max-width: 300rpx;
  461. overflow: hidden;
  462. white-space: nowrap;
  463. text-overflow: ellipsis;
  464. -o-text-overflow: ellipsis; */
  465. }
  466. .itemBg {
  467. padding: 30rpx 0rpx;
  468. border-top: 1rpx solid #EEEEEE;
  469. }
  470. .itemBg:last-child{
  471. padding-bottom: 0;
  472. }
  473. .nameTop {
  474. font-size: 28rpx;
  475. font-weight: 400;
  476. color: #333333;
  477. line-height: 40rpx;
  478. margin-bottom: 20rpx;
  479. }
  480. .type {
  481. width: 72rpx;
  482. height: 36rpx;
  483. border-radius: 5rpx;
  484. border: 1rpx solid #F19D01;
  485. margin-right: 10rpx;
  486. font-size: 24rpx;
  487. color: #F19D01;
  488. line-height: 36rpx;
  489. padding: 2rpx 12rpx;
  490. text-align: center;
  491. }
  492. .timeBottom {
  493. display: flex;
  494. justify-content: space-between;
  495. color: #999999;
  496. font-size: 24rpx;
  497. }
  498. .money {
  499. font-size: 36rpx;
  500. font-weight: bold;
  501. color: #FF0000;
  502. line-height: 50rpx;
  503. }
  504. .moneyBox{
  505. flex-grow: 1;
  506. display: flex;
  507. /* justify-content: flex-end; */
  508. margin-right: 10rpx;
  509. align-items: center;
  510. }
  511. .count {
  512. color: #FF0000;
  513. }
  514. .shiyongBox {
  515. width: 100%;
  516. height: 100vh;
  517. background: rgba(0, 0, 0, 0.4);
  518. position: fixed;
  519. left: 0;
  520. top: 0;
  521. z-index: 9999;
  522. }
  523. .shiyongCont {
  524. width: 100%;
  525. height: 70vh;
  526. background: #ffffff;
  527. left: 0;
  528. bottom: 0;
  529. position: absolute;
  530. border-radius: 24rpx 24rpx 0rpx 0rpx;
  531. }
  532. .shiyongContTopX {
  533. width: 36rpx;
  534. height: 36rpx;
  535. padding: 10rpx;
  536. }
  537. .shiyongContTop {
  538. display: flex;
  539. justify-content: space-between;
  540. padding: 24rpx;
  541. color: #3C3C3C;
  542. font-size: 30rpx;
  543. border-bottom: 1rpx solid #EEEEEE;
  544. align-items: center;
  545. }
  546. .shiyongContTopTitle {
  547. font-size: 30rpx;
  548. color: #3C3C3C;
  549. font-weight: bold;
  550. }
  551. .shiyonghtml {
  552. padding: 24rpx;
  553. height: calc(70vh - 100px);
  554. overflow-y: scroll;
  555. }
  556. .shiyongno {
  557. color: #666666;
  558. font-size: 26rpx;
  559. }
  560. .authorizBox{
  561. width: 100vw;
  562. height: 100vh;
  563. background: rgba(0, 0, 0, 0.5);
  564. position: fixed;
  565. top: 0;
  566. left: 0;
  567. }
  568. .authorizCont{
  569. margin-top: 30vh;
  570. width: 564rpx;
  571. height: 408rpx;
  572. background: #FFFFFF;
  573. border-radius: 24rpx;
  574. margin-left: 93rpx;
  575. position: relative;
  576. }
  577. .authorizCloseImg{
  578. width: 62rpx;
  579. height: 62rpx;
  580. }
  581. .sqLogoBox{
  582. width: 180rpx;
  583. height: 180rpx;
  584. background: #FFFFFF;
  585. border-radius: 90rpx;
  586. text-align: center;
  587. position: absolute;
  588. top: -50rpx;
  589. left: 192rpx;
  590. }
  591. .authorizName{
  592. color: #333333;
  593. line-height: 42rpx;
  594. font-size: 30rpx;
  595. text-align: center;
  596. padding-top: 58rpx;
  597. }
  598. .authorizMs{
  599. color: #999999;
  600. line-height: 36rpx;
  601. font-size: 26rpx;
  602. width: 452rpx;
  603. padding-top: 24rpx;
  604. text-align: center;
  605. margin-left: 56rpx;
  606. }
  607. .authorizContbutton{
  608. width: 422rpx;
  609. height: 88rpx;
  610. background: #D53533;
  611. border-radius: 44rpx;
  612. line-height: 88rpx;
  613. text-align: center;
  614. font-size:30rpx;
  615. color: #FFFFFF;
  616. margin-top: 62rpx;
  617. margin-left:71rpx;
  618. }
  619. </style>