index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. <template>
  2. <view class="mine-page">
  3. <view class="store-card">
  4. <view class="cover">
  5. <image class="avatr" widthFix :src="store.iconUrl" />
  6. </view>
  7. <view class="cont">
  8. <view class="name" @click="handStoreInfo"><view class="text">{{ store.storeName }}</view><u-icon class="more" name="arrow-right" size="18" color="#666"></u-icon></view>
  9. <view class="desc" @click="goToQrcodes">
  10. <text class="desc-text">{{ user.desc }}</text>
  11. <image class="qrcode" src="../../static/imgs/mine/qrcode.png" />
  12. </view>
  13. </view>
  14. <view class="business-status" @click="businessToggleVisible = true">
  15. <text class="status">{{ businessStatus }}</text>
  16. <u-icon name="arrow-down" size="14" color="#1A78F6"></u-icon>
  17. </view>
  18. </view>
  19. <view class="curr-day-manage-info">
  20. <view class="title">今日经营信息</view>
  21. <view class="manage-card">
  22. <view class="item">
  23. <view class="count">¥{{(info.todayOrderFeeCount)}}</view>
  24. <view class="label">预计收入</view>
  25. <view class="compare" v-if="info.todayOrderFeeCount >= info.yesterdayOrderFeeCount">比昨日同时段 + {{Math.round((info.todayOrderFeeCount-info.yesterdayOrderFeeCount) * 100)/100}}</view>
  26. <view class="compare" v-else>比昨日同时段 - {{Math.round((info.yesterdayOrderFeeCount-info.todayOrderFeeCount) * 100)/100}}</view>
  27. </view>
  28. <view class="divider"></view>
  29. <view class="item">
  30. <view class="count">{{info.todayOrderNum}}单</view>
  31. <view class="label">有效订单</view>
  32. <view class="compare" v-if="info.todayOrderNum >= info.yesterdayOrderNum">比昨日同时段 + {{info.todayOrderNum-info.yesterdayOrderNum}}单</view>
  33. <view class="compare" v-else>比昨日同时段 - {{info.yesterdayOrderNum-info.todayOrderNum}}单</view>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="tools">
  38. <view class="item" v-for="(item, idx) in tools" :key="item.name" @click="handItem(item, idx)">
  39. <image :src="item.icon" class="cover" />
  40. <view class="name">{{ item.name }}</view>
  41. </view>
  42. </view>
  43. <u-modal :show="businessToggleVisible" title="店铺状态" closeOnClickOverlay @close="businessToggleVisible = false" :showConfirmButton="false">
  44. <view class="container">
  45. <view class="business-date" v-if="store.businessStartStr == null || store.businessStartStr == ''">营业时间: 00:00 - 23:59</view>
  46. <view class="business-date" v-if="store.businessStartStr">营业时间: {{store.businessStartStr}} - {{store.businessEndStr}}</view>
  47. <view class="basiness-list">
  48. <view class="item" v-for="item in businessList" :key="item.name" @click="handItemChange(item)">
  49. <view class="radio">
  50. <u-icon v-if="item.select" name="checkmark-circle-fill" size="28" color="#10B311"></u-icon>
  51. </view>
  52. <view class="cont">
  53. <view class="name">{{ item.name }}</view>
  54. <view class="desc">{{ item.desc }}</view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </u-modal>
  60. <view class="fixed-bottom"></view>
  61. </view>
  62. </template>
  63. <script>
  64. import {mapState} from 'vuex';
  65. export default {
  66. data () {
  67. return {
  68. storeUrl: '/storeManageApi/getStoreInfo',
  69. infoUrl: '/storeManageApi/getBusinessInfo',
  70. updateBusinessStatusUrl: '/storeManageApi/updateBusinessStatus',
  71. businessToggleVisible: false,
  72. user: {
  73. id: '',
  74. picture: require('../../static/tab-my.png'),
  75. name: '',
  76. desc: '店铺推广码'
  77. },
  78. store: {},
  79. info: {
  80. todayOrderFeeCount: 0,
  81. todayOrderNum: 0,
  82. yesterdayOrderFeeCount: 0,
  83. yesterdayOrderNum: 0
  84. },
  85. businessStatus: '营业中',
  86. tools: [
  87. // {
  88. // icon: require('../../static/imgs/mine/1.png'),
  89. // name: '结算管理',
  90. // path: '../tools/settle'
  91. // },
  92. {
  93. icon: require('../../static/imgs/mine/1.png'),
  94. name: '结算管理',
  95. path: '../tools/settle-order'
  96. },
  97. {
  98. icon: require('../../static/imgs/mine/2.png'),
  99. name: '评价管理',
  100. path: '../evaluate/index'
  101. },
  102. {
  103. icon: require('../../static/imgs/mine/3.png'),
  104. name: '店员管理',
  105. path: '../store/clerk'
  106. },
  107. {
  108. icon: require('../../static/imgs/mine/4.png'),
  109. name: '小票打印机',
  110. path: '../tools/print'
  111. },
  112. {
  113. icon: require('../../static/imgs/mine/5.png'),
  114. name: '配送管理',
  115. path: '../store/distribution'
  116. },
  117. {
  118. icon: require('../../static/imgs/mine/6.png'),
  119. name: '商品管理',
  120. path: '../goods/goods'
  121. },
  122. // {
  123. // icon: require('../../static/imgs/mine/7.png'),
  124. // name: '模板市场'
  125. // },
  126. {
  127. icon: require('../../static/imgs/mine/8.png'),
  128. name: '营销中心',
  129. path: '../activity/marketing'
  130. },
  131. {
  132. icon: require('../../static/imgs/mine/9.png'),
  133. name: '设置',
  134. path: '../tools/setting'
  135. },
  136. {
  137. icon: require('../../static/imgs/mine/10.png'),
  138. name: '核销',
  139. path: '../tools/hexiao_coupon'
  140. },
  141. {
  142. icon: require('../../static/imgs/mine/1.png'),
  143. name: '巡检结果',
  144. path: '../inspect/list'
  145. },
  146. {
  147. icon: require('../../static/imgs/mine/2.png'),
  148. name: '整改',
  149. path: '../rectification/list'
  150. }
  151. ],
  152. businessList: [
  153. {
  154. name: '正常营业',
  155. desc: '按营业时间自动开关店',
  156. select: false,
  157. value: 1
  158. },
  159. {
  160. name: '紧急闭店',
  161. desc: '店铺紧急关闭,按开始营业时间自动恢复',
  162. select: false,
  163. value: 0
  164. },
  165. {
  166. name: '暂停营业',
  167. desc: '店铺关闭直到手动恢复营业',
  168. select: false,
  169. value: 2
  170. }
  171. ]
  172. }
  173. },
  174. computed: {
  175. ...mapState(['storeInfo'])
  176. },
  177. methods: {
  178. loadData () {
  179. uni.showLoading({
  180. title: '加载中'
  181. });
  182. // 获取店铺信息
  183. var dateStr = (new Date()).getTime();
  184. var sign = this.getSign('' + this.storeInfo.storeUserId + dateStr);
  185. this.requst({
  186. url: this.storeUrl,
  187. data: {
  188. storeUserId: this.storeInfo.storeUserId,
  189. sign: sign,
  190. timestamp: dateStr,
  191. storeId: this.storeInfo.storeId
  192. },
  193. success: res => {
  194. if (res.data.rtnBean.rtnCode == 0) {
  195. this.store = res.data.obj;
  196. this.businessStatus = this.store.businessStatusName
  197. this.businessList.forEach(i => {
  198. if (i.value == this.store.businessStatus){
  199. i.select = true
  200. }
  201. })
  202. }
  203. uni.hideLoading();
  204. },
  205. fail: (e) => {
  206. console.log("接口调用失败:" + JSON.stringify(e));
  207. uni.hideLoading();
  208. }
  209. })
  210. },
  211. getInfo () {
  212. uni.showLoading({
  213. title: '加载中'
  214. });
  215. // 今日经营信息
  216. var dateStr = (new Date()).getTime();
  217. var sign = this.getSign('' + this.storeInfo.storeUserId + dateStr);
  218. this.requst({
  219. url: this.infoUrl,
  220. data: {
  221. storeUserId: this.storeInfo.storeUserId,
  222. sign: sign,
  223. timestamp: dateStr,
  224. storeId: this.storeInfo.storeId
  225. },
  226. success: res => {
  227. if (res.data.rtnBean.rtnCode == 0) {
  228. this.info = res.data.obj;
  229. }
  230. uni.hideLoading();
  231. },
  232. fail: (e) => {
  233. console.log("接口调用失败:" + JSON.stringify(e));
  234. uni.hideLoading();
  235. }
  236. })
  237. },
  238. handStoreInfo () {
  239. uni.navigateTo({
  240. url: `/pages/store/index?data=` + encodeURIComponent(JSON.stringify(this.store))
  241. });
  242. },
  243. handItem (item, idx) {
  244. // const path = [
  245. // 'settle',
  246. // 'evaluation',
  247. // 'clerk',
  248. // 'print',
  249. // 'distribution',
  250. // 'goods',
  251. // 'temp',
  252. // 'marketing',
  253. // 'setting',
  254. // ]
  255. // if (path[idx] == 'temp') {
  256. // uni.navigateTo({
  257. // url: '/pages/store/extensionCode?id=' + this.user.id
  258. // })
  259. // return
  260. // }
  261. uni.navigateTo({
  262. url: item.path
  263. });
  264. },
  265. handItemChange (item) {
  266. if (item.select) {
  267. return;
  268. }
  269. uni.showLoading({
  270. title: '加载中'
  271. });
  272. this.businessList.forEach(i => i.select = false)
  273. item.select = true
  274. this.businessStatus = item.name
  275. this.businessToggleVisible = false
  276. // 修改店铺营业状态
  277. var dateStr = (new Date()).getTime();
  278. var sign = this.getSign('' + this.storeInfo.storeId + dateStr);
  279. this.requst({
  280. url: this.updateBusinessStatusUrl,
  281. data: {
  282. sign: sign,
  283. timestamp: dateStr,
  284. storeId: this.storeInfo.storeId,
  285. businessStatus: item.value
  286. },
  287. success: res => {
  288. if (res.data.rtnBean.rtnCode == 0) {
  289. uni.showToast({
  290. icon: 'none',
  291. title: '修改成功',
  292. });
  293. }
  294. uni.hideLoading();
  295. },
  296. fail: (e) => {
  297. console.log("接口调用失败:" + JSON.stringify(e));
  298. uni.hideLoading();
  299. }
  300. })
  301. },
  302. goToQrcodes () {
  303. uni.navigateTo({
  304. url: '/pages/store/extensionCode'
  305. });
  306. }
  307. },
  308. onHide() {
  309. this.businessList.forEach(i => i.select = false);
  310. },
  311. onLoad () {
  312. // this.loadData();
  313. },
  314. onShow() {
  315. this.loadData();
  316. this.getInfo();
  317. }
  318. }
  319. </script>
  320. <style lang="scss" scoped>
  321. .mine-page {
  322. position: relative;
  323. padding-bottom: 30rpx;
  324. box-sizing: border-box;
  325. }
  326. .store-card {
  327. width: 100vw;
  328. @include between;
  329. padding: 20rpx 20rpx 40rpx;
  330. box-sizing: border-box;
  331. border-bottom: 10rpx solid #f5f5f5;
  332. .cover {
  333. min-width: 120rpx;
  334. width: 120rpx;
  335. height: 120rpx;
  336. margin-right: 10rpx;
  337. // background-color: #D8E9FF;
  338. border: 2rpx solid #ececec;
  339. .avatr {
  340. width: 120rpx;
  341. height: 120rpx;
  342. }
  343. }
  344. .business-status {
  345. min-width: 160rpx;
  346. width: 160rpx;
  347. height: 60rpx;
  348. border-radius: 10rpx;
  349. margin-left: 20rpx;
  350. color: $theme-color;
  351. background-color: #D8E9FF;
  352. @include flexCenter;
  353. font-size: $font-sm;
  354. border: 2rpx solid $theme-color;
  355. padding: 0 10rpx;
  356. box-sizing: border-box;
  357. }
  358. .status {
  359. margin-right: 10rpx;
  360. flex: 1;
  361. text-align: center;
  362. }
  363. .cont {
  364. width: calc(100vw - 40rpx - 130rpx - 180rpx);
  365. height: 120rpx;
  366. padding-top: 20rpx;
  367. box-sizing: border-box;
  368. .name {
  369. font-size: 36rpx;
  370. @include flexStart;
  371. }
  372. .text {
  373. width: calc(100% - 50rpx);
  374. overflow: hidden;
  375. text-overflow: ellipsis;
  376. white-space: nowrap;
  377. word-break: break-all;
  378. }
  379. .more {
  380. min-width: 40rpx;
  381. margin-left: 10rpx;
  382. }
  383. .desc {
  384. font-size: $font-base;
  385. color: $icon-color;
  386. margin-top: 10rpx;
  387. @include flexStart;
  388. .qrcode {
  389. width: 32rpx;
  390. height: 32rpx;
  391. margin-left: 40rpx;
  392. }
  393. }
  394. }
  395. }
  396. .curr-day-manage-info {
  397. padding: 20rpx;
  398. box-sizing: border-box;
  399. .title {
  400. font-size: $font-lg;
  401. color: $text-color;
  402. margin-bottom: 20rpx;
  403. }
  404. .manage-card {
  405. background-color: $theme-color;
  406. border-radius: 20rpx;
  407. height: 208rpx;
  408. @include flexCenter;
  409. padding: 30rpx 40rpx;
  410. .divider {
  411. width: 4rpx;
  412. height: 128rpx;
  413. background-color: #fff;
  414. margin: 0 30rpx;
  415. }
  416. .item {
  417. flex: 1;
  418. height: 100%;
  419. color: #fff;
  420. text-align: center;
  421. }
  422. .count {
  423. font-size: 40rpx;
  424. font-weight: bold;
  425. }
  426. .label {
  427. font-size: $font-sm;
  428. margin: 14rpx 0 10rpx;
  429. }
  430. .compare {
  431. font-size: $font-base;
  432. }
  433. }
  434. }
  435. .tools {
  436. display: flex;
  437. flex-wrap: wrap;
  438. align-items: flex-start;
  439. justify-content: flex-start;
  440. margin-top: 20rpx;
  441. background-color: #fff;
  442. .item {
  443. width: 250rpx;
  444. height: 200rpx;
  445. display: flex;
  446. flex-direction: column;
  447. align-items: center;
  448. justify-content: center;
  449. border-top: 2rpx solid #ececec;
  450. .cover {
  451. width: 72rpx;
  452. height: 72rpx;
  453. margin-bottom: 10rpx;
  454. }
  455. .name {
  456. font-size: $font-lg;
  457. color: $text-color;
  458. }
  459. }
  460. .item:nth-child(2), .item:nth-child(5), .item:nth-child(8) {
  461. border-left: 2rpx solid #ececec;
  462. border-right: 2rpx solid #ececec;
  463. }
  464. .item:nth-child(7), .item:nth-child(8), .item:nth-child(9) {
  465. border-bottom: 2rpx solid #ececec;
  466. }
  467. .item:nth-child(3n) {
  468. margin-right: 0;
  469. }
  470. }
  471. .container {
  472. .business-date {
  473. text-align: center;
  474. margin-bottom: 20rpx;
  475. }
  476. .item {
  477. @include flexCenter;
  478. background-color: #FBF6F6;
  479. margin-bottom: 20rpx;
  480. padding: 20rpx 40rpx;
  481. box-sizing: border-box;
  482. }
  483. .radio {
  484. min-width: 60rpx;
  485. width: 60rpx;
  486. margin-right: 20rpx;
  487. }
  488. .cont {
  489. width: calc(100% - 80rpx);
  490. }
  491. .name {
  492. font-size: 36rpx;
  493. font-weight: bold;
  494. margin-bottom: 10rpx;
  495. }
  496. .desc {
  497. font-size: $font-lg;
  498. color: #111;
  499. }
  500. }
  501. .bottom-content {
  502. position: fixed;
  503. bottom: 0;
  504. left: 0;
  505. width: 100%;
  506. height: 300upx;
  507. color: #fff;
  508. display: flex;
  509. justify-content: space-around;
  510. align-items: center;
  511. z-index: 2;
  512. }
  513. </style>