newReport copy.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <template>
  2. <div class="new-report" v-loading="state.loading" style="min-height:300px">
  3. <div v-if="!state.error && isShow">
  4. <div style="display:flex;justify-content:flex-end">
  5. <period-date-picker :start="date[0]" :end="date[1]" size="mini" width="150px" @timeReturned="time($event)" />
  6. </div>
  7. <el-row gutter="20">
  8. <el-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
  9. <p class="title">1.竞价咨询统计</p>
  10. <consult :date="date" />
  11. <p class="title">2.竞价空返统计</p>
  12. <empty-return :date="date" />
  13. </el-col>
  14. <el-col :xs="24" :sm="16" :md="16" :lg="16" :xl="16">
  15. <p class="title">3.无地址销售订单统计</p>
  16. <not-deliver-good :date="date" />
  17. </el-col>
  18. </el-row>
  19. <el-row :gutter="20">
  20. <el-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
  21. <p class="title">4.竞价反馈统计</p>
  22. <purchase-back :date="date" @getZXTotal="getZXTotal" />
  23. </el-col>
  24. <el-col :xs="24" :sm="16" :md="16" :lg="16" :xl="16">
  25. <p class="title">5.销售订单统计</p>
  26. <order :date="date" />
  27. </el-col>
  28. </el-row>
  29. <el-row :gutter="20">
  30. <!-- <el-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
  31. </el-col> -->
  32. <el-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
  33. <p class="title">6.备库单统计</p>
  34. <stock :date="date" />
  35. </el-col>
  36. <el-col :xs="24" :sm="16" :md="16" :lg="16" :xl="16">
  37. <p class="title">7.采购订单统计</p>
  38. <purchase :date="date" />
  39. </el-col>
  40. </el-row>
  41. <el-row :gutter="20">
  42. <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
  43. <p class="title">8.发货工单未发货时效统计</p>
  44. <send-order :date="date" />
  45. </el-col>
  46. <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
  47. <p class="title">9.待采购备货统计</p>
  48. <send-exp :date="date" />
  49. </el-col>
  50. </el-row>
  51. <el-row :gutter="20">
  52. <el-col :xs="24">
  53. <p class="title">10.当日库存销售统计</p>
  54. <the-sales :date="date" />
  55. </el-col>
  56. </el-row>
  57. </div>
  58. <template v-else-if="!state.loading">
  59. <unusual-state :hasPermission="isShow" :message="state.message" path="newReport" />
  60. </template>
  61. </div>
  62. </template>
  63. <script>
  64. import NotDeliverGood from "../components/newReport/src/notDeliverGood.vue";
  65. import PurchaseBack from "../components/newReport/src/PurchaseBack.vue";
  66. import EmptyReturn from "../components/newReport/src/emptyReturn.vue";
  67. import SendOrder from "../components/newReport/src/sendOrder.vue";
  68. import TheSales from "../components/newReport/src/theSales.vue";
  69. import Purchase from "../components/newReport/src/purchase.vue";
  70. import PeriodDatePicker from "../components/period-date-picker";
  71. import Consult from '../components/newReport/src/consult.vue';
  72. import SendExp from "../components/newReport/src/sendExp.vue";
  73. import Order from '../components/newReport/src/order.vue';
  74. import Stock from "../components/newReport/src/Stock.vue";
  75. import dayjs from "dayjs"
  76. import UnusualState from "@/components/unusual/index.vue";
  77. import { getOpenid, getParameterByName, removeOpenid, setOpenid } from "../utils/auth";
  78. import userRequest from "@/api/index";
  79. export default {
  80. name: "newReport",
  81. components: {
  82. PeriodDatePicker,
  83. NotDeliverGood,
  84. UnusualState,
  85. PurchaseBack,
  86. EmptyReturn,
  87. SendOrder,
  88. TheSales,
  89. Purchase,
  90. SendExp,
  91. Consult,
  92. Stock,
  93. Order
  94. },
  95. data() {
  96. return {
  97. date: [],
  98. zxTotal: 0,
  99. isDisplay: false,
  100. state:{
  101. message: '',
  102. error: false,
  103. loading: false
  104. }
  105. };
  106. },
  107. mounted() {
  108. document.title = "数据统计"
  109. if(!getParameterByName('code')){ this.login() }else{
  110. this.requestUserinfo()
  111. }
  112. const current = dayjs(new Date()).format("YYYY-MM-DD")
  113. this.date = [current + " 00:00:00", current + " 23:59:59"]
  114. },
  115. methods: {
  116. getZXTotal(zxTotal) {
  117. this.zxTotal = zxTotal;
  118. },
  119. async time(e) {
  120. const { startTime, endTime } = e;
  121. this.start = startTime || "";
  122. this.end = endTime || "";
  123. const { start, end } = this;
  124. if ((start !== "" && end === "") || (start === "" && end !== "")) {
  125. this.$message.warning("时间区间不完整!");
  126. this.date = []
  127. return;
  128. }
  129. if(this.start && this.end){
  130. this.date = [this.start + " 00:00:00", this.end + " 23:59:59"]
  131. }else{
  132. this.date = [this.start, this.end]
  133. }
  134. },
  135. async requestUserinfo(){
  136. this.state.loading = true;
  137. const openid = getOpenid()
  138. const code = getParameterByName('code')
  139. // const result = await userRequest.userinfo({
  140. // ...( openid ? { openid } : { code })
  141. // })
  142. const result ={
  143. "code": 0,
  144. "message": "获取成功",
  145. "data": {
  146. "id": "1",
  147. "openid": "oOpc26KiZFBKIm7SB8knFGvov1qg",
  148. "mobile": "",
  149. "gender": "0",
  150. "nickname": "雪寒",
  151. "avatar": "",
  152. "subscribe_time": "2022-12-21 15:52:14",
  153. "addr": "\/\/",
  154. "status": "1",
  155. "is_show": ["1", "2", "4"],
  156. "companyArr": [{
  157. "companyNo": "GS2302231125079621",
  158. "companyName": "北京百辰荣达国际科贸有限公司",
  159. "info": [1,2]
  160. }, {
  161. "companyNo": "GS2302231323386950",
  162. "companyName": "北京泓源广诚国际商贸有限公司",
  163. "info": [1,2]
  164. }, {
  165. "companyNo": "GS2304031312553746",
  166. "companyName": "北京锦兴弘昌科技有限公司",
  167. "info": [1, 2]
  168. }, {
  169. "companyNo": "GS2302231124114965",
  170. "companyName": "北京普润心堂商贸有限公司",
  171. "info": [1, 2]
  172. }, {
  173. "companyNo": "GS2203161855277894",
  174. "companyName": "北京万宇恒通国际科贸有限公司",
  175. "info": [1, 2]
  176. }],
  177. "addtime": "2023-04-10 18:11:07",
  178. "updatetime": "2023-05-09 16:22:33"
  179. }
  180. }
  181. this.state.loading = false
  182. switch(Number(result.code)){
  183. case 0:
  184. this.isShow = (result.data.is_show || []).includes(4) || (result.data.is_show || []).includes('4')
  185. setOpenid(result.data.openid)
  186. break
  187. default:
  188. this.state.error = true
  189. this.state.message = result.message
  190. openid && removeOpenid()
  191. break
  192. }
  193. },
  194. login(){
  195. const redirect_url = encodeURIComponent('http://stat.caixiao365.com/accountsReceivable')
  196. var state = 'wx_' + Math.random().toString(36).substr(2, 15)
  197. const scope = 'snsapi_userinfo'
  198. const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${config.appId}&redirect_uri=${redirect_url}&response_type=code&scope=${scope}&state=${state}#wechat_redirect`
  199. window.location.href = url
  200. },
  201. }
  202. }
  203. </script>
  204. <style lang="scss" scoped>
  205. .new-report {
  206. padding: 10px;
  207. box-sizing: border-box;
  208. .title {
  209. padding-left: 5px;
  210. }
  211. }
  212. </style>