member.vue 27 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046
  1. <template>
  2. <view>
  3. <view style="color: #000;">
  4. <tn-nav-bar backgroundColor="#ffffff"
  5. :bottomShadow="false">我的{{appInfo.number_alias?appInfo.number_alias:'点数'}}{{appInfo.time_member==1?'/会员套餐':''}}
  6. </tn-nav-bar>
  7. </view>
  8. <view :style="{height: tobheight+'px'}"></view>
  9. <view class="flex-rb-cc infoBg" style="padding: 25px 15px 20px;justify-content: end;">
  10. <!-- <image class="user-avatar" :src="userInfo.avatar" mode="aspectFill"></image> -->
  11. <u-avatar :src="userInfo.avatar" size="70" mode="aspectFill"></u-avatar>
  12. <view class="flex-fill ml20">
  13. <view class="u-flex align-center justify-between" style="margin-bottom: 16rpx">
  14. <view class="bold" style="font-size: 36rpx;color: #fff;">{{userInfo.nickname}}</view>
  15. <u-tag @click="getrecord" text="记录" type="warning" shape="circle"></u-tag>
  16. </view>
  17. <view class="flex-cc align-center ">
  18. <!-- <text style="font-size: 30rpx;font-weight: bold;color: #ffc107;">剩余次数:{{userData.coin?userData.coin:0}}次</text> -->
  19. <!-- {{(appInfo.number_alias?appInfo.number_alias+':':'点数:')}} -->
  20. <u-tag
  21. :text="userData.coin?(appInfo.number_alias?appInfo.number_alias+':':'点数:')+userData.coin:(appInfo.number_alias?appInfo.number_alias+':':'点数:')+0"
  22. plain type="warning" shape="circle" color="#ffeb3b" borderColor="#ffeb3b"></u-tag>
  23. <block v-if="appInfo.time_member && appInfo.time_member==1">
  24. <view style="width: 10rpx;"></view>
  25. <u-tag
  26. :text="userData.is_validity == 1?'会员套餐:'+ (userData.vip_time == 9999?'永久':userData.countdown+'天'):'会员套餐:0天'"
  27. plain type="warning" shape="circle" color="#ffeb3b" borderColor="#ffeb3b"></u-tag>
  28. <!-- <u-tag :text="userData.is_validity == 1?'会员套餐:'+ (userData.vip_time == 9999?'永久':userData.countdown+'天'):'会员套餐:0天'" plain
  29. type="warning" shape="circle" color="#ffeb3b" borderColor="#ffeb3b"></u-tag> -->
  30. </block>
  31. <!-- <image class="ico-vip mr10" :src="userInfo.coin>0?'/static/images/diamond_fill_vippage_icon@2x.png':'/static/images/diamond_vippage_icon@2x.png'"></image> -->
  32. <!-- <text class="tn-color-brown" style="opacity: 0.5;font-size: 28rpx;">1</text> -->
  33. </view>
  34. </view>
  35. </view>
  36. <u-tabs v-if="showtabs" :list="tabList" lineWidth="50" lineHeight="5" lineColor="#207CF7" :current="tabindex"
  37. :activeStyle="{
  38. color: '#303133',
  39. fontWeight: 'bold',
  40. fontSize: '32rpx',
  41. transform: 'scale(1.05)'
  42. }" :inactiveStyle="{
  43. color: '#606266',
  44. fontSize: '32rpx',
  45. transform: 'scale(1)'
  46. }" itemStyle="padding-left: 15px; padding-right: 15px; height: 38px;" @click="gettabs">
  47. </u-tabs>
  48. <blcok v-if="list.length&&tabindex < 2">
  49. <view class="form">
  50. <view class="form-choice " :class="current==index?'active':''" v-for="(item,index) in list" :key="index"
  51. @click="setItem(index)">
  52. <view class="flex-rb-cc">
  53. <view class="fz-32 bold flex-cc">
  54. <text style="font-size: 40rpx;max-width: 380rpx;">{{item.title}}</text>
  55. <!-- <text v-if="item.coin" style="font-size: 38rpx;">{{item.coin}} 次数</text> -->
  56. <!-- <image class="ico-special" style="margin-left: 40rpx;" :src="current==index?'/static/images/special_time_w@2x.png':'/static/images/special_time_w@2x.png'" v-if="item.is_preferential ==1"></image> -->
  57. </view>
  58. <view class="tr ">
  59. <view class="mt10 fz-24 fc-c5 line-through" v-if="item.original_price">
  60. ¥{{item.original_price}}</view>
  61. <view class="bold">
  62. <text class="fz-32">¥ </text>
  63. <text class="fz-38 pricefont">{{item.price}}</text>
  64. </view>
  65. </view>
  66. </view>
  67. <!-- <view v-else class="mt10 fz-26" :class="current==index?'selected':'fc-c5'">会员天数
  68. {{item.day == 9999?'永久':item.day}}
  69. </view> -->
  70. <view class="form-special" v-if="item.is_preferential === 1">(限时特价)</view>
  71. <view v-if="type==1&&item.coin" class="mt10 fz-26" :class="current==index?'selected':'fc-c5'">
  72. {{appInfo.number_alias?appInfo.number_alias:'点数'}}
  73. {{item.coin}}
  74. </view>
  75. <view v-else class="u-flex flex-wrap">
  76. <view v-if="item.gpt35_times == -1 || item.gpt35_times > 0" class="packagetag">
  77. <u-tag @click="setItem(index)"
  78. :text="appInfo.gpt35_alias ? appInfo.gpt35_alias+(item.gpt35_times == -1?' 无限量':' '+item.gpt35_times+'次')+(item.gpt35_type=='time'?'/天':'') : 'ChatGPT 3.5'+(item.gpt35_times == -1?' 无限量':' '+item.gpt35_times+'次')+(item.gpt35_type=='time'?'/天':'')"
  79. plain type="warning" size="mini" shape="circle" :color="current==index?'#ffeb3b':'#ccc'"
  80. :borderColor="current==index?'#ffeb3b':'#ccc'"></u-tag>
  81. </view>
  82. <view v-if="item.gpt4_times == -1 || item.gpt4_times > 0" class="packagetag">
  83. <u-tag @click="setItem(index)"
  84. :text="appInfo.gpt4_alias ? appInfo.gpt4_alias+(item.gpt4_times == -1?' 无限量':' '+item.gpt4_times+'次')+(item.gpt4_type=='time'?'/天':'') : 'ChatGPT 4.0'+(item.gpt4_times == -1?' 无限量':' '+item.gpt4_times+'次')+(item.gpt4_type=='time'?'/天':'')"
  85. plain type="warning" size="mini" shape="circle" :color="current==index?'#ffeb3b':'#ccc'"
  86. :borderColor="current==index?'#ffeb3b':'#ccc'"></u-tag>
  87. </view>
  88. <view v-if="item.sd_times == -1 || item.sd_times > 0" class="packagetag">
  89. <u-tag @click="setItem(index)"
  90. :text="'StableDiffusion绘图'+(item.sd_times == -1?' 无限量':' '+item.sd_times+'次')+(item.sd_type=='time'?'/天':'')"
  91. plain type="warning" size="mini" shape="circle" :color="current==index?'#ffeb3b':'#ccc'"
  92. :borderColor="current==index?'#ffeb3b':'#ccc'"></u-tag>
  93. </view>
  94. <view v-if="item.mj_times == -1 || item.mj_times > 0" class="packagetag">
  95. <u-tag @click="setItem(index)"
  96. :text="'MidJourney绘图'+(item.mj_times == -1?' 无限量':' '+item.mj_times+'次')+(item.mj_type=='time'?'/天':'')"
  97. plain type="warning" size="mini" shape="circle" :color="current==index?'#ffeb3b':'#ccc'"
  98. :borderColor="current==index?'#ffeb3b':'#ccc'"></u-tag>
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. <block v-if="instructions">
  104. <view style="margin: 20rpx 30rpx;">
  105. <text style="font-size: 26rpx;color: #9e9e9e;">{{instructions}}</text>
  106. </view>
  107. </block>
  108. <view v-if="appInfo.kf_qrcode_path&&platform == 'H5'" class="explain">
  109. <view class="kf_qrcode tn-flex justify-center">
  110. <u--image :showLoading="true" :src="appInfo.kf_qrcode_path" width="150px" height="150px"
  111. @click="clickuimage(appInfo.kf_qrcode_path)"></u--image>
  112. </view>
  113. <view class="u-text-center">
  114. <!-- #ifdef MP-WEIXIN -->
  115. 长按上方二维码,添加客服购买卡密
  116. <!-- #endif -->
  117. <!-- #ifdef H5 -->
  118. 保存上方二维码,添加客服购买卡密
  119. <!-- #endif -->
  120. </view>
  121. </view>
  122. <view style="padding-top: 136rpx;width: 1rpx;">
  123. <!-- <Xbottom></Xbottom> -->
  124. </view>
  125. <!-- &&platform != 'H5' -->
  126. <view class="bottom-page" v-if="list.length>0">
  127. <view class="flex-rb-cc">
  128. <view>
  129. <view class="bold mb10">
  130. <text class="fz-48 pricefont" style="line-height: 62rpx;">{{list[current].price}}</text>
  131. <text class="fz-24"> 元</text>
  132. </view>
  133. <view class="flex-cc">
  134. </view>
  135. </view>
  136. <!-- #ifdef MP-WEIXIN -->
  137. <view @click="buy" v-if="device != 'ios'" class="bottom-btn">购买</view>
  138. <view @click="buy" v-else-if="device == 'ios'&&show_ios_pay" class="bottom-btn">购买</view>
  139. <!-- <view class="bottom-btn" v-else>IOS暂不支持购买</view> -->
  140. <!-- #endif -->
  141. <!-- #ifdef H5 -->
  142. <view @click="buy" class="bottom-btn">购买</view>
  143. <!-- #endif -->
  144. </view>
  145. <!-- <Xbottom></Xbottom> -->
  146. </view>
  147. </blcok>
  148. <!-- <block v-else>
  149. <view v-if="appInfo.kf_qrcode_path" class="explain">
  150. <view class="kf_qrcode tn-flex justify-center">
  151. <u--image :showLoading="true" :src="appInfo.kf_qrcode_path" width="150px" height="150px" @click="clickuimage(appInfo.kf_qrcode_path)"></u--image>
  152. </view>
  153. <view class="u-text-center">
  154. <!-- #ifdef MP-WEIXIN -->
  155. <!-- 长按上方二维码,添加客服了解详情 -->
  156. <!-- #endif -->
  157. <!-- #ifdef H5 -->
  158. <!-- 保存上方二维码,添加客服了解详情 -->
  159. <!-- #endif -->
  160. <!-- </view>
  161. </view>
  162. </block> -->
  163. <block v-if="tabindex == everyday">
  164. <view v-if="plan.sign>0" class="task-item flxe align-center justify-between">
  165. <view class="task-title">
  166. <view class="task-content">
  167. 签到领{{appInfo.number_alias?appInfo.number_alias:'点数'}}(今日{{userData.sign_count_today}}/1)
  168. </view>
  169. <view class="task-frequency">{{plan.sign}}{{appInfo.number_alias?appInfo.number_alias:'点数'}}/次
  170. </view>
  171. </view>
  172. <view v-if="userData.sign_count_today == 1" class="task-buttons">立即签到</view>
  173. <view v-else class="task-button" @click="memberaddCoin('sign')">立即签到</view>
  174. </view>
  175. <!-- #ifdef MP-WEIXIN -->
  176. <view v-if="plan.video>0" class="task-item flxe align-center justify-between">
  177. <view class="task-title">
  178. <view class="task-content">
  179. 观看视频领{{appInfo.number_alias?appInfo.number_alias:'点数'}}(今日{{userData.video_count_today}}/{{plan.video_limit}})
  180. </view>
  181. <view class="task-frequency">{{plan.video}}{{appInfo.number_alias?appInfo.number_alias:'点数'}}/次
  182. </view>
  183. </view>
  184. <view v-if="userData.video_count_today == plan.video_limit" class="task-buttons">立即观看</view>
  185. <view v-else class="task-button" @click="showInterstitialAd">立即观看</view>
  186. </view>
  187. <view v-if="plan.share>0" class="task-item flxe align-center justify-between">
  188. <view class="task-title">
  189. <view class="task-content">
  190. 分享给好友领{{appInfo.number_alias?appInfo.number_alias:'点数'}}(今日{{userData.share_count_today}}/{{plan.share_limit}})
  191. </view>
  192. <view class="task-frequency">{{plan.share}}{{appInfo.number_alias?appInfo.number_alias:'点数'}}/次
  193. </view>
  194. </view>
  195. <block>
  196. <view v-if="userData.share_count_today == plan.share_limit" class="task-buttons">立即分享</view>
  197. <view v-else class="task-button">立即分享</view>
  198. </block>
  199. <button v-if="userData.share_count_today < plan.share_limit" class="share-button"
  200. open-type="share"></button>
  201. <!-- <button class="share-button"
  202. open-type="share"></button> -->
  203. </view>
  204. <!-- #endif -->
  205. <!-- <block v-if="$platform.get() === 'wxOfficialAccount'">
  206. <view class="task-item flxe align-center justify-between">
  207. <view class="task-title">
  208. <view class="task-content">
  209. 分享给好友领{{appInfo.number_alias?appInfo.number_alias:'点数'}}(今日{{ userData.share_count_today ? userData.share_count_today : 0 }}/{{ plan.share_limit ? plan.share_limit : 0 }})
  210. </view>
  211. <view class="task-frequency">{{ plan.share ? plan.share : 0 }}{{appInfo.number_alias?appInfo.number_alias:'点数'}}/次</view>
  212. </view>
  213. <block>
  214. <view v-if="userData.share_count_today == plan.share_limit" class="task-buttons">立即分享</view>
  215. <view v-else @click="tabh5share" class="task-button">立即分享</view>
  216. </block>
  217. </view>
  218. </block> -->
  219. <!-- device == 'ios'&&!show_ios_pay -->
  220. <view style="margin: 30rpx;">
  221. <wike-ad></wike-ad>
  222. </view>
  223. </block>
  224. <!-- <u-loading-page :loading="loading" loading-text="正在加载" icon-size="35" color="#9e9e9e" loadingColor="#9e9e9e">
  225. </u-loading-page> -->
  226. <!-- #ifdef H5 -->
  227. <u-popup :show="h5share" mode="center" @close="offh5share">
  228. <view class="cu-dialog">
  229. <image class="guide-img" src="http://shopro.7wpp.com/imgs/modal/share_guide.png" mode=""></image>
  230. </view>
  231. </u-popup>
  232. <!-- #endif -->
  233. <wike-loading-page :isLoading="isLoading"></wike-loading-page>
  234. </view>
  235. </template>
  236. <script>
  237. import {
  238. mapMutations,
  239. mapActions,
  240. mapState,
  241. mapGetters
  242. } from 'vuex';
  243. import ShoproPay from '@/common/pay';
  244. import share from '@/common/share';
  245. import {
  246. API_STEROOT,
  247. } from '@/common/request/request';
  248. let rewardedVideoAd = null;
  249. let sharetime;
  250. export default {
  251. data() {
  252. return {
  253. tabindex: 0,
  254. current: 0,
  255. list: [],
  256. device: this.$platform.device(),
  257. loading: true,
  258. tabList: [
  259. {
  260. id: 1,
  261. name: '购买点数'
  262. },
  263. {
  264. id: 2,
  265. name: '购买会员套餐'
  266. },
  267. // {
  268. // id: 3,
  269. // name: '免费领次数',
  270. // badge: {
  271. // isDot: true
  272. // }
  273. // },
  274. ],
  275. tobheight: 45,
  276. platform: this.$platform.get(),
  277. plan: {},
  278. show_ios_pay: false,
  279. isLoading: true,
  280. type: 1,
  281. instructions: '',
  282. h5share: false,
  283. showshare: false,
  284. everyday: 2,
  285. showtabs: true
  286. }
  287. },
  288. computed: {
  289. ...mapGetters(['appInfo', 'userInfo', 'userData', 'isLogin'])
  290. },
  291. watch: {
  292. appInfo: function(e) {
  293. if (this.isLogin) {
  294. this.getUserData();
  295. }
  296. }
  297. },
  298. onUnload() {
  299. share.setShareInfo();
  300. },
  301. onLoad(e) {
  302. // console.log(e);
  303. var that = this;
  304. if (this.platform == 'wxMiniProgram') {
  305. var menumtop = uni.getMenuButtonBoundingClientRect().top - uni.getSystemInfoSync().statusBarHeight
  306. var paddingtop = uni.getSystemInfoSync().statusBarHeight + menumtop
  307. this.tobheight = (menumtop + paddingtop + uni.getMenuButtonBoundingClientRect().height)
  308. }
  309. // if (e && e.id) {
  310. // this.tabindex = Number(e.id)
  311. // if (Number(e.id) < 3) {
  312. // this.type = Number(e.id)
  313. // this.memberlist();
  314. // } else {
  315. // this.isLoading = false
  316. // }
  317. // } else {
  318. // }
  319. this.getPlan()
  320. // #ifdef MP-WEIXIN
  321. if (wx.createRewardedVideoAd) {
  322. rewardedVideoAd = wx.createRewardedVideoAd({
  323. adUnitId: this.appInfo.video_id
  324. })
  325. rewardedVideoAd.onLoad(() => {
  326. // console.log('onLoad event emit')
  327. });
  328. rewardedVideoAd.onError(err => {
  329. // console.log('onError event emit', err)
  330. });
  331. rewardedVideoAd.onClose(res => {
  332. if (res && res.isEnded) {
  333. // 正常播放结束,可以下发游戏奖励
  334. uni.showToast({
  335. title: (this.appInfo.number_alias ? this.appInfo.number_alias + ' +' :
  336. '点数 +') + this.plan.video
  337. })
  338. this.memberaddCoin('video')
  339. } else {
  340. // 播放中途退出,不下发游戏奖励
  341. uni.showToast({
  342. title: '看完视频后才可获得' + this.appInfo.number_alias ? this.appInfo.number_alias +
  343. '奖励' : '点数奖励',
  344. icon: 'none'
  345. });
  346. }
  347. });
  348. }
  349. // #endif
  350. // if (!this.appInfo.time_member || this.appInfo.time_member != 1) {
  351. // this.tabList.splice(1,1)
  352. // }
  353. // #ifdef H5
  354. share.setShareInfo({
  355. title: that.appInfo.site_name,
  356. image: that.appInfo.share_img_path,
  357. });
  358. // #endif
  359. },
  360. onShareAppMessage: function(res) {
  361. if (res.from === 'button') {
  362. this.memberaddCoin('share')
  363. }
  364. return {
  365. title: this.appInfo.site_name,
  366. imageUrl: this.appInfo.share_img_path
  367. }
  368. },
  369. onShow() {
  370. if (this.isLogin) {
  371. this.getUserData();
  372. } else {
  373. // if (getApp().from == 'index') {
  374. // uni.setStorageSync('route', '/pages/index/index');
  375. // } else {
  376. uni.setStorageSync('route', '/pages/user/member/member');
  377. // }
  378. uni.navigateTo({
  379. url: '/pages/user/signin'
  380. });
  381. return;
  382. }
  383. // this.getPlan()
  384. },
  385. methods: {
  386. ...mapActions(['getUserData']),
  387. memberlist(i) {
  388. // console.log(i);
  389. var that = this;
  390. this.$http('member.list', {
  391. type: i
  392. }).then(res => {
  393. if (res.code == 0) {
  394. uni.setNavigationBarTitle({
  395. title: this.appInfo.site_name
  396. });
  397. // #ifdef MP-WEIXIN
  398. if (this.device != 'ios') {
  399. this.list = res.data
  400. } else if (this.device == 'ios' && this.show_ios_pay) {
  401. this.list = res.data
  402. } else {
  403. this.list = []
  404. this.showtabs = false
  405. }
  406. // #endif
  407. // #ifdef H5
  408. this.list = res.data
  409. console.log('套餐列表:', this.list);
  410. // #endif
  411. this.isLoading = false
  412. } else {
  413. uni.showToast({
  414. title: '暂无数据',
  415. icon: 'none'
  416. })
  417. this.isLoading = false
  418. }
  419. });
  420. },
  421. tabh5share() {
  422. this.h5share = true
  423. sharetime = setTimeout(() => {
  424. this.showshare = true
  425. // console.log(this.showshare,1);
  426. }, 3000);
  427. },
  428. offh5share() {
  429. this.h5share = false
  430. // console.log(this.showshare,2);
  431. if (this.showshare) {
  432. this.memberaddCoin('share');
  433. this.showshare = false
  434. } else {
  435. clearTimeout(sharetime)
  436. }
  437. },
  438. clickuimage(e) {
  439. uni.previewImage({
  440. urls: [e]
  441. })
  442. },
  443. setItem(e) {
  444. // console.log(e);
  445. this.current = e
  446. },
  447. showInterstitialAd() {
  448. // rewardedVideoAd.show();
  449. if (rewardedVideoAd && this.appInfo.video_status == 1) {
  450. uni.showToast({
  451. title: '广告拉取中',
  452. icon: 'loading'
  453. })
  454. rewardedVideoAd.show().catch(() => {
  455. // 失败重试
  456. rewardedVideoAd.load()
  457. .then(() => rewardedVideoAd.show())
  458. .catch(err => {
  459. // console.log('激励视频 广告显示失败')
  460. uni.showToast({
  461. title: '广告显示失败',
  462. icon: 'none'
  463. })
  464. })
  465. })
  466. } else {
  467. uni.showToast({
  468. title: '广告显示错误',
  469. icon: 'none'
  470. })
  471. }
  472. },
  473. ytrty() {
  474. var that = this;
  475. if (that.$Route.query.id) {
  476. for (var i = 0; i < this.tabList.length; i++) {
  477. // console.log(that.$Route.query.id);
  478. if (that.tabList[i].id == that.$Route.query.id) {
  479. that.tabindex = i
  480. // console.log(that.$Route.query.id);
  481. if (that.$Route.query.id == 3) {
  482. this.isLoading = false
  483. return;
  484. }
  485. this.memberlist(that.$Route.query.id);
  486. }
  487. }
  488. } else {
  489. this.memberlist(that.tabList[0].id);
  490. }
  491. },
  492. systemmember() {
  493. this.$http('conf.getGroupConf', {
  494. group: 'system.member'
  495. }).then(res => {
  496. if (res.code == 0) {
  497. this.instructions = res.data.instructions
  498. // console.log(this.instructions);
  499. }
  500. })
  501. },
  502. getPlan() {
  503. let that = this;
  504. this.$http('conf.getGroupConf', {
  505. group: 'system.plan'
  506. }).then(res => {
  507. if (res.code == 0) {
  508. for (var i = 0; i < this.tabList.length; i++) {
  509. if (that.tabList[i].id == 1) {
  510. that.tabList[i].name = '购买' + (that.appInfo.number_alias ? that.appInfo
  511. .number_alias : '点数')
  512. }
  513. }
  514. this.plan = res.data
  515. // console.log();
  516. // console.log(this.appInfo.time_member);
  517. if (this.appInfo.is_time_front && this.appInfo.is_time_front == 1) {
  518. this.tabList.reverse()
  519. }
  520. if (this.appInfo.time_member && this.appInfo.time_member == 2) {
  521. for (var i = 0; i < this.tabList.length; i++) {
  522. if (that.tabList[i].id == 2) {
  523. this.tabList.splice(i, 1)
  524. }
  525. }
  526. }
  527. if (this.appInfo.number_member && this.appInfo.number_member == 2) {
  528. for (var i = 0; i < this.tabList.length; i++) {
  529. if (that.tabList[i].id == 1) {
  530. // console.log(i);
  531. this.tabList.splice(i, 1)
  532. }
  533. }
  534. }
  535. let tntv = {
  536. id: 3,
  537. name: '免费领' + (that.appInfo.number_alias ? that.appInfo.number_alias : '点数'),
  538. badge: {
  539. isDot: true
  540. }
  541. }
  542. this.tabList.push(tntv)
  543. this.everyday = this.tabList.length == 2 ? 1 : 2
  544. this.ytrty()
  545. this.systemmember()
  546. if (res.data.is_ios_pay == 1 && that.checkTimeLimit()) {
  547. // ios可以付钱
  548. that.show_ios_pay = true
  549. }
  550. }
  551. })
  552. },
  553. buy() {
  554. let that = this;
  555. // console.log(that.tabindex);
  556. if (that.tabindex == 0 && that.userData.vip_time == 9999) {
  557. uni.showModal({
  558. confirmColor: '#207CF7',
  559. confirmText: '确定',
  560. cancelText: '退出',
  561. title: '提示',
  562. content: '您已购买永久会员,无需再次购买',
  563. success(src) {
  564. if (src.confirm) {
  565. } else if (src.cancel) {
  566. uni.navigateBack()
  567. }
  568. }
  569. });
  570. return
  571. }
  572. that.$http('order.create', {
  573. pay_type: 'wechat',
  574. link_id: that.list[that.current].id
  575. }).then(res => {
  576. if (res.code === 0) {
  577. if (that.userInfo.openid_miniapp || that.userInfo.openid_wechat) {
  578. let pay = new ShoproPay('wechat', res.data, 0);
  579. } else {
  580. // console.log(res.data);
  581. that.paytest(res.data.order_number, res.data.id)
  582. }
  583. } else {
  584. that.$u.toast(res.msg);
  585. }
  586. });
  587. },
  588. paytest(e, id) {
  589. uni.showLoading({
  590. title: '支付跳转中...'
  591. })
  592. let uniacid = uni.getStorageSync("uniacid") || "";
  593. this.$http('pay.hupijiaopay', {
  594. order_number: e,
  595. is_commission: 0,
  596. return_url: window.location.href.split('/h5')[0] +
  597. '/h5/pages/user/public/paymentdetail?uniacid=' + uniacid + '&orderType=0&orderId=' + id,
  598. callback_url: window.location.href,
  599. }).then(res => {
  600. // console.log(res);
  601. if (res.code === 0) {
  602. // console.log(res.data);
  603. window.location.href = res.data.url
  604. // console.log('return_url', res.data.url);
  605. // uni.navigateTo({
  606. // url:'pages/user/public/webview?url='+res.data.url
  607. // })
  608. } else {
  609. this.$u.toast(res.msg);
  610. }
  611. });
  612. },
  613. gettabs(e) {
  614. // console.log(e.index);
  615. this.tabindex = e.index
  616. if (this.tabList.length == 3) {
  617. this.list = []
  618. if (e.index < 2) {
  619. // this.type = e.id
  620. this.current = 0
  621. this.memberlist(e.id);
  622. }
  623. } else {
  624. this.list = []
  625. if (e.index < 1) {
  626. // this.type = e.id
  627. this.current = 0
  628. this.memberlist(e.id);
  629. }
  630. }
  631. },
  632. getrecord() {
  633. uni.navigateTo({
  634. url: '/pages/user/member/record'
  635. })
  636. },
  637. goBack() {
  638. uni.navigateBack({
  639. })
  640. },
  641. goHome() {
  642. uni.switchTab({
  643. url: '/pages/index'
  644. })
  645. },
  646. memberaddCoin(e) {
  647. this.$http('member.addCoin', {
  648. type: e,
  649. }).then(res => {
  650. if (res.code === 0) {
  651. if (e == 'sign') {
  652. uni.showToast({
  653. title: (this.appInfo.number_alias ? this.appInfo.number_alias + ' +' :
  654. '点数 +') + this.plan.sign
  655. })
  656. }
  657. if (e == 'share') {
  658. setTimeout(() => {
  659. uni.showToast({
  660. title: (this.appInfo.number_alias ? this.appInfo.number_alias +
  661. ' +' : '点数 +') + this.plan.share
  662. })
  663. }, 1000)
  664. }
  665. this.getUserData();
  666. }
  667. });
  668. },
  669. checkTimeLimit() {
  670. if (this.plan.open_period == 1) {
  671. return true;
  672. } else {
  673. if (this.time_range('8:00', '20:00')) {
  674. return false;
  675. } else {
  676. return true;
  677. }
  678. }
  679. },
  680. time_range(beginTime, endTime) {
  681. var strb = beginTime.split(':');
  682. if (strb.length != 2) {
  683. return false;
  684. }
  685. var stre = endTime.split(':');
  686. if (stre.length != 2) {
  687. return false;
  688. }
  689. var b = new Date();
  690. var e = new Date();
  691. var n = new Date();
  692. b.setHours(strb[0]);
  693. b.setMinutes(strb[1]);
  694. e.setHours(stre[0]);
  695. e.setMinutes(stre[1]);
  696. if (n.getTime() - b.getTime() > 0 && n.getTime() - e.getTime() < 0) {
  697. return true;
  698. } else {
  699. return false;
  700. }
  701. }
  702. }
  703. }
  704. </script>
  705. <style lang="scss" scoped>
  706. .infoBg {
  707. background: linear-gradient(to right, $tc, $tc2);
  708. }
  709. /* 胶囊*/
  710. .tn-custom-nav-bar__back {
  711. width: 100%;
  712. height: 100%;
  713. position: relative;
  714. display: flex;
  715. justify-content: space-evenly;
  716. align-items: center;
  717. box-sizing: border-box;
  718. background-color: rgba(0, 0, 0, 0.03);
  719. border-radius: 1000rpx;
  720. border: 1rpx solid rgba(255, 255, 255, 0.5);
  721. color: #FFFFFF;
  722. font-size: 18px;
  723. .icon {
  724. display: block;
  725. flex: 1;
  726. margin: auto;
  727. text-align: center;
  728. }
  729. &:before {
  730. content: " ";
  731. width: 1rpx;
  732. height: 110%;
  733. position: absolute;
  734. top: 22.5%;
  735. left: 0;
  736. right: 0;
  737. margin: auto;
  738. transform: scale(0.5);
  739. transform-origin: 0 0;
  740. pointer-events: none;
  741. box-sizing: border-box;
  742. opacity: 0.05;
  743. background-color: #fff;
  744. }
  745. }
  746. .title-text {
  747. color: #fff;
  748. }
  749. .user-avatar {
  750. width: 140rpx;
  751. height: 140rpx;
  752. border-radius: 50%;
  753. }
  754. .ico-vip {
  755. width: 28rpx;
  756. height: 28rpx;
  757. }
  758. .form {
  759. margin: 0 30rpx 60rpx;
  760. }
  761. .form-choice {
  762. margin: 20rpx 0;
  763. padding: 30rpx 40rpx;
  764. // height: 164rpx;
  765. background-color: #f5f5f5;
  766. border-radius: 14rpx;
  767. position: relative;
  768. }
  769. .form-choice.active {
  770. color: #ffffff;
  771. // background-color: #207CF7;
  772. background: linear-gradient(to right, $tc, $tc2);
  773. }
  774. .ico-special {
  775. width: 158rpx;
  776. height: 48rpx;
  777. }
  778. .explain {
  779. margin: 20rpx 0 20rpx;
  780. }
  781. .explain-title {
  782. margin: 0 0 40rpx;
  783. }
  784. .explain-item {
  785. flex-grow: 1;
  786. text-align: center;
  787. }
  788. .kf_qrcode {
  789. margin-bottom: 20rpx;
  790. }
  791. .ico-explain {
  792. padding: 18rpx;
  793. width: 80rpx;
  794. height: 80rpx;
  795. background-color: #f5f5f5;
  796. border-radius: 50%;
  797. }
  798. .bottom-page {
  799. position: fixed;
  800. bottom: 0;
  801. left: 0;
  802. padding: 0 40rpx 20rpx;
  803. width: 100%;
  804. box-sizing: border-box;
  805. background-color: #F5F5F5;
  806. }
  807. .ico-check {
  808. width: 28rpx;
  809. height: 28rpx;
  810. }
  811. .bottom-btn {
  812. margin: 20rpx 0;
  813. width: 200rpx;
  814. height: 84rpx;
  815. font-weight: bold;
  816. line-height: 84rpx;
  817. text-align: center;
  818. color: #ffffff;
  819. background: linear-gradient(to right, $tc, $tc2);
  820. border-radius: 42rpx;
  821. }
  822. .flex-rb-cc {
  823. display: flex;
  824. align-items: center;
  825. justify-content: space-between;
  826. }
  827. .flex-cc {
  828. display: flex;
  829. align-items: center;
  830. }
  831. .ml20 {
  832. margin-left: 30rpx;
  833. width: 100%;
  834. }
  835. .mb10 {
  836. margin: 10rpx;
  837. }
  838. .fz-24 {
  839. font-size: 24rpx;
  840. }
  841. .fz-38 {
  842. font-size: 38rpx;
  843. }
  844. .mt10 {
  845. margin-top: 10rpx;
  846. }
  847. .fc-999 {
  848. color: #999;
  849. }
  850. .fz-32 {
  851. font-size: 32rpx;
  852. }
  853. .fz-48 {
  854. font-size: 48rpx;
  855. }
  856. .pricefont {
  857. font-weight: bold;
  858. }
  859. .bold {
  860. font-weight: bold;
  861. }
  862. .fc-white5 {
  863. color: white;
  864. }
  865. .fc-c5 {
  866. color: #ccc;
  867. // color: #9e9e9e;
  868. }
  869. .line-through {
  870. text-decoration-line: line-through;
  871. margin-right: 10rpx;
  872. }
  873. .form-special {
  874. // position: absolute;
  875. // left: 0;
  876. // top: 0;
  877. font-size: 24rpx;
  878. }
  879. .selected {
  880. color: #ffeb3b;
  881. }
  882. .fz-42 {
  883. font-size: 42rpx;
  884. }
  885. .tr {
  886. display: flex;
  887. // flex-direction: column;
  888. align-items: flex-end;
  889. }
  890. .task-item {
  891. margin: 30rpx;
  892. padding: 30rpx;
  893. border-radius: 14rpx;
  894. background-color: #f5f5f5;
  895. .task-content {
  896. font-size: 16px;
  897. font-weight: bold;
  898. margin-bottom: 12rpx;
  899. }
  900. .task-frequency {
  901. color: #f9ae3d;
  902. }
  903. .task-button {
  904. background: linear-gradient(to right, $tc, $tc2);
  905. color: #fff;
  906. padding: 12rpx 22rpx;
  907. font-size: 25rpx;
  908. border-radius: 30rpx;
  909. }
  910. .task-buttons {
  911. background: #9e9e9e;
  912. color: #fff;
  913. padding: 12rpx 22rpx;
  914. font-size: 25rpx;
  915. border-radius: 30rpx;
  916. }
  917. }
  918. .share-button {
  919. position: absolute;
  920. width: 70px;
  921. height: 28px;
  922. border-radius: 30rpx;
  923. right: 60rpx;
  924. opacity: 0;
  925. }
  926. .cu-dialog {
  927. position: fixed;
  928. top: 60rpx;
  929. left: 100rpx;
  930. }
  931. .guide-img {
  932. width: 580rpx;
  933. height: 430rpx;
  934. }
  935. .packagetag {
  936. margin-right: 15rpx;
  937. margin-top: 15rpx;
  938. }
  939. </style>