index.vue 13 KB

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