center.vue 13 KB

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