index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  1. <template>
  2. <view>
  3. <view style="background-color:#03803B;height: 250rpx;">
  4. <view style="padding: 33rpx;display: flex;align-items: center;">
  5. <view class="">
  6. <image :src="userData.avatar||avatarUrl" style="width:100rpx;height: 100rpx;border-radius: 50%;"
  7. mode="scaleToFill" @click="showActionSheet">
  8. </image>
  9. </view>
  10. <view style="color:#fff;margin-left: 13rpx;font-size: 30rpx;font-weight: 500;">
  11. {{shopInfo.cname?shopInfo.cname:''}}
  12. </view>
  13. <view style="width: 30px; height: 30px; margin-left: auto; margin-right: 13rpx;">
  14. <image class="QR" src="@/static/images/QR.png" @click.stop="inQR" style="width: 30px; height: 30px;" />
  15. </view>
  16. </view>
  17. </view>
  18. <view class="card" style="height: 114rpx;">
  19. <view style="display: flex;justify-content: space-around;align-items: center;height: 114rpx;">
  20. <text style="color:#818181;font-size: 24rpx;">
  21. 产生积分:
  22. <text style="color:#FE8301;font-size: 26rpx;">
  23. {{form.addPoints?form.addPoints:'0.00'}}
  24. </text>
  25. </text>
  26. <text style="color:#818181;font-size: 24rpx;">
  27. 使用积分:
  28. <text style="color:#FE8301;font-size: 26rpx;">
  29. {{form.subPoints?form.subPoints:'0.00'}}
  30. </text>
  31. </text>
  32. <text style="color:#818181;font-size: 24rpx;">
  33. 积分余额:
  34. <text style="color:#FE8301;font-size: 26rpx;">
  35. {{form.pointsBalance?form.pointsBalance:'0.00'}}
  36. </text>
  37. </text>
  38. </view>
  39. </view>
  40. <view class="card" style="margin-top: 20rpx;height: 141rpx;">
  41. <view style="display: flex;justify-content: space-around;align-items: center;height: 141rpx;">
  42. <view style="display: flex;flex-direction:column;align-items: center;" @click="allClick('积分订单')">
  43. <image src="/static/images/me/280-1.png" style="width:40rpx;height: 40rpx;" mode="scaleToFill">
  44. </image>
  45. <view style="color: #414141;font-size: 26rpx;margin-top: 13rpx;">积分订单
  46. <uni-icons type="right" size="13" color='#8A8A8A'></uni-icons>
  47. </view>
  48. </view>
  49. <view style="display: flex;flex-direction:column;align-items: center;" @click="inIntegralMall">
  50. <image src="/static/images/me/280-2.png" style="width:40rpx;height: 40rpx;" mode="scaleToFill">
  51. </image>
  52. <view style="color: #414141;font-size: 26rpx;margin-top: 13rpx;">积分商城
  53. <uni-icons type="right" size="13" color='#8A8A8A'></uni-icons>
  54. </view>
  55. </view>
  56. <view style="display: flex;flex-direction:column;align-items: center;" @click="RedemptionOfPoints">
  57. <image src="/static/images/me/280-3.png" style="width:40rpx;height: 40rpx;" mode="scaleToFill">
  58. </image>
  59. <view style="color: #414141;font-size: 26rpx;margin-top: 13rpx;">我的积分
  60. <uni-icons type="right" size="13" color='#8A8A8A'></uni-icons>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <view class="card" style="margin-top: 20rpx;height: 238rpx;padding: 20rpx 0;">
  66. <u-cell-group :border="false">
  67. <u-cell title="我的订单" value="查看全部订单" :border="false" :clickable="false" @click="allClick('我的订单')">
  68. <view slot="right-icon">
  69. <uni-icons type="right" size="18" color='#D2D2D2'></uni-icons>
  70. </view>
  71. </u-cell>
  72. </u-cell-group>
  73. <view style="display: flex;justify-content: space-around;">
  74. <!-- <view style="display: flex;flex-direction:column;align-items: center;" @click="obligationBtn('待付款')">
  75. <image src="/static/images/me/280@2x(1).png" style="width:81rpx;height: 81rpx;" mode="scaleToFill">
  76. </image>
  77. <view style="color: #414141;font-size: 26rpx;margin-top: 13rpx;">待付款</view>
  78. </view>-->
  79. <view style="display: flex;flex-direction:column;align-items: center;" @click="allClick('待发货')">
  80. <image src="/static/images/me/280@2x(2).png" style="width:81rpx;height: 81rpx;" mode="scaleToFill">
  81. </image>
  82. <view style="color: #414141;font-size: 26rpx;margin-top: 13rpx;">待发货</view>
  83. </view>
  84. <view style="display: flex;flex-direction:column;align-items: center;" @click="allClick('待收货')">
  85. <image src="/static/images/me/280@2x(3).png" style="width:81rpx;height: 81rpx;" mode="scaleToFill">
  86. </image>
  87. <view style="color: #414141;font-size: 26rpx;margin-top: 13rpx;">待收货</view>
  88. </view>
  89. <view style="display: flex;flex-direction:column;align-items: center;" @click="allClick('已收货')">
  90. <image src="/static/images/me/280@2x(4).png" style="width:81rpx;height: 81rpx;" mode="scaleToFill">
  91. </image>
  92. <view style="color: #414141;font-size: 26rpx;margin-top: 13rpx;">已完成</view>
  93. </view>
  94. <view style="display: flex;flex-direction:column;align-items: center;" @click="allClick('退款售后')">
  95. <image src="/static/images/me/280@2x(5).png" style="width:81rpx;height: 81rpx;" mode="scaleToFill">
  96. </image>
  97. <view style="color: #414141;font-size: 26rpx;margin-top: 13rpx;">退款/售后</view>
  98. </view>
  99. </view>
  100. </view>
  101. <view class="card2" style="margin-top: 20rpx;display: flex;align-items: center;">
  102. <u-cell-group :border="false">
  103. <u-cell title="个人资料" :clickable="true" @click="allClick('个人资料')">
  104. <view slot="icon">
  105. <image src="/static/images/me/100.png" style="width:26rpx;height: 27rpx;margin-right: 10rpx;"
  106. mode="scaleToFill">
  107. </image>
  108. </view>
  109. <view slot="right-icon">
  110. <uni-icons type="right" size="18" color='#CCCCCC'></uni-icons>
  111. </view>
  112. </u-cell>
  113. <u-cell title="地址管理" :clickable="true" @click="clickAddress">
  114. <view slot="icon">
  115. <image src="/static/images/me/102.png" style="width:26rpx;height: 27rpx;margin-right: 10rpx;"
  116. mode="scaleToFill">
  117. </image>
  118. </view>
  119. <view slot="right-icon">
  120. <uni-icons type="right" size="18" color='#CCCCCC'></uni-icons>
  121. </view>
  122. </u-cell>
  123. <u-cell title="设置" :clickable="true" :border="false" @click="setUp">
  124. <view slot="icon">
  125. <image src="/static/images/me/103.png" style="width:26rpx;height: 27rpx;margin-right: 10rpx;"
  126. mode="scaleToFill">
  127. </image>
  128. </view>
  129. <view slot="right-icon">
  130. <uni-icons type="right" size="18" color='#CCCCCC'></uni-icons>
  131. </view>
  132. </u-cell>
  133. </u-cell-group>
  134. </view>
  135. <!-- 提取去登录 -->
  136. <u-modal :show="adminShow" :showCancelButton="true" content='当前还未登录请先登录!!' @confirm="adminConfirm"
  137. @cancel="adminCancel"></u-modal>
  138. <uni-popup ref="popup">
  139. <image style="width: 400rpx;height: 400rpx;background-color: #fff;" :src="imgPopup" />
  140. </uni-popup>
  141. </view>
  142. </template>
  143. <script>
  144. import {
  145. getAppDetails,
  146. generateQrCode
  147. } from '@/api/home/store.js'
  148. export default {
  149. data() {
  150. return {
  151. avatarUrl: '/static/images/me/head.png',
  152. tempFilePaths: [],
  153. userData: uni.getStorageSync('userInfo'),
  154. badgeList: [],
  155. form: {},
  156. adminShow: false,
  157. shopInfo: {},
  158. imgPopup: ''
  159. }
  160. },
  161. onShow() {
  162. this.$u.api.isDisable()
  163. this.getUpdate()
  164. this.getAppDetails()
  165. },
  166. methods: {
  167. inQR() {
  168. if (this.shopInfo.filePath) {
  169. this.imgPopup = this.shopInfo.filePath
  170. this.$refs.popup.open()
  171. return false
  172. }
  173. this.imgPopup = null
  174. uni.showLoading({
  175. title: '加载中',
  176. mask: true
  177. });
  178. generateQrCode({
  179. corpId: this.shopInfo.id
  180. }).then(res => {
  181. this.$refs.popup.open()
  182. this.imgPopup = res.data.filePath
  183. }).finally(() => {
  184. uni.hideLoading()
  185. });
  186. },
  187. getAppDetails() {
  188. getAppDetails().then(res => {
  189. this.shopInfo = res.data
  190. })
  191. },
  192. showActionSheet() {
  193. if (this.userData.checkStatus != '通过') {
  194. uni.showToast({
  195. title: "当前用户未授权,请联系客服",
  196. icon: "none",
  197. mask: true
  198. });
  199. return
  200. }
  201. uni.showActionSheet({
  202. itemList: ['拍照', '从相册选择'],
  203. success: (res) => {
  204. if (res.tapIndex === 0) {
  205. this.chooseMedia('camera')
  206. } else {
  207. this.chooseMedia('album')
  208. }
  209. }
  210. })
  211. },
  212. chooseMedia(sourceType) {
  213. uni.chooseMedia({
  214. count: 1,
  215. mediaType: ['image'],
  216. sourceType: [sourceType],
  217. sizeType: ['original', 'compressed'],
  218. camera: 'front',
  219. success: (res) => {
  220. // this.avatarUrl = res.tempFiles[0].tempFilePath
  221. this.tempFilePaths = res.tempFiles.map(file => file.tempFilePath)
  222. this.uploadFiles()
  223. },
  224. fail: (err) => {
  225. console.log(err)
  226. },
  227. })
  228. },
  229. uploadFiles() {
  230. const uploadTasks = this.tempFilePaths.map((filePath, index) => {
  231. return new Promise((resolve, reject) => {
  232. uni.uploadFile({
  233. url: 'https://lt.echepei.com/api/blade-resource/oss/endpoint/put-file',
  234. filePath: filePath,
  235. name: 'file',
  236. header: {
  237. 'Blade-Auth': 'bearer ' + uni.getStorageSync('accessToken'),
  238. appId: uni.getAccountInfoSync().miniProgram.appId
  239. },
  240. success: (uploadRes) => {
  241. let obj = {
  242. id: this.userData.userId,
  243. avatar: JSON.parse(uploadRes.data).data.link
  244. }
  245. // updateUserAvatar(obj).then(res => {
  246. // uni.showToast({
  247. // title: "上传成功",
  248. // icon: "none",
  249. // mask: true
  250. // });
  251. // this.getUserData()
  252. // })
  253. },
  254. fail: (err) => {
  255. reject(err)
  256. }
  257. })
  258. })
  259. })
  260. },
  261. getUpdate() {
  262. const updateManager = uni.getUpdateManager();
  263. updateManager.onCheckForUpdate(function(res) {
  264. // 请求完新版本信息的回调
  265. if (res.hasUpdate) {
  266. updateManager.onUpdateReady(function() {
  267. uni.showModal({
  268. title: '更新提示',
  269. content: '新版本已经准备好,是否重启应用?',
  270. success: function(res) {
  271. if (res.confirm) {
  272. // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
  273. updateManager.applyUpdate();
  274. }
  275. }
  276. });
  277. });
  278. updateManager.onUpdateFailed(function() {
  279. // 新的版本下载失败
  280. uni.showModal({
  281. title: '已经有新版本了哟~',
  282. content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~'
  283. });
  284. });
  285. }
  286. });
  287. },
  288. // 确认
  289. adminConfirm() {
  290. uni.clearStorageSync();
  291. uni.redirectTo({
  292. url: '/pages/login/login'
  293. })
  294. },
  295. // 取消
  296. adminCancel() {
  297. uni.switchTab({
  298. url: '/pages/me/home'
  299. })
  300. },
  301. clickCall() {
  302. uni.makePhoneCall({
  303. phoneNumber: this.form.contactNumber,
  304. success: function() {
  305. console.log('拨打电话成功');
  306. },
  307. fail() {
  308. console.log('打电话失败了');
  309. }
  310. })
  311. },
  312. setUp() {
  313. this.$u.route('/pages/me/setting/index');
  314. },
  315. allClick(name) {
  316. if (name == '我的订单') {
  317. uni.navigateTo({
  318. url: '/pages/me/myOrder',
  319. });
  320. }
  321. if (name == '待发货') {
  322. uni.navigateTo({
  323. url: '/pages/me/myOrder?xcxStatus=待发货&current=1',
  324. });
  325. }
  326. if (name == '待收货') {
  327. uni.navigateTo({
  328. url: '/pages/me/myOrder?xcxStatus=待收货&current=2',
  329. });
  330. }
  331. if (name == '已收货') {
  332. uni.navigateTo({
  333. url: '/pages/me/myOrder?xcxStatus=已收货&current=3',
  334. });
  335. }
  336. if (name == '退款售后') {
  337. uni.navigateTo({
  338. url: '/pages/me/myOrder?xcxStatus=退款请核,退款中,已取消&current=4',
  339. });
  340. }
  341. if (name == '个人资料') {
  342. uni.navigateTo({
  343. url: '/pages/me/myInfo',
  344. });
  345. }
  346. },
  347. clickMeans() {
  348. uni.showToast({
  349. title: "开发中",
  350. icon: "none",
  351. });
  352. return
  353. uni.$u.route('/pages/views/personalInformation/index');
  354. },
  355. clickContacts() {
  356. uni.showToast({
  357. title: "开发中",
  358. icon: "none",
  359. });
  360. return
  361. uni.$u.route('/pages/views/personalInformation/contacts');
  362. },
  363. clickAddress() {
  364. uni.showToast({
  365. title: "开发中",
  366. icon: "none",
  367. });
  368. return
  369. this.$u.route('/pages/views/personalInformation/addressManagement');
  370. },
  371. // 车型
  372. clickVehicle() {
  373. uni.showToast({
  374. title: "开发中",
  375. icon: "none",
  376. });
  377. return
  378. this.$u.route('/pages/me/vehicleModel');
  379. },
  380. // 积分商城
  381. clickPointsMall() {
  382. this.$u.route('/pages/me/pointsMall');
  383. },
  384. // 积分兑换记录
  385. RedemptionOfPoints() {
  386. uni.showToast({
  387. title: "开发中",
  388. icon: "none",
  389. });
  390. return
  391. this.$u.route('/pages/me/integralList/index');
  392. },
  393. // 积分获取记录
  394. obtainRecord() {
  395. uni.showToast({
  396. title: "开发中",
  397. icon: "none",
  398. });
  399. return
  400. this.$u.route('/pages/me/integralList/obtainRecord');
  401. },
  402. // 消费记录
  403. consumptionRecord() {
  404. uni.showToast({
  405. title: "开发中",
  406. icon: "none",
  407. });
  408. return
  409. this.$u.route('/pages/me/integralList/consumptionRecord');
  410. },
  411. pageJump(value) {
  412. uni.showToast({
  413. title: "开发中",
  414. icon: "none",
  415. });
  416. return
  417. uni.$u.route('/pages/views/salesSlip/index', {
  418. text: value
  419. });
  420. },
  421. obligationBtn(value) {
  422. uni.showToast({
  423. title: "开发中",
  424. icon: "none",
  425. });
  426. return
  427. uni.$u.route('/pages/views/salesSlip/obligation', {
  428. text: value
  429. });
  430. },
  431. inIntegralMall() {
  432. uni.showToast({
  433. title: "开发中",
  434. icon: "none",
  435. });
  436. return
  437. uni.$u.route('/pages/integralMall/index');
  438. }
  439. }
  440. }
  441. </script>
  442. <style lang="scss" scoped>
  443. .action-sheet {
  444. background: #fff;
  445. border-radius: 24rpx 24rpx 0 0;
  446. padding: 30rpx;
  447. }
  448. .action-item {
  449. padding: 28rpx 0;
  450. display: flex;
  451. align-items: center;
  452. justify-content: center;
  453. border-bottom: 1rpx solid #f5f5f5;
  454. text {
  455. margin-left: 20rpx;
  456. font-size: 30rpx;
  457. }
  458. }
  459. .cancel-btn {
  460. padding: 28rpx 0;
  461. text-align: center;
  462. color: #ff2442;
  463. font-size: 30rpx;
  464. margin-top: 20rpx;
  465. }
  466. .card {
  467. position: relative;
  468. margin: 0 32rpx;
  469. background-color: #fff;
  470. border-radius: 14rpx;
  471. bottom: 96rpx;
  472. ::v-deep .u-cell__title-text {
  473. font-size: 26rpx;
  474. color: #333333;
  475. }
  476. ::v-deep .u-cell__value {
  477. font-size: 24rpx;
  478. color: #CBCBCB;
  479. }
  480. ::v-deep .u-icon__icon--info {
  481. font-size: 28rpx !important;
  482. color: #CBCBCB;
  483. }
  484. }
  485. .card2 {
  486. position: relative;
  487. margin: 0 32rpx;
  488. background-color: #fff;
  489. border-radius: 14rpx;
  490. bottom: 96rpx;
  491. ::v-deep .u-cell__title-text {
  492. font-size: 24rpx;
  493. font-weight: 400;
  494. color: #797979;
  495. }
  496. }
  497. </style>