change_shifts.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. <template>
  2. <page-meta :root-font-size="getRootFontSize"></page-meta>
  3. <view class="uni-flex uni-row height-all">
  4. <view class="container common-wrap" style="-webkit-flex: 1;flex: 1;" v-if="shiftsData">
  5. <view class="title">{{ userInfo.username }}</view>
  6. <view class="time-title">
  7. 班次:
  8. <text>{{ shiftsData.start_time > 0 ? $util.timeFormat(shiftsData.start_time) : '初始化' }}</text>
  9. <text class="separate">-</text>
  10. <text class="curr-time">{{ shiftsData.end_time | timeFormat }}</text>
  11. </view>
  12. <view class="title-box">
  13. <view class="box">
  14. <view class="name-box">
  15. <text class="title-name">销</text>
  16. <text class="name">总销售</text>
  17. </view>
  18. <view class="money-box">
  19. <text class="money">({{ shiftsData.total_sale | moneyFormat }}元 {{ shiftsData.total_sale_count }}笔)</text>
  20. </view>
  21. </view>
  22. <view class="box">
  23. <view class="name-box">
  24. <text class="title-name">会</text>
  25. <text class="name">会员充值</text>
  26. </view>
  27. <view class="money-box">
  28. <text class="money">({{ shiftsData.recharge_money | moneyFormat }}元 {{ shiftsData.recharge_count }}笔)</text>
  29. </view>
  30. </view>
  31. <view class="box">
  32. <view class="name-box">
  33. <text class="title-name">应</text>
  34. <text class="name">应收金额</text>
  35. </view>
  36. <view class="money-box">
  37. <text class="money">({{ shiftsData.total_money | moneyFormat }}元 {{ shiftsData.total_count }}笔)</text>
  38. </view>
  39. </view>
  40. <view class="box">
  41. <view class="name-box">
  42. <text class="title-name">支</text>
  43. <text class="name">支付统计</text>
  44. </view>
  45. <view class="money-box">
  46. <text class="money">({{ shiftsData.total_pay_money | moneyFormat }}元 {{ shiftsData.total_pay_count }}笔)</text>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="basic">
  51. <text @click="detail()">
  52. 查看详情
  53. <i class="iconqianhou2 iconfont"></i>
  54. </text>
  55. </view>
  56. <view class="common-btn-wrap">
  57. <button type="default" class="default-btn cancel-btn" @click="cancel">取消</button>
  58. <button type="default" class="primary-btn shiftss-btn" @click="changeshifts">交班并登出</button>
  59. </view>
  60. <uni-popup ref="shiftslistPop">
  61. <view class="pop-box shiftsslistPop">
  62. <view class="pop-header">
  63. <view class="pop-header-text">交班详情</view>
  64. <view class="pop-header-close" @click="$refs.shiftslistPop.close()"><text class="iconguanbi1 iconfont"></text></view>
  65. </view>
  66. <view class="pop-content common-scrollbar">
  67. <view class="pop-content-item">
  68. <view class="pop-content-text">总销售({{ shiftsData.total_sale | moneyFormat }}元 {{ shiftsData.total_sale_count }}笔)</view>
  69. <view class="pop-contents-text">开单销售({{ shiftsData.billing_money | moneyFormat }}元 {{ shiftsData.billing_count }}笔)</view>
  70. <view class="pop-contents-text">售卡销售({{ shiftsData.buycard_money | moneyFormat }}元 {{ shiftsData.buycard_count }}笔)</view>
  71. </view>
  72. <view class="pop-content-item">
  73. <view class="pop-content-text">会员充值({{ shiftsData.recharge_money | moneyFormat }}元 {{ shiftsData.recharge_count }}笔)</view>
  74. </view>
  75. <view class="pop-content-item">
  76. <view class="pop-content-text">应收金额({{ shiftsData.total_money | moneyFormat }}元 {{ shiftsData.total_count }}笔)</view>
  77. <view class="pop-contents-text">开单销售({{ shiftsData.billing_money | moneyFormat }}元 {{ shiftsData.billing_count }}笔)</view>
  78. <view class="pop-contents-text">售卡销售({{ shiftsData.buycard_money | moneyFormat }}元 {{ shiftsData.buycard_count }}笔)</view>
  79. <view class="pop-contents-text">会员充值({{ shiftsData.recharge_money | moneyFormat }}元 {{ shiftsData.recharge_count }}笔)</view>
  80. <view class="pop-contents-text">订单退款({{ shiftsData.refund_money | moneyFormat }}元 {{ shiftsData.refund_count }}笔)</view>
  81. </view>
  82. <view class="pop-content-item">
  83. <view class="pop-content-text">支付统计({{ shiftsData.total_pay_money | moneyFormat }}元 {{ shiftsData.total_pay_count }}笔)</view>
  84. <view class="pop-contents-text" v-if="shiftsData.cash > 0">现金收款({{ shiftsData.cash | moneyFormat }}元 {{ shiftsData.cash_count }}笔)</view>
  85. <view class="pop-contents-text" v-if="shiftsData.wechatpay > 0">
  86. 微信收款({{ shiftsData.wechatpay | moneyFormat }}元 {{ shiftsData.wechatpay_count }}笔)
  87. </view>
  88. <view class="pop-contents-text" v-if="shiftsData.alipay > 0">
  89. 支付宝收款({{ shiftsData.alipay | moneyFormat }}元 {{ shiftsData.alipay_count }}笔)
  90. </view>
  91. <view class="pop-contents-text" v-if="shiftsData.own_wechatpay > 0">
  92. 个人微信收款({{ shiftsData.own_wechatpay | moneyFormat }}元 {{ shiftsData.own_wechatpay_count }}笔)
  93. </view>
  94. <view class="pop-contents-text" v-if="shiftsData.own_alipay > 0">
  95. 个人支付宝收款({{ shiftsData.own_alipay | moneyFormat }}元 {{ shiftsData.own_alipay_count }}笔)
  96. </view>
  97. <view class="pop-contents-text" v-if="shiftsData.own_pos > 0">
  98. 个人POS收款({{ shiftsData.own_pos | moneyFormat }}元 {{ shiftsData.own_pos_count }}笔)
  99. </view>
  100. </view>
  101. </view>
  102. <view class="pop-content-footer">
  103. <button class="primary-btn" @click="printTicket">打印小票</button>
  104. </view>
  105. </view>
  106. </uni-popup>
  107. </view>
  108. <nc-loading ref="loading"></nc-loading>
  109. </view>
  110. </template>
  111. <script>
  112. import dataTable from '@/components/uni-data-table/uni-data-table.vue';
  113. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  114. export default {
  115. components: {
  116. dataTable,
  117. uniPopup
  118. },
  119. props: {
  120. option: {}
  121. },
  122. data() {
  123. return {
  124. shiftsData: null,
  125. userInfo: null,
  126. isSub: false
  127. };
  128. },
  129. onShow() {
  130. this.getshiftsInfo();
  131. },
  132. methods: {
  133. detail() {
  134. this.$refs.shiftslistPop.open('center');
  135. },
  136. getshiftsInfo() {
  137. this.$api.sendRequest({
  138. url: '/cashier/storeapi/cashier/shiftsdata',
  139. success: res => {
  140. if (res.code == 0 && res.data) {
  141. let shiftsData = res.data.shifts_data;
  142. shiftsData.total_sale = parseFloat(shiftsData.billing_money) + parseFloat(shiftsData.buycard_money);
  143. shiftsData.total_sale_count = parseInt(shiftsData.billing_count) + parseInt(shiftsData.buycard_count);
  144. shiftsData.total_count = shiftsData.total_sale_count + parseInt(shiftsData.recharge_count) + parseInt(shiftsData.refund_count);
  145. shiftsData.total_money = shiftsData.total_sale + parseFloat(shiftsData.recharge_money) - parseFloat(shiftsData.refund_money);
  146. shiftsData.total_pay_money =
  147. parseFloat(shiftsData.cash) +
  148. parseFloat(shiftsData.alipay) +
  149. parseFloat(shiftsData.wechatpay) +
  150. parseFloat(shiftsData.own_wechatpay) +
  151. parseFloat(shiftsData.own_alipay) +
  152. parseFloat(shiftsData.own_pos);
  153. shiftsData.total_pay_count =
  154. parseInt(shiftsData.cash_count) +
  155. parseInt(shiftsData.alipay_count) +
  156. parseInt(shiftsData.wechatpay_count) +
  157. parseInt(shiftsData.own_wechatpay_count) +
  158. parseInt(shiftsData.own_alipay_count) +
  159. parseInt(shiftsData.own_pos_count);
  160. this.shiftsData = shiftsData;
  161. this.userInfo = res.data.userinfo;
  162. this.$refs.loading.hide();
  163. } else {
  164. this.$util.showToast({
  165. title: res.message
  166. });
  167. }
  168. }
  169. });
  170. },
  171. cancel() {
  172. uni.navigateBack();
  173. },
  174. // 交班
  175. changeshifts() {
  176. if (this.isSub) return;
  177. this.isSub = true;
  178. uni.showLoading({ title: '' });
  179. this.$api.sendRequest({
  180. url: '/cashier/storeapi/cashier/changeshifts',
  181. success: res => {
  182. uni.hideLoading();
  183. if (res.code == 0 && res.data) {
  184. uni.removeStorage({
  185. key: 'cashier_token',
  186. success: () => {
  187. this.$store.commit('setStoreInfo', null);
  188. this.$store.commit('setMemberInfo', null);
  189. this.$util.redirectTo('/pages/login/login', {}, 'reLaunch');
  190. }
  191. });
  192. } else {
  193. this.isSub = false;
  194. this.$util.showToast({
  195. title: res.message
  196. });
  197. }
  198. }
  199. });
  200. },
  201. /**
  202. * 打印小票
  203. */
  204. printTicket(){
  205. this.$api.sendRequest({
  206. url: '/cashier/storeapi/cashier/printticket',
  207. success: res => {
  208. if (res.code != 0) {
  209. this.$util.showToast({title: res.message ? res.message : '小票打印失败'})
  210. }
  211. }
  212. })
  213. }
  214. }
  215. };
  216. </script>
  217. <style lang="scss" scoped>
  218. .height-all {
  219. height: 100vh;
  220. }
  221. .pop-box {
  222. background: #ffffff;
  223. width: 4rem;
  224. height: 60vh;
  225. display: flex;
  226. flex-direction: column;
  227. .pop-header {
  228. width: 100%;
  229. padding: 0 0.15rem 0 0.2rem;
  230. height: 0.5rem;
  231. // width: 3.5rem;
  232. margin: 0 auto;
  233. line-height: 0.5rem;
  234. border-bottom: 0.01rem solid #f0f0f0;
  235. font-size: 0.14rem;
  236. color: #333;
  237. overflow: hidden;
  238. border-radius: 0.02rem 0.2rem 0 0;
  239. box-sizing: border-box;
  240. display: flex;
  241. justify-content: space-between;
  242. .pop-header-text {
  243. font-weight: 900;
  244. color: #567485;
  245. }
  246. .pop-header-close {
  247. cursor: pointer;
  248. i {
  249. font-size: 0.18rem;
  250. }
  251. }
  252. }
  253. .pop-content {
  254. flex: 1;
  255. height: 0;
  256. padding: 0.1rem 0.2rem;
  257. box-sizing: border-box;
  258. color: #567485;
  259. font-weight: 900;
  260. overflow-y: scroll;
  261. }
  262. .pop-contents {
  263. margin-top: 0.3rem;
  264. width: 3rem;
  265. height: 0.8rem;
  266. padding: 0.1rem 0.2rem;
  267. box-sizing: border-box;
  268. color: #567485;
  269. font-weight: 900;
  270. display: flex;
  271. flex-direction: column;
  272. flex-wrap: wrap;
  273. justify-content: space-between;
  274. }
  275. .pop-content-item {
  276. margin-left: 0.3rem;
  277. }
  278. .pop-content-items {
  279. margin-left: 0.3rem;
  280. }
  281. .pop-content-text {
  282. padding: 0.1rem;
  283. }
  284. .pop-contents-text {
  285. margin-left: 0.4rem;
  286. font-weight: normal;
  287. padding: 0.1rem;
  288. }
  289. .pop-contentss-text {
  290. margin-left: 0.8rem;
  291. font-weight: normal;
  292. color: rgb(197, 209, 216);
  293. }
  294. .pop-content-footer {
  295. display: flex;
  296. padding: .15rem;
  297. justify-content: flex-end;
  298. button {
  299. width: 1rem;
  300. margin: 0;
  301. }
  302. }
  303. }
  304. .container {
  305. display: flex;
  306. align-items: center;
  307. flex-direction: column;
  308. padding: 0.2rem;
  309. }
  310. .title {
  311. font-size: 0.16rem;
  312. color: #303133;
  313. margin-top: 0.45rem;
  314. font-weight: 900;
  315. color: rgb(86, 116, 133);
  316. }
  317. .time-title {
  318. padding: 0.1rem;
  319. line-height: 0.2rem;
  320. border-radius: 5px;
  321. background-color: rgb(254, 242, 242);
  322. color: rgb(246, 85, 81);
  323. font-size: 0.14rem;
  324. margin-top: 0.2rem;
  325. text {
  326. margin: 0 0.05rem;
  327. }
  328. .curr-time {
  329. font-weight: bold;
  330. }
  331. }
  332. .title-box {
  333. width: 5rem;
  334. display: flex;
  335. flex-direction: column;
  336. align-content: space-around;
  337. justify-content: flex-start;
  338. align-items: center;
  339. margin-top: 0.3rem;
  340. }
  341. .box {
  342. width: 5.4rem;
  343. height: 0.6rem;
  344. background: #f9fbfb;
  345. border: 1px solid rgb(225, 225, 225);
  346. margin-top: 0.1rem;
  347. display: flex;
  348. flex-direction: row;
  349. justify-content: space-between;
  350. align-content: space-around;
  351. flex-wrap: wrap;
  352. padding: 0 0.23rem 0 0.23rem;
  353. box-sizing: border-box;
  354. }
  355. .title-name {
  356. display: inline-block;
  357. width: 0.3rem;
  358. height: 0.3rem;
  359. border-radius: 15%;
  360. text-align: center;
  361. line-height: 0.3rem;
  362. background: #8558fa;
  363. color: #fff;
  364. font-weight: 900;
  365. font-size: 0.16rem;
  366. }
  367. .name-box {
  368. height: 0.3rem;
  369. }
  370. .money-box {
  371. line-height: 0.3rem;
  372. }
  373. .name {
  374. font-size: 0.16rem;
  375. line-height: 0.3rem;
  376. margin-left: 0.2rem;
  377. font-weight: 900;
  378. color: rgb(86, 116, 133);
  379. }
  380. .money {
  381. margin-left: 0.25rem;
  382. color: rgb(86, 116, 133);
  383. }
  384. .search-desc {
  385. color: #909399;
  386. font-size: 0.14rem;
  387. margin-top: 0.3rem;
  388. }
  389. .basic {
  390. text-align: center;
  391. margin-top: 0.33rem;
  392. text {
  393. height: 0.15rem;
  394. color: $primary-color;
  395. font-size: 0.14rem;
  396. cursor: pointer;
  397. }
  398. }
  399. .iconqianhou2 {
  400. margin-left: 0.05rem;
  401. font-size: 1px;
  402. color: #8558fa;
  403. }
  404. .cancel-btn {
  405. width: 1.7rem;
  406. height: 0.5rem;
  407. line-height: 0.5rem;
  408. }
  409. .shiftss-btn {
  410. width: 1.7rem;
  411. height: 0.5rem;
  412. line-height: 0.5rem;
  413. background-color: #8558fa;
  414. color: #fff !important;
  415. margin-left: 0.21rem;
  416. }
  417. .common-btn-wrap {
  418. margin-top: 1.14rem;
  419. z-index: 2;
  420. height: 0.6rem;
  421. padding-bottom: 0.05rem;
  422. display: flex;
  423. align-items: center;
  424. }
  425. .pop-btn-wrap {
  426. width: 100%;
  427. height: 0.2rem;
  428. border-top: 0.01rem solid #eee;
  429. margin-top: 0.4rem;
  430. }
  431. .cancels-btn {
  432. width: 95%;
  433. margin-top: 0.1rem;
  434. font-size: 0.14rem;
  435. transition: 0.1s;
  436. border-radius: 0.02rem;
  437. border-width: 0.01rem !important;
  438. background: #8558fa !important;
  439. color: #fff !important;
  440. }
  441. </style>