index.vue 15 KB

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