index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852
  1. <template>
  2. <view class="content">
  3. <view class="head">
  4. <view class="head_image">
  5. <!-- #ifdef MP-WEIXIN -->
  6. <button open-type="chooseAvatar" v-if="token" @chooseavatar="onChooseAvatar">
  7. <image
  8. style="width: 90rpx; height: 90rpx; border-radius: 50%"
  9. :src="avatar ? avatar : 'https://mxys.chuanghai-tech.com/wmfile/20250814/fff4dc5d02ea4af881db9685f2e1e61d.png'"
  10. ></image>
  11. </button>
  12. <image
  13. v-if="!token"
  14. @click="bindlogin"
  15. style="width: 90rpx; height: 90rpx; border-radius: 50%"
  16. src="https://mxys.chuanghai-tech.com/wmfile/20250814/fff4dc5d02ea4af881db9685f2e1e61d.png"
  17. ></image>
  18. <!-- #endif -->
  19. <!-- #ifndef MP-WEIXIN -->
  20. <image
  21. @click="avatar ? goLogin() : ''"
  22. style="width: 90rpx; height: 90rpx; border-radius: 50%"
  23. :src="avatar ? avatar : 'https://mxys.chuanghai-tech.com/wmfile/20250814/fff4dc5d02ea4af881db9685f2e1e61d.png'"
  24. ></image>
  25. <!-- #endif -->
  26. <view class="lovip" v-if="isVip">
  27. <image src="../../static/images/my/vip.png" style="width: 88rpx; height: 32rpx; top: -30rpx"></image>
  28. </view>
  29. </view>
  30. <view class="head_name">
  31. <!-- -->
  32. <view class="name" v-if="token" @click="goShop('/pages/my/updateNickName')">{{ userName }}</view>
  33. <view class="name" v-if="!token" @click="bindlogin">登录</view>
  34. </view>
  35. </view>
  36. <view class="margin-lr padding-lr-sm padding-tb radius flex justify-between" v-if="XCXIsSelect == '是'">
  37. <view class="text-center text-black" @click="goShop('/my/coupon/index')">
  38. <view class="text-lg text-bold">{{ msgData.countCoupon }}</view>
  39. <view>外卖优惠券</view>
  40. </view>
  41. <!-- @click="goShop('/my/wallet/index')" -->
  42. <view class="text-center text-black">
  43. <view class="text-lg text-bold">{{ msgData.userMoney }}</view>
  44. <view>我的余额</view>
  45. </view>
  46. <view class="text-center text-black" @click="goShop('/my/task/index')">
  47. <view class="text-lg text-bold">{{ msgData.userIntegral }}</view>
  48. <view>我的积分</view>
  49. </view>
  50. </view>
  51. <view class="margin-bottom padding-lr" style="position: relative" v-if="XCXIsSelect == '是'">
  52. <image src="../../static/images/my/bg.png" style="width: 100%; height: 110rpx" mode=""></image>
  53. <view class="flex justify-between margin-lr padding-tb-sm radius" style="position: absolute; top: 0; width: 640rpx">
  54. <image src="../../static/images/my/huiyuan.png" style="width: 70rpx; height: 70rpx"></image>
  55. <view class="flex-sub margin-left text-lg text-bold" style="line-height: 74rpx; color: #604320">超级会员享特权</view>
  56. <view v-if="!isVip" class="btn-bg" style="color: #604320" @click="goNav({ url: '/my/vip/index' })">去开通</view>
  57. <view v-if="isVip" class="btn-bg" style="color: #604320" @click="goNav({ url: '/my/vip/index' })">已开通</view>
  58. </view>
  59. </view>
  60. <view class="center flex justify-between bg-white margin-top padding-lr padding-tb-lg radius">
  61. <view class="flex justify-between flex-sub padding-right" style="border-right: 2rpx solid #cccccc" @click="goShop('/my/task/index')">
  62. <view class="">
  63. <view class="text-black text-xl text-bold">每日任务</view>
  64. <view class="text-sm margin-top-xs">每日签到领积分</view>
  65. </view>
  66. <image src="../../static/images/my/renwu.png" mode="" style="width: 88rpx; height: 88rpx"></image>
  67. </view>
  68. <view class="flex justify-between flex-sub padding-left" @click="goShop('/my/integral/index')">
  69. <view class="">
  70. <view class="text-black text-xl text-bold">积分商城</view>
  71. <view class="text-sm margin-top-xs flex align-center">积分兑换优惠券</view>
  72. </view>
  73. <image src="../../static/images/my/jifen.png" mode="" style="width: 88rpx; height: 88rpx"></image>
  74. </view>
  75. </view>
  76. <view class="margin padding-lr-sm padding-tb bg-white radius">
  77. <view class="flex justify-between align-center">
  78. <view class="text-lg text-bold text-black">推荐工具</view>
  79. </view>
  80. <view class="flex flex-wrap">
  81. <!-- #ifdef MP-WEIXIN -->
  82. <view class="text-center margin-tb-sm" style="width: 25%" v-if="XCXIsSelect == '是'">
  83. <button class="btn" open-type="share">
  84. <image src="../../static/images/my/4.png" style="width: 50rpx; height: 48rpx" mode=""></image>
  85. <view>分享好友</view>
  86. </button>
  87. </view>
  88. <view class="text-center margin-tb-sm" style="width: 25%" @click="goApplet(shopAppId)" v-if="shopStatus == 1 && XCXIsSelect == '是'">
  89. <image src="../../static/images/my/1.png" style="width: 55rpx; height: 55rpx" mode="scaleToFill"></image>
  90. <view class="text-sm">商家入驻</view>
  91. </view>
  92. <view class="text-center margin-tb-sm" style="width: 25%" @click="goNav({ url: '/my/apply/index' })" v-if="shopStatus != 1 && XCXIsSelect == '是'">
  93. <image src="../../static/images/my/1.png" style="width: 55rpx; height: 55rpx" mode="scaleToFill"></image>
  94. <view class="text-sm">商家入驻</view>
  95. </view>
  96. <!-- <view class="text-center margin-tb-sm" style="width: 25%;" @click="goApplet(qishouAppId)"
  97. v-if="XCXIsSelect=='是'">
  98. <image src="../../static/images/my/11.png" style="width: 55rpx;height: 55rpx;" mode="scaleToFill">
  99. </image>
  100. <view class="text-sm">骑手入驻</view>
  101. </view> -->
  102. <!-- #endif -->
  103. <!-- #ifndef MP-WEIXIN -->
  104. <view class="text-center margin-tb-sm" style="width: 25%" @click="goNav({ url: '/my/apply/index' })" v-if="shopStatus != 1">
  105. <image src="../../static/images/my/1.png" style="width: 55rpx; height: 55rpx" mode="scaleToFill"></image>
  106. <view class="text-sm">商家入驻</view>
  107. </view>
  108. <!-- #ifdef APP -->
  109. <view class="text-center margin-tb-sm" style="width: 25%" @click="shopRuzhu" v-else>
  110. <image src="../../static/images/my/1.png" style="width: 55rpx; height: 55rpx" mode="scaleToFill"></image>
  111. <view class="text-sm">商家入驻</view>
  112. </view>
  113. <!-- #endif -->
  114. <!-- #endif -->
  115. <view class="text-center margin-tb-sm" style="width: 25%" @click="goNav({ url: '/my/tousu/index' })" v-if="XCXIsSelect == '是'">
  116. <image src="../../static/images/order/tousu.png" style="width: 55rpx; height: 55rpx" mode="scaleToFill"></image>
  117. <view class="text-sm">我的投诉</view>
  118. </view>
  119. <view class="text-center margin-tb-sm" style="width: 25%" @click="goNav({ url: '/my/myPingJia/myPingJia' })" v-if="XCXIsSelect == '是'">
  120. <image src="../../static/images/order/pingjia.png" style="width: 55rpx; height: 55rpx" mode="scaleToFill"></image>
  121. <view class="text-sm">我的评价</view>
  122. </view>
  123. <view class="text-center margin-tb-sm" style="width: 25%" @click="goNav({ url: '/my/helpList/index' })">
  124. <image src="../../static/images/my/12.png" style="width: 55rpx; height: 55rpx" mode="scaleToFill"></image>
  125. <view class="text-sm">帮助中心</view>
  126. </view>
  127. <view class="text-center margin-tb-sm" style="width: 25%" @click="goNav({ url: '/my/msg/index' })" v-if="XCXIsSelect == '是'">
  128. <image src="../../static/images/my/3.png" style="width: 55rpx; height: 55rpx" mode="scaleToFill"></image>
  129. <view class="text-sm">消息中心</view>
  130. </view>
  131. <!-- <view class="text-center margin-tb-sm" style="width: 25%;" @click="goNav({url:'/running/index/index'})"
  132. v-if="XCXIsSelect=='是'">
  133. <image src="../../static/images/my/5.png" style="width: 55rpx;height: 55rpx;" mode="scaleToFill">
  134. </image>
  135. <view class="text-sm">同城跑腿</view>
  136. </view> -->
  137. <view class="text-center margin-tb-sm" style="width: 25%" @click="goNav({ url: '/my/setting/chat' })" v-if="XCXIsSelect == '是'">
  138. <image src="../../static/images/my/6.png" style="width: 55rpx; height: 55rpx" mode="scaleToFill"></image>
  139. <view class="text-sm">联系客服</view>
  140. </view>
  141. <view class="text-center margin-tb-sm" style="width: 25%" @click="goNav({ url: '/my/address/index' })">
  142. <image src="../../static/images/my/7.png" style="width: 55rpx; height: 55rpx" mode="scaleToFill"></image>
  143. <view class="text-sm">地址管理</view>
  144. </view>
  145. <!-- <view class="text-center margin-tb-sm" style="width: 25%;" @click="goNav({url:'/my/hongbao/hongbao'})"
  146. v-if="XCXIsSelect=='是'">
  147. <image src="../../static/images/my/9.png" style="width: 55rpx;height: 55rpx;" mode="scaleToFill">
  148. </image>
  149. <view class="text-sm">跑腿红包</view>
  150. </view> -->
  151. <view class="text-center margin-tb-sm" style="width: 25%; position: relative" @click="goNav({ url: '/my/chat/index' })" v-if="XCXIsSelect == '是'">
  152. <image src="../../static/images/order/kefu.png" style="width: 55rpx; height: 55rpx" mode="scaleToFill"></image>
  153. <view class="text-sm">聊天室</view>
  154. <view
  155. v-if="messageCount > 0"
  156. style="
  157. height: 32rpx;
  158. width: 32rpx;
  159. border-radius: 100rpx;
  160. background-color: red;
  161. color: #fff;
  162. text-align: center;
  163. position: absolute;
  164. top: -10rpx;
  165. right: 24rpx;
  166. "
  167. >
  168. {{ messageCount }}
  169. </view>
  170. </view>
  171. <view class="text-center margin-tb-sm" style="width: 25%" @click="goNav({ url: '/my/setting/index' })">
  172. <image src="../../static/images/my/8.png" style="width: 55rpx; height: 55rpx" mode="scaleToFill"></image>
  173. <view class="text-sm">系统设置</view>
  174. </view>
  175. <!-- <view class="text-center margin-tb-sm" style="width: 25%" @click="goNav({ url: '/my/taocan/list' })">
  176. <image
  177. src="https://mxys.chuanghai-tech.com/wmfile/20250812/6431457fbda24074af9bcd5c229eaa7e.png"
  178. style="width: 55rpx; height: 55rpx"
  179. mode="scaleToFill"
  180. ></image>
  181. <view class="text-sm">我的套餐</view>
  182. </view> -->
  183. </view>
  184. </view>
  185. <!-- 联系客服悬浮按钮区域 -->
  186. <view class="serviceBtn" @click="goChat"></view>
  187. <!-- 用于图片压缩的canvas画布 -->
  188. <canvas
  189. :style="{
  190. width: cw + 'px',
  191. height: cw + 'px',
  192. position: 'absolute',
  193. zIndex: -1,
  194. left: '-10000rpx',
  195. top: '-10000rpx'
  196. }"
  197. canvas-id="zipCanvas"
  198. ></canvas>
  199. <!--画布结束-->
  200. </view>
  201. </template>
  202. <script>
  203. import configdata from '@/common/config.js'
  204. import getLessLimitSizeImage from '@/utils/imageCompress.js'
  205. export default {
  206. data() {
  207. return {
  208. messageCount: 0,
  209. avatar: '',
  210. userName: '',
  211. checkCertification: -1,
  212. arr: [],
  213. showModal: true,
  214. msgData: {
  215. userIntegral: 0,
  216. countCoupon: 0,
  217. userMoney: 0
  218. },
  219. tuiguang: '',
  220. tuiguangImg: '',
  221. token: '',
  222. XCXIsSelect: '否',
  223. shopStatus: '',
  224. isVip: false,
  225. messageCount: 0,
  226. time: '',
  227. qishouAppId: '', //骑手APPID
  228. shopAppId: '', //商户appid
  229. //画板边长默认是屏幕宽度,正方形画布
  230. cw: uni.getSystemInfoSync().windowWidth
  231. }
  232. },
  233. onLoad() {
  234. let that = this
  235. that.token = that.$queue.getData('token')
  236. that.$Request.get('/app/common/type/248').then((res) => {
  237. //跑腿师傅端微信小程序APPID 248
  238. if (res.code == 0) {
  239. that.qishouAppId = res.data.value
  240. }
  241. })
  242. that.$Request.get('/app/common/type/305').then((res) => {
  243. //商户端微信小程序APPID 305
  244. if (res.code == 0) {
  245. that.shopAppId = res.data.value
  246. }
  247. })
  248. that.XCXIsSelect = that.$queue.getData('XCXIsSelect') ? that.$queue.getData('XCXIsSelect') : '是'
  249. that.time = setInterval(function () {
  250. that.messageCount = uni.getStorageSync('messageCount')
  251. if (that.messageCount) {
  252. that.messageCount = that.messageCount
  253. } else {
  254. that.messageCount = 0
  255. }
  256. }, 3000)
  257. that.getZiZhi()
  258. console.log('that.XCXIsSelect___:' + that.XCXIsSelect)
  259. },
  260. onHide() {
  261. clearInterval(this.time)
  262. },
  263. onShow() {
  264. let that = this
  265. // this.avatar = this.$queue.getData('avatar') || '';
  266. // this.userName = this.$queue.getData('userName') || '';
  267. that.token = that.$queue.getData('token')
  268. if (that.token) {
  269. that.getUserInfo()
  270. that.getMsgData()
  271. that.messageCount = uni.getStorageSync('messageCount')
  272. if (that.messageCount) {
  273. that.messageCount = that.messageCount
  274. } else {
  275. that.messageCount = 0
  276. }
  277. } else {
  278. that.token = ''
  279. that.isVip = false
  280. that.userName = ''
  281. that.avatar = ''
  282. that.msgData.userIntegral = 0
  283. that.msgData.countCoupon = 0
  284. that.msgData.userMoney = 0
  285. }
  286. },
  287. onShareAppMessage(res) {
  288. //发送给朋友
  289. return {
  290. title: this.tuiguang,
  291. path: '/pages/index/index',
  292. imageUrl: this.tuiguangImg
  293. }
  294. },
  295. onShareTimeline(res) {
  296. //分享到朋友圈
  297. return {
  298. title: this.tuiguang,
  299. path: '/pages/index/index',
  300. imageUrl: this.tuiguangImg
  301. }
  302. },
  303. methods: {
  304. goChat() {
  305. if (this.token) {
  306. uni.navigateTo({
  307. url: '/my/setting/chat'
  308. })
  309. } else {
  310. this.bindlogin()
  311. }
  312. },
  313. //微信填写能力获取头像
  314. onChooseAvatar(e) {
  315. console.log(e.detail.avatarUrl)
  316. let that = this
  317. let token = uni.getStorageSync('token')
  318. uni.showLoading({
  319. title: '上传中...',
  320. mask: true // 是否显示透明蒙层,防止触摸穿透
  321. })
  322. uni.uploadFile({
  323. // url: config.APIHOST1 + '/app/new-file/upload', //仅为示例,非真实的接口地址
  324. url: that.config('APIHOST1') + '/app/new-file/upload', //仅为示例,非真实的接口地址
  325. filePath: e.detail.avatarUrl,
  326. header: {
  327. token: token
  328. },
  329. name: 'file',
  330. success: (uploadFileRes) => {
  331. let url = JSON.parse(uploadFileRes.data).data
  332. let data = {
  333. avatar: url
  334. }
  335. that.$Request.postT('/app/user/updateUserImageUrl', data).then((res) => {
  336. console.log(res)
  337. uni.hideLoading()
  338. if (res.code === 0) {
  339. that.$queue.showToast('更新成功')
  340. that.getUserInfo()
  341. }
  342. })
  343. }
  344. })
  345. },
  346. // getName(){
  347. // wx.requestPayment({
  348. // timeStamp: '1723710543',
  349. // nonceStr: '7db6a8aec2a542c7a4852c856595fcd3',
  350. // package: 'prepay_id=wx15162903191561245ec1269166539c0000',
  351. // signType: 'RSA',
  352. // paySign: 'AyvptQMyOiP5cmbInu3fsg4ww3HYm+YYOCwkRyFM2DgFpe3DO4jAhyHpaFsZywnaK0rZVIFI1lgF3tV5fFxTSj1PMSzZpFEVPOHg5uCw6O21ESIJ9XuockX9iWyWcNv5gY5W8ARm73Kt/bZRjyXtE68Ryr1D5Fievo3gh7u71vt2FczvO4Nb0C2u7BY3UOWQ9BEHskuYPhpBkpeuoogorNRtBbg4DHiege1hhcf5On3of/xsGnBPMHNUgix8ljSX+A769XGedzxzQQ5z63Pi7svletdlUewyHdhyTLhXhVqHQLWG/ImdCw3PaXjsoefbdXxv8e3epx3Kux77nTta3w==',
  353. // success (res) {
  354. // console.log(res,'成功')
  355. // },
  356. // fail (res) {
  357. // console.log(res,'失败')
  358. // }
  359. // })
  360. // },
  361. goLogin() {
  362. let that = this
  363. var url = null
  364. let userId = this.$queue.getData('userId')
  365. if (!userId) {
  366. this.bindlogin()
  367. return
  368. }
  369. uni.showActionSheet({
  370. // itemList按钮的文字接受的是数组
  371. itemList: ['查看头像', '从相册选择图片'],
  372. success(e) {
  373. var index = e.tapIndex
  374. if (index === 0) {
  375. // 用户点击了预览当前图片
  376. // 可以自己实现当前头像链接的读取
  377. let url = that.avatar
  378. let arr = []
  379. arr.push(url)
  380. uni.previewImage({
  381. // 预览功能图片也必须是数组的
  382. urls: arr
  383. })
  384. } else if (index === 1) {
  385. uni.chooseImage({
  386. count: 1,
  387. sourceType: ['album'],
  388. success: (res) => {
  389. let token = uni.getStorageSync('token')
  390. for (let i = 0; i < res.tempFiles.length; i++) {
  391. //这里的id和页面中写的html代码的canvas的id要一致
  392. let canvasId = 'zipCanvas'
  393. //原图的路径
  394. let imagePath = res.tempFiles[i].path
  395. //大小限制
  396. let limitSize = 1024 * 2
  397. //初始绘画区域是画布自身的宽度也就是屏幕宽度
  398. let drawWidth = uni.getSystemInfoSync().windowWidth
  399. let that = this
  400. let token = uni.getStorageSync('token')
  401. getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, that, (resPath) => {
  402. uni.showLoading({
  403. title: '上传中'
  404. })
  405. uni.uploadFile({
  406. url: that.config('APIHOST') + '/app/new-file/upload',
  407. filePath: resPath,
  408. header: {
  409. token: token
  410. },
  411. name: 'file',
  412. success: (uploadFileRes) => {
  413. url = JSON.parse(uploadFileRes.data).data
  414. let data = {
  415. avatar: url
  416. }
  417. that.$Request.postT('/app/user/updateUserImageUrl', data).then((res) => {
  418. uni.hideLoading()
  419. if (res.code === 0) {
  420. that.$queue.showToast('更新成功')
  421. that.getUserInfo()
  422. }
  423. })
  424. },
  425. fail: () => {
  426. uni.showToast({
  427. title: '上传失败',
  428. icon: 'error'
  429. })
  430. }
  431. })
  432. })
  433. }
  434. }
  435. })
  436. }
  437. }
  438. })
  439. },
  440. shopRuzhu() {
  441. uni.showToast({
  442. title: '请先下载同城外卖商户端APP',
  443. icon: 'none'
  444. })
  445. },
  446. getMsgData() {
  447. this.$Request.get('/app/userintegral/findUserMessage').then((res) => {
  448. if (res.code == 0) {
  449. this.msgData = res.data
  450. }
  451. })
  452. },
  453. // 分享文案和图片
  454. getZiZhi() {
  455. this.$Request.getT('/app/common/type/239').then((res) => {
  456. if (res.code === 0) {
  457. this.tuiguang = res.data.value
  458. }
  459. })
  460. this.$Request.getT('/app/common/type/238').then((res) => {
  461. if (res.code === 0) {
  462. this.tuiguangImg = res.data.value
  463. }
  464. })
  465. },
  466. goSwt(e) {
  467. uni.setStorageSync('current', e)
  468. setTimeout(function () {
  469. uni.switchTab({
  470. url: '/pages/order/index'
  471. })
  472. }, 10)
  473. },
  474. goApplet(e) {
  475. uni.navigateToMiniProgram({
  476. appId: e,
  477. path: 'pages/index/index',
  478. success(res) {
  479. // 打开成功
  480. }
  481. })
  482. },
  483. goNav(e) {
  484. if (this.token) {
  485. if (e.name == '注册骑手') {
  486. uni.navigateToMiniProgram({
  487. appId: 'wxa59b58efa950ba1f',
  488. path: '/pages/login/login',
  489. extraData: {
  490. data1: 'test'
  491. },
  492. success(res) {
  493. // 打开成功
  494. console.log('打开成功')
  495. }
  496. })
  497. } else if (e.name == '分享好友') {
  498. uni.share({
  499. provider: 'weixin',
  500. scene: 'WXSceneSession',
  501. type: 1,
  502. summary: '我正在使用HBuilderX开发uni-app,赶紧跟我一起来体验!',
  503. success: function (res) {
  504. console.log('success:' + JSON.stringify(res))
  505. },
  506. fail: function (err) {
  507. console.log('fail:' + JSON.stringify(err))
  508. }
  509. })
  510. } else {
  511. uni.navigateTo({
  512. url: e.url
  513. })
  514. }
  515. } else if (e.url == '/my/helpList/index') {
  516. uni.navigateTo({
  517. url: e.url
  518. })
  519. } else {
  520. this.bindlogin()
  521. }
  522. },
  523. goShop(url) {
  524. if (this.token) {
  525. uni.navigateTo({
  526. url
  527. })
  528. } else {
  529. this.bindlogin()
  530. }
  531. },
  532. getUserInfo() {
  533. this.$Request.getT('/app/user/selectUserMessage').then((res) => {
  534. console.log(res)
  535. if (res.code == 0) {
  536. if (parseInt(res.data.checkCertification)) {
  537. this.checkCertification = parseInt(res.data.checkCertification)
  538. } else {
  539. this.checkCertification = -1
  540. }
  541. // this.isVip = res.data.isVip
  542. this.shopStatus = res.data.shopStatus
  543. this.$queue.setData('avatar', res.data.avatar ? res.data.avatar : 'https://mxys.chuanghai-tech.com/wmfile/20250814/fff4dc5d02ea4af881db9685f2e1e61d.png')
  544. this.$queue.setData('userId', res.data.userId)
  545. this.$queue.setData('phone', res.data.phone)
  546. this.$queue.setData('status', res.data.status)
  547. this.$queue.setData('userName', res.data.userName ? res.data.userName : res.data.nickName)
  548. this.avatar = res.data.avatar ? res.data.avatar : 'https://mxys.chuanghai-tech.com/wmfile/20250814/fff4dc5d02ea4af881db9685f2e1e61d.png'
  549. this.userName = res.data.userName ? res.data.userName : res.data.nickName
  550. const vip = res.data.isVip == 1 ? true : false
  551. // 2. 解析为时间戳(毫秒)
  552. const expireTimestamp = new Date(res.data.vipExpirationTime).getTime()
  553. // 获取当前时间的时间戳
  554. const currentTimestamp = new Date().getTime()
  555. if (vip == true) {
  556. // 3. 比较:当前时间 > 有效期 → 已过期
  557. if (currentTimestamp > expireTimestamp) {
  558. this.isVip = false
  559. // 这里写过期后的逻辑(比如提示用户、跳转页面等)
  560. } else {
  561. this.isVip = true
  562. }
  563. } else {
  564. this.isVip = false
  565. }
  566. }
  567. })
  568. },
  569. bindlogin() {
  570. if (!this.token) {
  571. uni.navigateTo({
  572. url: '/pages/public/login'
  573. })
  574. }
  575. },
  576. bindTo(name) {
  577. console.log(name)
  578. if (this.token) {
  579. if (name == '我的红包') {
  580. uni.navigateTo({
  581. url: '/pages/my/hongbao/hongbao'
  582. })
  583. } else if (name == '注册骑手') {
  584. uni.navigateToMiniProgram({
  585. appId: 'wx5ed22ce813e47796',
  586. path: '/pages/index/index',
  587. extraData: {
  588. data1: 'test'
  589. },
  590. success(res) {
  591. // 打开成功
  592. console.log('打开成功')
  593. }
  594. })
  595. } else if (name == '意见反馈') {
  596. uni.navigateTo({
  597. url: '/pageA/feedback/feedback'
  598. })
  599. } else if (name == '联系客服') {
  600. uni.navigateTo({
  601. url: '/pageA/kefu/kefu'
  602. })
  603. } else if (name == '系统设置') {
  604. uni.navigateTo({
  605. url: '/pages/my/set/set'
  606. })
  607. } else if (name == '地址管理') {
  608. uni.navigateTo({
  609. url: '/pageA/address/address'
  610. })
  611. }
  612. } else {
  613. this.bindlogin()
  614. }
  615. },
  616. bindapprove() {
  617. if (this.token) {
  618. uni.navigateTo({
  619. url: '/pages/my/approve/approve'
  620. })
  621. } else {
  622. this.bindlogin()
  623. }
  624. },
  625. binduser() {
  626. if (this.token) {
  627. // uni.navigateTo({
  628. // url: '/pages/my/userphone/userphone'
  629. // })
  630. } else {
  631. this.bindlogin()
  632. }
  633. },
  634. config: function (name) {
  635. var info = null
  636. if (name) {
  637. var name2 = name.split('.') //字符分割
  638. if (name2.length > 1) {
  639. info = configdata[name2[0]][name2[1]] || null
  640. } else {
  641. info = configdata[name] || null
  642. }
  643. if (info == null) {
  644. let web_config = cache.get('web_config')
  645. if (web_config) {
  646. if (name2.length > 1) {
  647. info = web_config[name2[0]][name2[1]] || null
  648. } else {
  649. info = web_config[name] || null
  650. }
  651. }
  652. }
  653. }
  654. return info
  655. }
  656. }
  657. }
  658. </script>
  659. <style>
  660. button::after {
  661. border: none;
  662. background-color: none;
  663. }
  664. button {
  665. position: relative;
  666. display: block;
  667. margin-left: auto;
  668. margin-right: auto;
  669. padding-left: 0px;
  670. padding-right: 0px;
  671. box-sizing: border-box;
  672. text-decoration: none;
  673. line-height: 1.35;
  674. overflow: hidden;
  675. color: #666666;
  676. /* background-color: #fff; */
  677. background-color: rgba(255, 255, 255, 0) !important;
  678. width: 100%;
  679. height: 100%;
  680. }
  681. .btn-bg {
  682. width: 64px;
  683. height: 28px;
  684. background: linear-gradient(90deg, #cda26e 0%, #dcb78a 100%);
  685. border-radius: 28px;
  686. text-align: center;
  687. line-height: 28px;
  688. margin-top: 10upx;
  689. color: '#604320';
  690. }
  691. body {
  692. background: #f5f5f5;
  693. }
  694. /* #ifndef MP-WEIXIN */
  695. page {
  696. background: #f2eded;
  697. }
  698. /* #endif */
  699. .content {
  700. width: 100%;
  701. }
  702. .btn {
  703. font-size: 24upx;
  704. /* width: 95%; */
  705. text-align: center;
  706. background: #ffffff;
  707. margin-top: 6rpx;
  708. }
  709. .head {
  710. /* width: 100%; */
  711. /* height: 200rpx; */
  712. display: flex;
  713. align-items: center;
  714. padding: 30rpx;
  715. border-radius: 16rpx;
  716. background-image: linear-gradient(#fefbda, #f7f7f7);
  717. }
  718. .head_image {
  719. }
  720. .head_image > image {
  721. width: 90rpx;
  722. height: 90rpx;
  723. border-radius: 50%;
  724. }
  725. .head_name {
  726. margin-left: 10rpx;
  727. }
  728. .name {
  729. font-size: 38rpx;
  730. font-weight: bold;
  731. }
  732. .approve {
  733. position: absolute;
  734. top: 100rpx;
  735. font-size: 24rpx;
  736. color: #999999;
  737. }
  738. /* 列表 */
  739. .use_list {
  740. width: 100%;
  741. background: #ffffff;
  742. margin-top: 20rpx;
  743. }
  744. .list_box {
  745. width: 90%;
  746. margin: 0 auto;
  747. display: flex;
  748. height: 110rpx;
  749. }
  750. .box_left {
  751. flex: 1;
  752. display: flex;
  753. justify-content: left;
  754. align-items: center;
  755. }
  756. .box_right {
  757. flex: 1;
  758. display: flex;
  759. justify-content: flex-end;
  760. align-items: center;
  761. color: #808080;
  762. }
  763. .use_name {
  764. margin-left: 30rpx;
  765. font-size: 32rpx;
  766. }
  767. .use_image image {
  768. width: 50rpx;
  769. height: 50rpx;
  770. }
  771. .center {
  772. width: 94%;
  773. /* line-height: 1.5; */
  774. background-color: #ffffff;
  775. border-radius: 18rpx;
  776. margin: 0 auto 0;
  777. display: flex;
  778. justify-content: space-between;
  779. }
  780. .header_text2 {
  781. font-size: 24rpx;
  782. font-weight: 500;
  783. color: #999999;
  784. margin-top: 10rpx;
  785. }
  786. .header_text4 {
  787. font-size: 32rpx;
  788. font-weight: bold;
  789. color: #333333;
  790. }
  791. .serviceBtn {
  792. position: fixed;
  793. right: 52rpx;
  794. bottom: 50rpx;
  795. display: flex;
  796. flex-direction: column;
  797. align-items: center;
  798. justify-content: center;
  799. width: 100rpx;
  800. height: 120rpx;
  801. color: #fff;
  802. font-size: 20rpx;
  803. background-image: url(https://mxys.chuanghai-tech.com/wmfile/20260413/b645b4f41ba34128ae6b88d2fe30c813.png);
  804. background-repeat: no-repeat;
  805. background-size: contain;
  806. }
  807. </style>