user1.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. <template>
  2. <view class="container">
  3. <view class="info-box">
  4. <image src="@/static/login/logo.png" mode="aspectFit"></image>
  5. <view class="info-right">
  6. <view class="ir-first">{{filterPhone(userInfo.phonenumber)}}</view>
  7. <view class="ir-second">{{userInfo.nickName}}</view>
  8. </view>
  9. </view>
  10. <view class="cell-title">商家信息</view>
  11. <view class="cells">
  12. <view class="cell">
  13. <view class="cell-l">营业时间</view>
  14. <view class="cell-r">{{businessStartTime}}~{{businessStopTime}}</view>
  15. <!-- <uni-icons class="right-icon" type="right" color="#999" size="20" /> -->
  16. </view>
  17. </view>
  18. <view class="cells">
  19. <view class="cell">
  20. <view class="cell-l">今日收益</view>
  21. <view class="cell-r">
  22. {{earnings}}
  23. </view>
  24. </view>
  25. </view>
  26. <view class="cells">
  27. <view class="cell" style="justify-content: space-between;">
  28. <view class="cell-l">仓库名称</view>
  29. <view class="cell-r" style="flex:60% 0 0">
  30. <uni-data-select v-model="value" :localdata="storageList" :disable="loading"></uni-data-select>
  31. </view>
  32. </view>
  33. </view>
  34. <!-- Changed Order Verification to a proper button -->
  35. <view class="verification-btn-container">
  36. <button class="verification-btn" @click="navToVerification">
  37. <text>订单核销</text>
  38. </button>
  39. </view>
  40. <tab-bar :active="1"></tab-bar>
  41. <view class="logout-container">
  42. <button class="logout-btn" @click="onLogout">
  43. <text>退出登录</text>
  44. </button>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. import TabBar from '../../components/tab-bar';
  50. import {
  51. mapState,
  52. mapMutations
  53. } from 'vuex';
  54. export default {
  55. components: {
  56. TabBar
  57. },
  58. computed: {
  59. ...mapState(['token'])
  60. },
  61. data() {
  62. return {
  63. userInfo: {},
  64. storageList: [],
  65. value: '',
  66. businessStartTime: "",
  67. businessStopTime: "",
  68. earnings: 0,
  69. loading: false
  70. };
  71. },
  72. onLoad() {
  73. this.userInfo = uni.getStorageSync("usemall_userInfo").user;
  74. this.listAllStorage()
  75. },
  76. // onShow() {
  77. // this.userInfo = uni.getStorageSync("usemall_userInfo").user;
  78. // this.listAllStorage()
  79. // },
  80. watch: {
  81. value(val) {
  82. this.loading = true
  83. this.request('get', 'storage/storage/' + val, this.token).then(({
  84. data
  85. }) => {
  86. this.businessStartTime = data.businessStartTime
  87. this.businessStopTime = data.businessStopTime
  88. this.earnings = data.todayEarnings
  89. }).finally(() => {
  90. this.loading = false
  91. })
  92. }
  93. },
  94. methods: {
  95. ...mapMutations(['saveUserInfo', 'logout']),
  96. navToVerification() {
  97. uni.navigateTo({
  98. url: '/pages/verification/index' // Update this to your actual verification page path
  99. })
  100. },
  101. listAllStorage() {
  102. this.request('get', 'storage/storage/list', this.token, null).then(({
  103. rows
  104. }) => {
  105. this.storageList = rows.map(el => {
  106. return {
  107. text: el.name,
  108. value: el.id,
  109. ...el
  110. }
  111. })
  112. this.value = this.storageList[0].id
  113. })
  114. },
  115. // 过滤隐藏手机号
  116. filterPhone(val) {
  117. return val ? val.toString().slice(0, 3) + '****' + val.toString().slice(-4) : '';
  118. },
  119. navTo(url) {
  120. url = '../income/income';
  121. uni.navigateTo({
  122. url
  123. })
  124. },
  125. onLogout() {
  126. let that = this;
  127. uni.showModal({
  128. title: '系统提示',
  129. content: '是否确认退出?',
  130. showCancel: true,
  131. confirmText: '取消',
  132. cancelText: '确认',
  133. success: function(res) {
  134. if (res.cancel) {
  135. that.logout();
  136. uni.navigateTo({
  137. url: '/pages/login/merchant'
  138. })
  139. }
  140. }
  141. })
  142. }
  143. }
  144. };
  145. </script>
  146. <style lang="scss" scoped>
  147. page {
  148. min-height: 100vh;
  149. background-color: $uni-bg-color-grey;
  150. padding-bottom: 120rpx;
  151. position: relative;
  152. }
  153. .container {
  154. line-height: 1.2;
  155. position: relative;
  156. min-height: 100vh;
  157. }
  158. .picker-cell {
  159. width: 100%
  160. }
  161. .picker-cell-content {
  162. display: flex;
  163. justify-content: space-between;
  164. width: 100%;
  165. align-items: center;
  166. }
  167. .info-box {
  168. display: flex;
  169. align-items: center;
  170. height: 180rpx;
  171. padding: $uni-spacing-row-lg $uni-spacing-row-lg 0 $uni-spacing-row-lg;
  172. background-color: $uni-bg-color;
  173. image {
  174. display: block;
  175. width: 100rpx;
  176. height: 100rpx;
  177. border-radius: 50%;
  178. }
  179. .info-right {
  180. flex: 1;
  181. padding-left: 20rpx;
  182. }
  183. .ir-first {
  184. color: $font-color-black;
  185. font-size: $uni-font-size-lg;
  186. }
  187. .ir-second {
  188. color: $font-color-light;
  189. font-size: $uni-font-size-sm;
  190. margin-top: 10rpx;
  191. }
  192. }
  193. .cell-title {
  194. height: 118rpx;
  195. color: $font-color-black;
  196. font-size: $uni-font-size-base;
  197. font-weight: 600;
  198. line-height: 118rpx;
  199. padding: 0 40rpx;
  200. }
  201. .cells {
  202. padding: 0 $uni-spacing-row-lg;
  203. .cell {
  204. display: flex;
  205. align-items: center;
  206. height: 110rpx;
  207. font-size: $uni-font-size-base;
  208. padding: 0 $uni-spacing-row-lg;
  209. border-bottom: 1rpx solid $uni-border-color;
  210. background-color: $uni-bg-color;
  211. &:first-child {
  212. border-top-left-radius: 14rpx;
  213. border-top-right-radius: 14rpx;
  214. }
  215. &:last-child {
  216. border-bottom-left-radius: 14rpx;
  217. border-bottom-right-radius: 14rpx;
  218. border-bottom: 0;
  219. }
  220. }
  221. .cell-l {
  222. color: $font-color-black;
  223. }
  224. .cell-r {
  225. flex: 1;
  226. color: $font-color-light;
  227. text-align: right;
  228. }
  229. .right-icon {
  230. margin-left: 10rpx;
  231. }
  232. }
  233. .option-bar {
  234. padding: 0 $uni-spacing-row-lg;
  235. .option-btn {
  236. display: flex;
  237. align-items: center;
  238. justify-content: center;
  239. height: 80rpx;
  240. color: $font-color-base;
  241. font-size: $uni-font-size-lg;
  242. border-radius: 45rpx;
  243. border-bottom: 1rpx solid $uni-border-color;
  244. background-color: $uni-bg-color;
  245. margin-top: 50rpx;
  246. }
  247. }
  248. /* Order Verification Button Styles */
  249. .verification-btn-container {
  250. padding: 30rpx $uni-spacing-row-lg;
  251. .verification-btn {
  252. display: flex;
  253. align-items: center;
  254. justify-content: center;
  255. height: 90rpx;
  256. line-height: 90rpx;
  257. font-size: $uni-font-size-lg;
  258. color: #fff;
  259. background-color: $uni-color-primary;
  260. border-radius: 45rpx;
  261. border: none;
  262. .right-icon {
  263. margin-left: 10rpx;
  264. }
  265. }
  266. button::after {
  267. border: none;
  268. }
  269. }
  270. /* Logout Button Styles */
  271. .logout-container {
  272. position: fixed;
  273. bottom: 120rpx;
  274. left: 0;
  275. right: 0;
  276. padding: 0 $uni-spacing-row-lg 20rpx;
  277. z-index: 10;
  278. background-color: $uni-bg-color-grey;
  279. .logout-btn {
  280. display: flex;
  281. align-items: center;
  282. justify-content: center;
  283. height: 90rpx;
  284. line-height: 90rpx;
  285. font-size: $uni-font-size-lg;
  286. color: $uni-text-color;
  287. background-color: $uni-bg-color;
  288. border-radius: 45rpx;
  289. border: none;
  290. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
  291. }
  292. button::after {
  293. border: none;
  294. }
  295. }
  296. </style>