index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  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. {{userData.user_name?userData.user_name:''}}
  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. export default {
  139. data() {
  140. return {
  141. avatarUrl: '/static/images/me/head.png',
  142. tempFilePaths: [],
  143. userData: uni.getStorageSync('userInfo'),
  144. badgeList: [],
  145. form: {},
  146. adminShow: false,
  147. }
  148. },
  149. onShow() {
  150. this.$u.api.isDisable()
  151. this.getUpdate()
  152. this.getUserData()
  153. },
  154. methods: {
  155. getUserData() {
  156. // details().then(res => {
  157. // this.userData = res.data
  158. // corpPointsDetail({
  159. // corpId: res.data.id
  160. // }).then(e => {
  161. // this.form = e.data
  162. // this.form.recoveredBalance = res.data.recoveredBalance
  163. // })
  164. // })
  165. },
  166. showActionSheet() {
  167. if (this.userData.checkStatus != '通过') {
  168. uni.showToast({
  169. title: "当前用户未授权,请联系客服",
  170. icon: "none",
  171. mask: true
  172. });
  173. return
  174. }
  175. uni.showActionSheet({
  176. itemList: ['拍照', '从相册选择'],
  177. success: (res) => {
  178. if (res.tapIndex === 0) {
  179. this.chooseMedia('camera')
  180. } else {
  181. this.chooseMedia('album')
  182. }
  183. }
  184. })
  185. },
  186. chooseMedia(sourceType) {
  187. uni.chooseMedia({
  188. count: 1,
  189. mediaType: ['image'],
  190. sourceType: [sourceType],
  191. sizeType: ['original', 'compressed'],
  192. camera: 'front',
  193. success: (res) => {
  194. // this.avatarUrl = res.tempFiles[0].tempFilePath
  195. this.tempFilePaths = res.tempFiles.map(file => file.tempFilePath)
  196. this.uploadFiles()
  197. },
  198. fail: (err) => {
  199. console.log(err)
  200. },
  201. })
  202. },
  203. uploadFiles() {
  204. const uploadTasks = this.tempFilePaths.map((filePath, index) => {
  205. return new Promise((resolve, reject) => {
  206. uni.uploadFile({
  207. url: 'https://lt.echepei.com/api/blade-resource/oss/endpoint/put-file',
  208. filePath: filePath,
  209. name: 'file',
  210. header: {
  211. 'Blade-Auth': 'bearer ' + uni.getStorageSync('accessToken'),
  212. appId: uni.getAccountInfoSync().miniProgram.appId
  213. },
  214. success: (uploadRes) => {
  215. let obj = {
  216. id: this.userData.userId,
  217. avatar: JSON.parse(uploadRes.data).data.link
  218. }
  219. // updateUserAvatar(obj).then(res => {
  220. // uni.showToast({
  221. // title: "上传成功",
  222. // icon: "none",
  223. // mask: true
  224. // });
  225. // this.getUserData()
  226. // })
  227. },
  228. fail: (err) => {
  229. reject(err)
  230. }
  231. })
  232. })
  233. })
  234. },
  235. getUpdate() {
  236. const updateManager = uni.getUpdateManager();
  237. updateManager.onCheckForUpdate(function(res) {
  238. // 请求完新版本信息的回调
  239. if (res.hasUpdate) {
  240. updateManager.onUpdateReady(function() {
  241. uni.showModal({
  242. title: '更新提示',
  243. content: '新版本已经准备好,是否重启应用?',
  244. success: function(res) {
  245. if (res.confirm) {
  246. // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
  247. updateManager.applyUpdate();
  248. }
  249. }
  250. });
  251. });
  252. updateManager.onUpdateFailed(function() {
  253. // 新的版本下载失败
  254. uni.showModal({
  255. title: '已经有新版本了哟~',
  256. content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~'
  257. });
  258. });
  259. }
  260. });
  261. },
  262. // 确认
  263. adminConfirm() {
  264. uni.clearStorageSync();
  265. uni.redirectTo({
  266. url: '/pages/login/login'
  267. })
  268. },
  269. // 取消
  270. adminCancel() {
  271. uni.switchTab({
  272. url: '/pages/me/home'
  273. })
  274. },
  275. clickCall() {
  276. uni.makePhoneCall({
  277. phoneNumber: this.form.contactNumber,
  278. success: function() {
  279. console.log('拨打电话成功');
  280. },
  281. fail() {
  282. console.log('打电话失败了');
  283. }
  284. })
  285. },
  286. setUp() {
  287. this.$u.route('/pages/me/setting/index');
  288. },
  289. allClick(name) {
  290. if (name == '我的订单'){
  291. uni.navigateTo({
  292. url: '/pages/me/myOrder',
  293. });
  294. }
  295. if(name=='待发货'){
  296. uni.navigateTo({
  297. url: '/pages/me/myOrder?xcxStatus=待发货&current=1',
  298. });
  299. }
  300. if(name=='待收货'){
  301. uni.navigateTo({
  302. url: '/pages/me/myOrder?xcxStatus=待收货&current=2',
  303. });
  304. }
  305. if(name=='已收货'){
  306. uni.navigateTo({
  307. url: '/pages/me/myOrder?xcxStatus=已收货&current=3',
  308. });
  309. }
  310. if(name=='退款售后'){
  311. uni.navigateTo({
  312. url: '/pages/me/myOrder?xcxStatus=退款请核,退款中,已取消&current=4',
  313. });
  314. }
  315. if(name=='个人资料'){
  316. uni.navigateTo({
  317. url: '/pages/me/myInfo',
  318. });
  319. }
  320. },
  321. clickMeans() {
  322. uni.showToast({
  323. title: "开发中",
  324. icon: "none",
  325. });
  326. return
  327. uni.$u.route('/pages/views/personalInformation/index');
  328. },
  329. clickContacts() {
  330. uni.showToast({
  331. title: "开发中",
  332. icon: "none",
  333. });
  334. return
  335. uni.$u.route('/pages/views/personalInformation/contacts');
  336. },
  337. clickAddress() {
  338. uni.showToast({
  339. title: "开发中",
  340. icon: "none",
  341. });
  342. return
  343. this.$u.route('/pages/views/personalInformation/addressManagement');
  344. },
  345. // 车型
  346. clickVehicle() {
  347. uni.showToast({
  348. title: "开发中",
  349. icon: "none",
  350. });
  351. return
  352. this.$u.route('/pages/me/vehicleModel');
  353. },
  354. // 积分商城
  355. clickPointsMall() {
  356. this.$u.route('/pages/me/pointsMall');
  357. },
  358. // 积分兑换记录
  359. RedemptionOfPoints() {
  360. uni.showToast({
  361. title: "开发中",
  362. icon: "none",
  363. });
  364. return
  365. this.$u.route('/pages/me/integralList/index');
  366. },
  367. // 积分获取记录
  368. obtainRecord() {
  369. uni.showToast({
  370. title: "开发中",
  371. icon: "none",
  372. });
  373. return
  374. this.$u.route('/pages/me/integralList/obtainRecord');
  375. },
  376. // 消费记录
  377. consumptionRecord() {
  378. uni.showToast({
  379. title: "开发中",
  380. icon: "none",
  381. });
  382. return
  383. this.$u.route('/pages/me/integralList/consumptionRecord');
  384. },
  385. pageJump(value) {
  386. uni.showToast({
  387. title: "开发中",
  388. icon: "none",
  389. });
  390. return
  391. uni.$u.route('/pages/views/salesSlip/index', {
  392. text: value
  393. });
  394. },
  395. obligationBtn(value) {
  396. uni.showToast({
  397. title: "开发中",
  398. icon: "none",
  399. });
  400. return
  401. uni.$u.route('/pages/views/salesSlip/obligation', {
  402. text: value
  403. });
  404. },
  405. inIntegralMall() {
  406. uni.showToast({
  407. title: "开发中",
  408. icon: "none",
  409. });
  410. return
  411. uni.$u.route('/pages/integralMall/index');
  412. }
  413. }
  414. }
  415. </script>
  416. <style lang="scss" scoped>
  417. .action-sheet {
  418. background: #fff;
  419. border-radius: 24rpx 24rpx 0 0;
  420. padding: 30rpx;
  421. }
  422. .action-item {
  423. padding: 28rpx 0;
  424. display: flex;
  425. align-items: center;
  426. justify-content: center;
  427. border-bottom: 1rpx solid #f5f5f5;
  428. text {
  429. margin-left: 20rpx;
  430. font-size: 30rpx;
  431. }
  432. }
  433. .cancel-btn {
  434. padding: 28rpx 0;
  435. text-align: center;
  436. color: #ff2442;
  437. font-size: 30rpx;
  438. margin-top: 20rpx;
  439. }
  440. .card {
  441. position: relative;
  442. margin: 0 32rpx;
  443. background-color: #fff;
  444. border-radius: 14rpx;
  445. bottom: 96rpx;
  446. ::v-deep .u-cell__title-text {
  447. font-size: 26rpx;
  448. color: #333333;
  449. }
  450. ::v-deep .u-cell__value {
  451. font-size: 24rpx;
  452. color: #CBCBCB;
  453. }
  454. ::v-deep .u-icon__icon--info {
  455. font-size: 28rpx !important;
  456. color: #CBCBCB;
  457. }
  458. }
  459. .card2 {
  460. position: relative;
  461. margin: 0 32rpx;
  462. background-color: #fff;
  463. border-radius: 14rpx;
  464. bottom: 96rpx;
  465. ::v-deep .u-cell__title-text {
  466. font-size: 24rpx;
  467. font-weight: 400;
  468. color: #797979;
  469. }
  470. }
  471. </style>