index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  1. <template>
  2. <!-- 我的 -->
  3. <view class="safeDistance" :style="{paddingTop:height + 'px'}">
  4. <view style="padding: 10rpx 20rpx 20rpx 20rpx;">
  5. <view class="card_mine">
  6. <view class="card_avatar" v-if="token != ''">
  7. <image class="mine_image" src="../../static/portrait.png" mode=""></image>
  8. <view class="card_user_title">
  9. <view class="mine_phone">{{userInfo.username}}</view>
  10. <view class="mine_phone">{{userInfo.nickName}}</view>
  11. </view>
  12. </view>
  13. <view class="card_avatar" v-else @click="login">
  14. <image class="mine_image" src="../../static/portrait.png" mode=""></image>
  15. <view class="mine_title">登录/注册</view>
  16. </view>
  17. </view>
  18. <view class="order_card" :style="{padding:(tableList.length > 5 ? '20rpx 20rpx 0rpx 20rpx' : '20rpx')}">
  19. <view class="order_head">
  20. <view class="head_left">我的运单</view>
  21. <!-- <view class="head_right">
  22. <view class="head_left">全部</view>
  23. <u-icon name="arrow-right"></u-icon>
  24. </view> -->
  25. </view>
  26. <view class="card_order">
  27. <u-scroll-list :indicator="tableList.length > 5 ? true : false" style="width: 100%;">
  28. <view :class="tableList.length > 5 ? 'card_majority' : 'card_minority'">
  29. <view class="item_order" v-for="(item,index) in tableList" :key="index"
  30. @click="goOrder(index)">
  31. <view class="card_tab_image center_in"
  32. :style="{background: item.bgColor,backgroundColor:item.colorBg}">
  33. <span class="iconfont icon_image" :class="item.icon"></span>
  34. </view>
  35. <view class="order_title">{{item.title}}</view>
  36. </view>
  37. </view>
  38. </u-scroll-list>
  39. </view>
  40. </view>
  41. <view class="card_system">
  42. <view class="space_between" @click="changePassword">
  43. <view style="display: flex;align-items: center;">
  44. <view class="card_edit_icon center_in">
  45. <u-icon name="setting" size="22" color="#ffffff"></u-icon>
  46. </view>
  47. <view class="option_title">修改密码</view>
  48. </view>
  49. <u-icon name="arrow-right" size="20"></u-icon>
  50. </view>
  51. </view>
  52. <view class="card_system">
  53. <view class="space_between" @click="logOut">
  54. <view style="display: flex;align-items: center;">
  55. <view class="card_icon_set center_in">
  56. <span class="iconfont icon-tuichudenglu"></span>
  57. </view>
  58. <view class="option_title">退出登录</view>
  59. </view>
  60. <u-icon name="arrow-right" size="20"></u-icon>
  61. </view>
  62. </view>
  63. <!-- <view class="card_system">
  64. <view class="space_between" @click="handleCheckVersion">
  65. <view style="display: flex;align-items: center;">
  66. <view class="card_icon_set center_in violet">
  67. <u-icon name="info" size="20" color="#ffffff"></u-icon>
  68. </view>
  69. <view class="option_title">版本更新</view>
  70. </view>
  71. <u-icon name="arrow-right" size="20"></u-icon>
  72. </view>
  73. </view> -->
  74. <!-- <view class="card_system">
  75. <view class="space_between" @click="bluetoothPrinting">
  76. <view style="display: flex;align-items: center;">
  77. <view class="card_edit_icon center_in">
  78. <u-icon name="setting" size="22" color="#ffffff"></u-icon>
  79. </view>
  80. <view class="option_title">蓝牙打印</view>
  81. </view>
  82. <u-icon name="arrow-right" size="20"></u-icon>
  83. </view>
  84. </view> -->
  85. <u-modal :show="logoutShow" showCancelButton :title="title" :content='content' @cancel="cancel"
  86. @confirm="confirm"></u-modal>
  87. </view>
  88. </view>
  89. </template>
  90. <script>
  91. const ENV = require('../../.env.js')
  92. export default {
  93. props: {
  94. height: {
  95. type: [String,Number],
  96. default: () => '',
  97. },
  98. token: {
  99. type: String,
  100. default: () => '',
  101. },
  102. userInfo: {
  103. type: Object,
  104. default: () => {},
  105. },
  106. },
  107. data() {
  108. return {
  109. tableList: [],
  110. list: [{
  111. title: '全部',
  112. icon: 'icon-dingdan',
  113. colorBg: '#4bc7fc',
  114. bgColor: 'linear-gradient(to right, #84d4f6, #4bc7fc)',
  115. }, {
  116. title: '待装箱',
  117. icon: 'icon-bepacked',
  118. colorBg: '#db8e3e',
  119. bgColor: 'linear-gradient(to right, #f6d445, #fecb0e)',
  120. }, {
  121. title: '已装箱',
  122. icon: 'icon-boxed',
  123. colorBg: '#9ddd54',
  124. bgColor: 'linear-gradient(to right, #b9f377, #9ddd54)',
  125. }, {
  126. title: '已出箱',
  127. icon: 'icon-boxed',
  128. colorBg: '#9ddd54',
  129. bgColor: 'linear-gradient(to right, #b9f377, #9ddd54)',
  130. }, {
  131. title: '未入库',
  132. icon: 'icon-chukudan',
  133. colorBg: '#fe880e',
  134. bgColor: 'linear-gradient(to right, #f69f45, #fe880e)',
  135. }, {
  136. title: '已入库',
  137. icon: 'icon-fankudengji',
  138. colorBg: '#fece56',
  139. bgColor: 'linear-gradient(to right, #f3d485, #fece56)',
  140. }, {
  141. title: '已出库',
  142. icon: 'icon-yidaoda',
  143. colorBg: '#9ddd54',
  144. bgColor: 'linear-gradient(to right, #b9f377, #9ddd54)',
  145. }, {
  146. title: '已签收',
  147. icon: 'icon-qianshou_fill',
  148. colorBg: '#1cc723',
  149. bgColor: 'linear-gradient(to right, #54ef5a, #1cc723)',
  150. }],
  151. list1: [{
  152. title: '全部',
  153. icon: 'icon-dingdan',
  154. colorBg: '#4bc7fc',
  155. bgColor: 'linear-gradient(to right, #84d4f6, #4bc7fc)',
  156. }, {
  157. title: '待装箱',
  158. icon: 'icon-bepacked',
  159. colorBg: '#db8e3e',
  160. bgColor: 'linear-gradient(to right, #f6d445, #fecb0e)',
  161. }, {
  162. title: '已装箱',
  163. icon: 'icon-boxed',
  164. colorBg: '#9ddd54',
  165. bgColor: 'linear-gradient(to right, #b9f377, #9ddd54)',
  166. }, {
  167. title: '已出箱',
  168. icon: 'icon-boxed',
  169. colorBg: '#9ddd54',
  170. bgColor: 'linear-gradient(to right, #b9f377, #9ddd54)',
  171. }, {
  172. title: '未装车',
  173. icon: 'icon-xiehuofei',
  174. colorBg: '#fe880e',
  175. bgColor: 'linear-gradient(to right, #f69f45, #fe880e)',
  176. }, {
  177. title: '已装车',
  178. icon: 'icon-yizhuangche',
  179. colorBg: '#fece56',
  180. bgColor: 'linear-gradient(to right, #f3d485, #fece56)',
  181. }, {
  182. title: '已下车',
  183. icon: 'icon-xiehuo',
  184. colorBg: '#9ddd54',
  185. bgColor: 'linear-gradient(to right, #b9f377, #9ddd54)',
  186. }, {
  187. title: '已签收',
  188. icon: 'icon-qianshou_fill',
  189. colorBg: '#1cc723',
  190. bgColor: 'linear-gradient(to right, #54ef5a, #1cc723)',
  191. }],
  192. list2: [{
  193. title: '全部',
  194. icon: 'icon-dingdan',
  195. colorBg: '#4bc7fc',
  196. bgColor: 'linear-gradient(to right, #84d4f6, #4bc7fc)',
  197. }, {
  198. title: '未发货',
  199. icon: 'icon-weifahuo',
  200. colorBg: '#fe880e',
  201. bgColor: 'linear-gradient(to right, #f69f45, #fe880e)',
  202. }, {
  203. title: '已发货',
  204. icon: 'icon-yifahuo',
  205. colorBg: '#9ddd54',
  206. bgColor: 'linear-gradient(to right, #b9f377, #9ddd54)',
  207. }, {
  208. title: '已签收',
  209. icon: 'icon-yidaoda',
  210. colorBg: '#1cc723',
  211. bgColor: 'linear-gradient(to right, #54ef5a, #1cc723)',
  212. }],
  213. logoutShow: false,
  214. title: '确定退出?',
  215. content: '退出登录后将无法查看运单,重新登录后即可查看',
  216. innerVer: null,
  217. version: null,
  218. isCheckVersion: false
  219. }
  220. },
  221. created() {
  222. if (this.userInfo.userType == 'sys') {
  223. if (this.userInfo.type == 2) {
  224. // 仓管
  225. this.tableList = this.list
  226. } else if (this.userInfo.type == 3) {
  227. // 司机
  228. this.tableList = this.list1
  229. }
  230. } else {
  231. this.tableList = this.list2
  232. }
  233. },
  234. methods: {
  235. // 修改密码
  236. changePassword() {
  237. if (this.token) {
  238. uni.navigateTo({
  239. url: '/pages/mine/password'
  240. });
  241. } else {
  242. uni.$u.toast('请先登录')
  243. }
  244. },
  245. // 登录注册
  246. login() {
  247. uni.navigateTo({
  248. url: '/pages/login'
  249. });
  250. },
  251. // 订单页面
  252. goOrder(index) {
  253. if (this.token) {
  254. uni.navigateTo({
  255. url: '/pages/order/index?current=' + index
  256. });
  257. } else {
  258. uni.$u.toast('请先登录')
  259. }
  260. },
  261. // 退出登录
  262. logOut() {
  263. if (this.token) {
  264. this.logoutShow = true
  265. } else {
  266. uni.$u.toast('请先登录')
  267. }
  268. },
  269. // 版本更新
  270. versionUpdating() {
  271. // https: //coldlogistics.coldbaozhida.com/smartAppversion.json
  272. },
  273. handleCheckVersion() {
  274. let _this = this;
  275. // #ifdef APP-PLUS
  276. _this.isCheckVersion = true;
  277. plus.screen.lockOrientation('portrait-primary') // 竖屏锁定
  278. plus.runtime.getProperty(plus.runtime.appid, (widgetInfo) => {
  279. _this.innerVer = widgetInfo.version;
  280. _this.version = widgetInfo.versionCode;
  281. uni.request({
  282. url: ENV.APP_LINK_URL + '/smartAppversion.json?_t=' + new Date()
  283. .getTime(), //版本检测
  284. method: 'GET',
  285. header: {},
  286. success: (result) => {
  287. console.log(result.data.code, 14)
  288. if (result.data.code === 0) {
  289. setTimeout(() => {
  290. _this.isCheckVersion = false;
  291. }, 100);
  292. if (result.data.version - _this.version > 0) { // 如果最新版本大于现在已经安装的App的版本
  293. uni.showModal({
  294. title: "更新提示",
  295. content: "发现新版本,请确认下载更新?",
  296. success: (res) => {
  297. if (res.confirm) {
  298. uni.showLoading({
  299. title: '下载更新包中...'
  300. });
  301. uni.downloadFile({
  302. url: result.data.url,
  303. success: (downloadResult) => {
  304. uni.hideLoading();
  305. if (downloadResult
  306. .statusCode === 200
  307. ) {
  308. plus.runtime
  309. .install(
  310. downloadResult
  311. .tempFilePath, {
  312. force: true
  313. },
  314. function() {
  315. console
  316. .log(
  317. 'App安装成功!'
  318. );
  319. uni.showModal({
  320. title: 'App安装成功!',
  321. showCancel: false
  322. })
  323. plus.runtime
  324. .restart();
  325. },
  326. function(
  327. e) {
  328. console
  329. .log(
  330. 'App安装失败!'
  331. );
  332. })
  333. }
  334. }
  335. });
  336. }
  337. }
  338. })
  339. } else {
  340. uni.showModal({
  341. title: '当前已是最新版本',
  342. showCancel: false
  343. })
  344. }
  345. }
  346. }
  347. })
  348. })
  349. // #endif
  350. },
  351. // 蓝牙打印
  352. bluetoothPrinting() {
  353. uni.navigateTo({
  354. url: '/pages/mine/bluetooth'
  355. });
  356. },
  357. // 确定退出登录
  358. confirm() {
  359. this.$cache.removeToken()
  360. this.$cache.removeCache('userInfo')
  361. uni.redirectTo({
  362. url: '/pages/login'
  363. })
  364. },
  365. // 取消
  366. cancel() {
  367. this.logoutShow = false
  368. },
  369. }
  370. }
  371. </script>
  372. <style lang="scss">
  373. .card_user_title {
  374. display: flex;
  375. flex-direction: column;
  376. align-items: flex-start;
  377. }
  378. .card_mine {
  379. margin-top: 10rpx;
  380. padding: 0rpx 30rpx;
  381. background-color: #fff;
  382. border-radius: 20rpx;
  383. }
  384. .mine_image {
  385. width: 100rpx;
  386. height: 100rpx;
  387. border-radius: 50%;
  388. }
  389. .mine_phone {
  390. margin-left: 20rpx;
  391. font-size: 30rpx;
  392. }
  393. .mine_title {
  394. margin-left: 20rpx;
  395. font-size: 40rpx;
  396. font-weight: bold;
  397. }
  398. .card_avatar {
  399. display: flex;
  400. align-items: center;
  401. padding-top: 30rpx;
  402. padding-bottom: 30rpx;
  403. }
  404. .order_card {
  405. margin-top: 20rpx;
  406. background-color: #fff;
  407. padding: 20rpx;
  408. border-radius: 20rpx;
  409. }
  410. .order_head {
  411. position: relative;
  412. display: flex;
  413. align-items: center;
  414. justify-content: space-between;
  415. padding-bottom: 20rpx;
  416. }
  417. .order_head:before {
  418. content: " ";
  419. position: absolute;
  420. left: 0;
  421. bottom: 0;
  422. width: 100%;
  423. height: 1px;
  424. border-top: 1px solid #e7e6e4;
  425. -webkit-transform-origin: 0 0;
  426. transform-origin: 0 0;
  427. -webkit-transform: scaleY(0.5);
  428. transform: scaleY(0.5);
  429. }
  430. .head_left {
  431. margin-right: 10rpx;
  432. }
  433. .head_right {
  434. display: flex;
  435. align-items: center;
  436. }
  437. .card_order {
  438. margin-top: 30rpx;
  439. display: flex;
  440. justify-content: space-around;
  441. }
  442. .item_order {
  443. width: 20%;
  444. flex: none;
  445. display: flex;
  446. flex-direction: column;
  447. align-items: center;
  448. }
  449. .card_minority {
  450. width: 100%;
  451. display: flex;
  452. justify-content: space-around;
  453. }
  454. .card_majority {
  455. width: 100%;
  456. display: flex;
  457. }
  458. .card_tab_image {
  459. width: 80rpx;
  460. height: 80rpx;
  461. border-radius: 50%;
  462. }
  463. .order_title {
  464. margin-top: 6rpx;
  465. font-size: 25rpx;
  466. }
  467. .icon_image {
  468. color: #fff;
  469. font-size: 37rpx;
  470. }
  471. .card_system {
  472. margin-top: 20rpx;
  473. background-color: #fff;
  474. padding: 30rpx 20rpx;
  475. border-radius: 20rpx;
  476. }
  477. .card_mine_option {
  478. position: relative;
  479. margin: 20rpx 0rpx;
  480. padding-bottom: 30rpx;
  481. }
  482. .option_title {
  483. margin-left: 10rpx;
  484. font-size: 28rpx;
  485. font-weight: 500;
  486. }
  487. .card_edit_icon {
  488. width: 55rpx;
  489. height: 55rpx;
  490. border-radius: 50%;
  491. background-color: #ff9900;
  492. }
  493. .card_icon_set {
  494. width: 55rpx;
  495. height: 55rpx;
  496. border-radius: 50%;
  497. background-color: #fa3534;
  498. span {
  499. color: #fff;
  500. font-size: 40rpx;
  501. }
  502. }
  503. .violet {
  504. background-color: #fe654a !important;
  505. }
  506. </style>