store.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  1. <template>
  2. <view class="pagebox">
  3. <!-- #ifdef MP || APP-PLUS -->
  4. <NavBar titleText="工作台" :iconColor="iconColor" :textColor="iconColor" :isScrolling="isScrolling" showBack></NavBar>
  5. <!-- #endif -->
  6. <view class="headerBg">
  7. <view :style="{ height: `${getHeight.barTop}px` }"></view>
  8. <view :style="{ height: `${getHeight.barHeight}px` }"></view>
  9. <view class="inner"></view>
  10. </view>
  11. <view class="page-content">
  12. <view class="header acea-row row-middle">
  13. <image :src="staffInfo.avatar" class="avatar"></image>
  14. <view class="text-box">
  15. <view class="acea-row row-middle">
  16. <view class="name line1">{{ staffInfo.staff_name }}</view>
  17. <view class="manager" v-if="parseInt(staffInfo.is_manager)" @click="marTap">
  18. {{merId}}<text class="iconfont icon-ic_downarrow"></text>
  19. <view v-if="marShow">
  20. <view class="arrow-down"></view>
  21. <view class="marList">
  22. <view class="item" :class="index==current?'on':''" v-for="(item, index) in merList" :key="index" @click="merSwitch(index,item)">{{item.name}}</view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="manager" v-else>店员</view>
  27. </view>
  28. <view class="phone">{{ staffInfo.phone }}</view>
  29. </view>
  30. <!-- #ifdef MP-WEIXIN || APP-PLUS -->
  31. <view @click="scanCode">
  32. <text class="iconfont icon-ic_Scan"></text>
  33. </view>
  34. <!-- #endif -->
  35. <!-- #ifdef H5 -->
  36. <view v-if="isWeixin" @click="scanCode">
  37. <text class="iconfont icon-ic_Scan"></text>
  38. </view>
  39. <!-- #endif -->
  40. </view>
  41. <view class="today">
  42. <view class="title-box">
  43. <navigator class="link" :url='`/pages/admin/order/store?isManager=${isManager}`' hover-class="none">
  44. 今日销售额(元)<text class="iconfont icon-ic_rightarrow"></text>
  45. </navigator>
  46. <view class="money">{{ todayPrice }}</view>
  47. </view>
  48. <view class="list acea-row">
  49. <view class="item" v-for="(item,indexs) in statistics" :key="indexs">
  50. <view class="num">{{ item.value }}</view>
  51. <view class="">{{item.title}}</view>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="goods acea-row">
  56. <navigator url="/pages/admin/orderList/index?types=1" hover-class="none" class="item">
  57. <view class="img-box">
  58. <view class="img">
  59. <view v-if="unshipped_count" class="num">{{ unshipped_count > 99 ? '99+' : unshipped_count }}</view>
  60. <image :src="imgHost+'/statics/images/admin-work-order1.png'" mode=""></image>
  61. </view>
  62. </view>
  63. <view class="">待发货</view>
  64. </navigator>
  65. <navigator url="/pages/admin/refundOrderList/index" hover-class="none" class="item">
  66. <view class="img-box">
  67. <view class="img">
  68. <view v-if="refunding_count" class="num">{{ refunding_count > 99 ? '99+' : refunding_count }}</view>
  69. <image :src="imgHost+'/statics/images/admin-work-order2.png'" mode=""></image>
  70. </view>
  71. </view>
  72. <view class="">待售后</view>
  73. </navigator>
  74. <navigator url="/pages/admin/goods/index?type=4" hover-class="none" class="item">
  75. <view class="img-box">
  76. <view class="img">
  77. <view v-if="outofstock" class="num">{{ outofstock > 99 ? '99+' : outofstock }}</view>
  78. <image :src="imgHost+'/statics/images/admin-work-order3.png'" mode=""></image>
  79. </view>
  80. </view>
  81. <view class="">待补货</view>
  82. </navigator>
  83. <navigator url="/pages/admin/goods/index?type=5" hover-class="none" class="item">
  84. <view class="img-box">
  85. <view class="img">
  86. <view v-if="policeforce" class="num">{{ policeforce > 99 ? '99+' : policeforce }}</view>
  87. <image :src="imgHost+'/statics/images/admin-work-order4.png'" mode=""></image>
  88. </view>
  89. </view>
  90. <view class="">库存预警</view>
  91. </navigator>
  92. </view>
  93. <view class="manage">
  94. <view class="title-box">店铺管理</view>
  95. <view class="list acea-row">
  96. <navigator class="item" url="/pages/admin/goods/index" hover-class="none">
  97. <view class="icon">
  98. <image :src="imgHost+'/statics/images/admin-work-menu1.png'" mode=""></image>
  99. </view>
  100. <view class="">商品管理</view>
  101. </navigator>
  102. <navigator class="item" url="/pages/admin/orderList/index" hover-class="none">
  103. <view class="icon">
  104. <image :src="imgHost+'/statics/images/admin-work-menu2.png'" mode=""></image>
  105. </view>
  106. <view class="">订单管理</view>
  107. </navigator>
  108. <!-- #ifdef MP-WEIXIN || APP-PLUS -->
  109. <navigator class="item" url="/pages/admin/order_cancellation/index?auth=4" hover-class="none">
  110. <view class="icon">
  111. <image :src="imgHost+'/statics/images/admin-work-menu3.png'" mode=""></image>
  112. </view>
  113. <view class="">订单核销</view>
  114. </navigator>
  115. <!-- #endif -->
  116. <!-- #ifdef H5 -->
  117. <navigator v-if="isWeixin" class="item" url="/pages/admin/order_cancellation/index?auth=4" hover-class="none">
  118. <view class="icon">
  119. <image :src="imgHost+'/statics/images/admin-work-menu3.png'" mode=""></image>
  120. </view>
  121. <view class="">订单核销</view>
  122. </navigator>
  123. <!-- #endif -->
  124. <navigator class="item" url="/pages/admin/refundOrderList/index" hover-class="none">
  125. <view class="icon">
  126. <image :src="imgHost+'/statics/images/admin-work-menu4.png'" mode=""></image>
  127. </view>
  128. <view class="">售后维权</view>
  129. </navigator>
  130. <navigator class="item" url="/pages/admin/user/list" hover-class="none">
  131. <view class="icon">
  132. <image :src="imgHost+'/statics/images/admin-work-menu5.png'" mode=""></image>
  133. </view>
  134. <view class="">用户管理</view>
  135. </navigator>
  136. <!-- <navigator class="item" url="/pages/behalf/user_list/index" hover-class="none">
  137. <view class="icon">
  138. <image :src="imgHost+'/statics/images/admin-work-menu6.png'" mode=""></image>
  139. </view>
  140. <view class="">代客下单</view>
  141. </navigator> -->
  142. </view>
  143. </view>
  144. </view>
  145. <footerPage :isWork='0'></footerPage>
  146. </view>
  147. </template>
  148. <script>
  149. // #ifdef MP || APP-PLUS
  150. import NavBar from '@/components/NavBar.vue';
  151. // #endif
  152. import footerPage from '../components/footerPage/index.vue';
  153. import {
  154. HTTP_REQUEST_URL
  155. } from '@/config/app';
  156. import {
  157. userInfo,
  158. staffStaging,
  159. orderVerific,
  160. deliveryInfo,
  161. } from '@/api/admin.js';
  162. export default {
  163. components: {
  164. // #ifdef MP || APP-PLUS
  165. NavBar,
  166. // #endif
  167. footerPage,
  168. },
  169. computed:{
  170. isManager(){
  171. let manager = parseInt(this.staffInfo.is_manager) && !this.current;
  172. return manager?1:0
  173. }
  174. },
  175. data() {
  176. return {
  177. imgHost: HTTP_REQUEST_URL,
  178. merList:[
  179. {name:'店长'},
  180. {name:'店员'}
  181. ],
  182. current:0,
  183. marShow:0,
  184. merId:'店长',
  185. staffInfo:{},
  186. statistics:[],
  187. outofstock:0,
  188. policeforce:0,
  189. unshipped_count:0,
  190. refunding_count:0,
  191. // #ifdef MP || APP-PLUS
  192. iconColor: '#FFFFFF',
  193. isScrolling: false,
  194. // #endif
  195. todayPrice: 0, // 今日销售额
  196. getHeight: this.$util.getWXStatusHeight(),
  197. verify_code: '',
  198. isWeixin: '',
  199. }
  200. },
  201. onLoad() {
  202. this.getInfo();
  203. this.$store.commit('SET_STORE', 0);
  204. // #ifdef H5
  205. this.isWeixin = this.$wechat.isWeixin()
  206. // #endif
  207. },
  208. methods: {
  209. // 扫码核
  210. scanCode() {
  211. var self = this;
  212. // #ifdef MP || APP
  213. uni.scanCode({
  214. success(res) {
  215. self.verify_code = res.result || '';
  216. if (res.path) {
  217. let path = decodeURIComponent(res.path);
  218. self.verify_code = path.split('code=')[1];
  219. }
  220. self.codeChange();
  221. },
  222. })
  223. // #endif
  224. //#ifdef H5
  225. this.$wechat.wechatEvevt('scanQRCode', {
  226. needResult: 1,
  227. scanType: ["qrCode", "barCode"]
  228. }).then(res => {
  229. let result = res.resultStr;
  230. if (result.includes(',')) {
  231. result = result.split(",")[1]
  232. }
  233. this.verify_code = result
  234. this.codeChange();
  235. });
  236. //#endif
  237. },
  238. // 立即核销
  239. codeChange() {
  240. let self = this
  241. self.$util.Tips({
  242. title: '查询中'
  243. });
  244. setTimeout(() => {
  245. orderVerific(this.verify_code, 4)
  246. .then(res => {
  247. let auth = res.data.auth;
  248. if (res.data.is_order_code) {
  249. if (res.data.product_type) {
  250. uni.navigateTo({
  251. url: '/pages/admin/writeOffCard/index?id=' + res.data.data[0].id + '&storeNum=0'
  252. })
  253. } else {
  254. if (res.data.data[0].status == 2) {
  255. uni.navigateTo({
  256. url: '/pages/admin/offOrderResult/index?id=' + res.data.data[0].order_id+'&storeNum=0'
  257. })
  258. } else {
  259. uni.navigateTo({
  260. url: '/pages/admin/distribution/scanning/detail/index?auth=' + auth + '&id=' + res.data.data[0].id + '&let=' + res.data.data.length +
  261. '&code=' + this.verify_code+'&storeNum=0'
  262. })
  263. }
  264. }
  265. } else {
  266. if (!res.data.product_type) {
  267. if (res.data.data.length) {
  268. // 跳转多订单核销页
  269. uni.navigateTo({
  270. url: '/pages/admin/distribution/scanning/index?auth=' + auth + '&code=' + this.verify_code
  271. })
  272. } else {
  273. // 跳转结果页
  274. uni.navigateTo({
  275. url: '/pages/admin/offOrderResult/index&storeNum='+this.storeNum
  276. })
  277. }
  278. }
  279. }
  280. })
  281. .catch(res => {
  282. self.verify_code = ''
  283. return self.$util.Tips({
  284. title: res
  285. });
  286. });
  287. }, 800);
  288. },
  289. marTap(){
  290. this.marShow = !this.marShow;
  291. },
  292. merSwitch(index,item){
  293. this.current = index;
  294. this.merId = item.name;
  295. this.getStaffStaging(!index?1:0)
  296. },
  297. // 获取店员信息
  298. getInfo(){
  299. userInfo().then(res=>{
  300. this.staffInfo = res.data
  301. this.getStaffStaging(res.data.is_manager);
  302. })
  303. },
  304. getStaffStaging(manager){
  305. staffStaging({
  306. is_manager:manager
  307. }).then(res=>{
  308. this.statistics = res.data.statistics;
  309. this.todayPrice = res.data.todayPrice;
  310. const {
  311. outofstock,
  312. policeforce,
  313. unshipped_count,
  314. refunding_count,
  315. } = res.data.staging;
  316. this.outofstock = Number(outofstock);
  317. this.policeforce = Number(policeforce);
  318. this.unshipped_count = Number(unshipped_count);
  319. this.refunding_count = Number(refunding_count);
  320. })
  321. }
  322. }
  323. }
  324. </script>
  325. <style lang="scss" scoped>
  326. .pagebox {
  327. position: relative;
  328. overflow: hidden;
  329. }
  330. .headerBg {
  331. position: absolute;
  332. top: 0;
  333. left: -25%;
  334. width: 150%;
  335. border-bottom-right-radius: 100%;
  336. border-bottom-left-radius: 100%;
  337. background: linear-gradient(270deg, #01ABF8 0%, #2A7EFB 100%);
  338. .inner {
  339. height: 356rpx;
  340. }
  341. }
  342. .page-content {
  343. position: relative;
  344. padding: 0 20rpx;
  345. .header {
  346. padding: 22rpx 20rpx 32rpx 12rpx;
  347. .avatar {
  348. width: 80rpx;
  349. height: 80rpx;
  350. border-radius: 50%;
  351. }
  352. .text-box {
  353. flex: 1;
  354. padding-left: 16rpx;
  355. color: #FFFFFF;
  356. .manager{
  357. width: 88rpx;
  358. height: 34rpx;
  359. line-height: 34rpx;
  360. background: #FFFFFF;
  361. border-radius: 18rpx;
  362. text-align: center;
  363. font-size: 22rpx;
  364. color: #2A7EFB;
  365. margin-left: 16rpx;
  366. position: relative;
  367. .icon-ic_downarrow{
  368. font-size: 24rpx;
  369. color: #2A7EFB;
  370. }
  371. .arrow-down{
  372. position: absolute;
  373. right: 8rpx;
  374. top:48rpx;
  375. width: 0;
  376. height: 0;
  377. border-left: 10rpx solid transparent;
  378. border-right: 10rpx solid transparent;
  379. border-bottom: 16rpx solid #fff;
  380. }
  381. .marList{
  382. position: absolute;
  383. width: 120rpx;
  384. height: 152rpx;
  385. background-color: #fff;
  386. padding: 8rpx 0;
  387. box-shadow: 0px 0px 16px 0px rgba(0,0,0,0.08);
  388. border-radius: 10rpx;
  389. left:50%;
  390. margin-left: -60rpx;
  391. top:62rpx;
  392. .item{
  393. font-size: 28rpx;
  394. color: #333;
  395. font-weight: 400;
  396. padding: 16rpx 0;
  397. &.on{
  398. color: #2A7EFB;
  399. }
  400. }
  401. }
  402. }
  403. }
  404. .name {
  405. font-weight: 500;
  406. font-size: 32rpx;
  407. line-height: 44rpx;
  408. max-width: 310rpx;
  409. }
  410. .phone {
  411. margin-top: 4rpx;
  412. font-size: 22rpx;
  413. line-height: 30rpx;
  414. color: rgba(255,255,255,0.6);
  415. }
  416. .iconfont {
  417. font-size: 40rpx;
  418. color: #FFFFFF;
  419. }
  420. }
  421. .today {
  422. border-radius: 24rpx;
  423. background: #FFFFFF;
  424. .title-box {
  425. padding: 40rpx 0 52rpx 40rpx;
  426. }
  427. .link {
  428. display: inline-block;
  429. vertical-align: middle;
  430. font-size: 24rpx;
  431. line-height: 34rpx;
  432. color: #999999;
  433. }
  434. .iconfont {
  435. margin-left: 4rpx;
  436. font-size: 24rpx;
  437. }
  438. .money {
  439. margin-top: 16rpx;
  440. font-family: SemiBold;
  441. font-size: 56rpx;
  442. line-height: 56rpx;
  443. color: #FF7E00;
  444. }
  445. .item {
  446. padding-bottom: 40rpx;
  447. text-align: center;
  448. font-size: 24rpx;
  449. line-height: 34rpx;
  450. color: #999999;
  451. width: 30%;
  452. margin-right: 32rpx;
  453. &:nth-of-type(3n){
  454. margin-right: 0;
  455. }
  456. }
  457. .num {
  458. margin-bottom: 12rpx;
  459. font-family: SemiBold;
  460. font-size: 36rpx;
  461. line-height: 36rpx;
  462. color: #333333;
  463. }
  464. }
  465. .goods {
  466. border-radius: 24rpx;
  467. margin-top: 20rpx;
  468. background: #FFFFFF;
  469. .item {
  470. flex: 1;
  471. padding: 30rpx 0 26rpx;
  472. text-align: center;
  473. font-size: 26rpx;
  474. line-height: 36rpx;
  475. color: #333333;
  476. }
  477. .img-box {
  478. position: relative;
  479. width: 76rpx;
  480. height: 76rpx;
  481. border-radius: 50%;
  482. margin: 0 auto 12rpx;
  483. // background: #F9A833;
  484. // text-align: center;
  485. // line-height: 76rpx;
  486. }
  487. .img {
  488. width: 100%;
  489. height: 100%;
  490. // border-radius: 50%;
  491. // background: rgba(255, 255, 255, 0.8);
  492. }
  493. .num {
  494. position: absolute;
  495. top: -6rpx;
  496. left: 58rpx;
  497. z-index: 2;
  498. min-width: 24rpx;
  499. height: 24rpx;
  500. padding: 0 8rpx;
  501. border-radius: 12rpx;
  502. background: #FF7E00;
  503. font-weight: 500;
  504. font-size: 18rpx;
  505. line-height: 24rpx;
  506. color: #FFFFFF;
  507. }
  508. image {
  509. width: 100%;
  510. height: 100%;
  511. // font-size: 38rpx;
  512. // color: #FF7E00;
  513. }
  514. }
  515. .manage {
  516. padding-bottom: 41rpx;
  517. border-radius: 24rpx;
  518. margin-top: 20rpx;
  519. background: #FFFFFF;
  520. .title-box {
  521. padding: 34rpx 0 11rpx 28rpx;
  522. font-weight: 500;
  523. font-size: 30rpx;
  524. line-height: 42rpx;
  525. color: #333333;
  526. }
  527. .item {
  528. flex: 0 0 25%;
  529. padding: 27rpx 0;
  530. text-align: center;
  531. font-size: 26rpx;
  532. line-height: 26rpx;
  533. color: #333333;
  534. .icon {
  535. width: 48rpx;
  536. height: 48rpx;
  537. margin: 0 auto 20rpx;
  538. }
  539. }
  540. image {
  541. width: 48rpx;
  542. height: 48rpx;
  543. }
  544. }
  545. }
  546. </style>