index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  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="bluetoothPrinting">
  60. <view style="display: flex;align-items: center;">
  61. <view class="card_edit_icon center_in">
  62. <u-icon name="setting" size="22" 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. <u-modal :show="logoutShow" showCancelButton :title="title" :content='content' @cancel="cancel"
  70. @confirm="confirm"></u-modal>
  71. </view>
  72. </view>
  73. </template>
  74. <script>
  75. export default {
  76. props: {
  77. token: {
  78. type: String,
  79. default: () => '',
  80. },
  81. userInfo: {
  82. type: Object,
  83. default: () => {},
  84. },
  85. },
  86. data() {
  87. return {
  88. tableList: [],
  89. list: [{
  90. title: '全部',
  91. icon: 'icon-dingdan',
  92. colorBg: '#4bc7fc',
  93. bgColor: 'linear-gradient(to right, #84d4f6, #4bc7fc)',
  94. }, {
  95. title: '未入库',
  96. icon: 'icon-chukudan',
  97. colorBg: '#fe880e',
  98. bgColor: 'linear-gradient(to right, #f69f45, #fe880e)',
  99. }, {
  100. title: '已入库',
  101. icon: 'icon-fankudengji',
  102. colorBg: '#fece56',
  103. bgColor: 'linear-gradient(to right, #f3d485, #fece56)',
  104. }, {
  105. title: '已出库',
  106. icon: 'icon-yidaoda',
  107. colorBg: '#9ddd54',
  108. bgColor: 'linear-gradient(to right, #b9f377, #9ddd54)',
  109. }],
  110. list1: [{
  111. title: '全部',
  112. icon: 'icon-dingdan',
  113. colorBg: '#4bc7fc',
  114. bgColor: 'linear-gradient(to right, #84d4f6, #4bc7fc)',
  115. }, {
  116. title: '未装车',
  117. icon: 'icon-xiehuofei',
  118. colorBg: '#fe880e',
  119. bgColor: 'linear-gradient(to right, #f69f45, #fe880e)',
  120. }, {
  121. title: '已装车',
  122. icon: 'icon-yizhuangche',
  123. colorBg: '#fece56',
  124. bgColor: 'linear-gradient(to right, #f3d485, #fece56)',
  125. },
  126. // {
  127. // title: '已下车',
  128. // icon: 'icon-xiehuo',
  129. // colorBg: '#9ddd54',
  130. // bgColor: 'linear-gradient(to right, #b9f377, #9ddd54)',
  131. // },
  132. {
  133. title: '已签收',
  134. icon: 'icon-qianshou_fill',
  135. colorBg: '#1cc723',
  136. bgColor: 'linear-gradient(to right, #54ef5a, #1cc723)',
  137. }
  138. ],
  139. list2: [{
  140. title: '全部',
  141. icon: 'icon-dingdan',
  142. colorBg: '#4bc7fc',
  143. bgColor: 'linear-gradient(to right, #84d4f6, #4bc7fc)',
  144. }, {
  145. title: '未发货',
  146. icon: 'icon-weifahuo',
  147. colorBg: '#fe880e',
  148. bgColor: 'linear-gradient(to right, #f69f45, #fe880e)',
  149. }, {
  150. title: '已发货',
  151. icon: 'icon-yifahuo',
  152. colorBg: '#9ddd54',
  153. bgColor: 'linear-gradient(to right, #b9f377, #9ddd54)',
  154. }, {
  155. title: '已签收',
  156. icon: 'icon-yidaoda',
  157. colorBg: '#1cc723',
  158. bgColor: 'linear-gradient(to right, #54ef5a, #1cc723)',
  159. }],
  160. logoutShow: false,
  161. title: '确定退出?',
  162. content: '退出登录后将无法查看运单,重新登录后即可查看'
  163. }
  164. },
  165. created() {
  166. if (this.userInfo.userType == 'sys') {
  167. if (this.userInfo.type == 2) {
  168. // 仓管
  169. this.tableList = this.list
  170. } else if (this.userInfo.type == 3) {
  171. // 司机
  172. this.tableList = this.list1
  173. }
  174. } else {
  175. this.tableList = this.list2
  176. }
  177. },
  178. methods: {
  179. // 修改密码
  180. changePassword() {
  181. if (this.token) {
  182. uni.navigateTo({
  183. url: '/pages/mine/password'
  184. });
  185. } else {
  186. uni.$u.toast('请先登录')
  187. }
  188. },
  189. // 登录注册
  190. login() {
  191. uni.navigateTo({
  192. url: '/pages/login'
  193. });
  194. },
  195. // 订单页面
  196. goOrder(index) {
  197. if (this.token) {
  198. uni.navigateTo({
  199. url: '/pages/order/index?current=' + index
  200. });
  201. } else {
  202. uni.$u.toast('请先登录')
  203. }
  204. },
  205. // 退出登录
  206. logOut() {
  207. if (this.token) {
  208. this.logoutShow = true
  209. } else {
  210. uni.$u.toast('请先登录')
  211. }
  212. },
  213. // 蓝牙打印
  214. bluetoothPrinting() {
  215. uni.navigateTo({
  216. url: '/pages/mine/bluetooth'
  217. });
  218. },
  219. // 确定退出登录
  220. confirm() {
  221. this.$cache.removeToken()
  222. this.$cache.removeCache('userInfo')
  223. uni.redirectTo({
  224. url: '/pages/login'
  225. })
  226. },
  227. // 取消
  228. cancel() {
  229. this.logoutShow = false
  230. },
  231. }
  232. }
  233. </script>
  234. <style lang="scss">
  235. .card_user_title {
  236. display: flex;
  237. flex-direction: column;
  238. align-items: flex-start;
  239. }
  240. .card_mine {
  241. margin-top: 30rpx;
  242. padding: 0rpx 30rpx;
  243. background-color: #fff;
  244. border-radius: 20rpx;
  245. }
  246. .mine_image {
  247. width: 100rpx;
  248. height: 100rpx;
  249. border-radius: 50%;
  250. }
  251. .mine_phone {
  252. margin-left: 20rpx;
  253. font-size: 30rpx;
  254. }
  255. .mine_title {
  256. margin-left: 20rpx;
  257. font-size: 40rpx;
  258. font-weight: bold;
  259. }
  260. .card_avatar {
  261. display: flex;
  262. align-items: center;
  263. padding-top: 30rpx;
  264. padding-bottom: 30rpx;
  265. }
  266. .order_card {
  267. margin-top: 20rpx;
  268. background-color: #fff;
  269. padding: 20rpx;
  270. border-radius: 20rpx;
  271. }
  272. .order_head {
  273. position: relative;
  274. display: flex;
  275. align-items: center;
  276. justify-content: space-between;
  277. padding-bottom: 20rpx;
  278. }
  279. .order_head:before {
  280. content: " ";
  281. position: absolute;
  282. left: 0;
  283. bottom: 0;
  284. width: 100%;
  285. height: 1px;
  286. border-top: 1px solid #e7e6e4;
  287. -webkit-transform-origin: 0 0;
  288. transform-origin: 0 0;
  289. -webkit-transform: scaleY(0.5);
  290. transform: scaleY(0.5);
  291. }
  292. .head_left {
  293. margin-right: 10rpx;
  294. }
  295. .head_right {
  296. display: flex;
  297. align-items: center;
  298. }
  299. .card_order {
  300. margin-top: 30rpx;
  301. display: flex;
  302. justify-content: space-around;
  303. }
  304. .item_order {
  305. display: flex;
  306. flex-direction: column;
  307. align-items: center;
  308. }
  309. .card_tab_image {
  310. width: 80rpx;
  311. height: 80rpx;
  312. border-radius: 50%;
  313. }
  314. .order_title {
  315. margin-top: 6rpx;
  316. font-size: 25rpx;
  317. }
  318. .icon_image {
  319. color: #fff;
  320. font-size: 37rpx;
  321. }
  322. .card_system {
  323. margin-top: 20rpx;
  324. background-color: #fff;
  325. padding: 30rpx 20rpx;
  326. border-radius: 20rpx;
  327. }
  328. .card_mine_option {
  329. position: relative;
  330. margin: 20rpx 0rpx;
  331. padding-bottom: 30rpx;
  332. }
  333. .option_title {
  334. margin-left: 10rpx;
  335. font-size: 28rpx;
  336. font-weight: 500;
  337. }
  338. .card_edit_icon {
  339. width: 55rpx;
  340. height: 55rpx;
  341. border-radius: 50%;
  342. background-color: #ff9900;
  343. }
  344. .card_icon_set {
  345. width: 55rpx;
  346. height: 55rpx;
  347. border-radius: 50%;
  348. background-color: #fa3534;
  349. span {
  350. color: #fff;
  351. font-size: 40rpx;
  352. }
  353. }
  354. </style>