index.vue 11 KB

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