newReport.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <div class="new-report" v-loading="state.loading">
  3. <div v-if="!state.error">
  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. </el-col>
  12. <el-col :xs="24" :sm="16" :md="16" :lg="16" :xl="16">
  13. <p class="title">2.订单未发货情况</p>
  14. <not-deliver-good :date="date" />
  15. </el-col>
  16. </el-row>
  17. <el-row :gutter="20">
  18. <el-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
  19. <p class="title">3.备库单情况</p>
  20. <stock :date="date" />
  21. </el-col>
  22. <el-col :xs="24" :sm="16" :md="16" :lg="16" :xl="16">
  23. <p class="title">4.订单情况</p>
  24. <order :date="date" />
  25. </el-col>
  26. </el-row>
  27. <el-row :gutter="20">
  28. <el-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
  29. <p class="title">5.竞价单空返情况统计:</p>
  30. <empty-return :date="date" />
  31. </el-col>
  32. <el-col :xs="24" :sm="6" :md="6" :lg="6" :xl="6">
  33. <p class="title">6.采购员竞价反馈情况 : 竞价单总量 : {{ zxTotal }}</p>
  34. <purchase-back :date="date" @getZXTotal="getZXTotal" />
  35. </el-col>
  36. <el-col :xs="24" :sm="10" :md="10" :lg="10" :xl="10">
  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.error">
  59. <unusual-state :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 { getParameterByName } 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')){
  110. this.login()
  111. }else{
  112. this.requestUserinfo()
  113. }
  114. const current = dayjs(new Date()).format("YYYY-MM-DD")
  115. this.date = [current + " 00:00:00", current + " 23:59:59"]
  116. },
  117. methods: {
  118. getZXTotal(zxTotal) {
  119. this.zxTotal = zxTotal;
  120. },
  121. async time(e) {
  122. const { startTime, endTime } = e;
  123. this.start = startTime || "";
  124. this.end = endTime || "";
  125. const { start, end } = this;
  126. if ((start !== "" && end === "") || (start === "" && end !== "")) {
  127. this.$message.warning("时间区间不完整!");
  128. this.date = []
  129. return;
  130. }
  131. if(this.start && this.end){
  132. this.date = [this.start + " 00:00:00", this.end + " 23:59:59"]
  133. }else{
  134. this.date = [this.start, this.end]
  135. }
  136. },
  137. async requestUserinfo(){
  138. this.state.loading = true;
  139. const code = getParameterByName('code')
  140. const result = await userRequest.userinfo({ code })
  141. // const result ={
  142. // "code": 0,
  143. // "message": "获取成功",
  144. // "data": {
  145. // "id": "1",
  146. // "openid": "oOpc26KiZFBKIm7SB8knFGvov1qg",
  147. // "mobile": "",
  148. // "gender": "0",
  149. // "nickname": "雪寒",
  150. // "avatar": "",
  151. // "subscribe_time": "2022-12-21 15:52:14",
  152. // "addr": "\/\/",
  153. // "status": "1",
  154. // "is_show": ["1", "2", "4"],
  155. // "companyArr": [{
  156. // "companyNo": "GS2302231125079621",
  157. // "companyName": "北京百辰荣达国际科贸有限公司",
  158. // "info": [1,2]
  159. // }, {
  160. // "companyNo": "GS2302231323386950",
  161. // "companyName": "北京泓源广诚国际商贸有限公司",
  162. // "info": [1,2]
  163. // }, {
  164. // "companyNo": "GS2304031312553746",
  165. // "companyName": "北京锦兴弘昌科技有限公司",
  166. // "info": [1, 2]
  167. // }, {
  168. // "companyNo": "GS2302231124114965",
  169. // "companyName": "北京普润心堂商贸有限公司",
  170. // "info": [1, 2]
  171. // }, {
  172. // "companyNo": "GS2203161855277894",
  173. // "companyName": "北京万宇恒通国际科贸有限公司",
  174. // "info": [1, 2]
  175. // }],
  176. // "addtime": "2023-04-10 18:11:07",
  177. // "updatetime": "2023-05-09 16:22:33"
  178. // }
  179. // }
  180. this.state.loading = false
  181. switch(Number(result.code)){
  182. case 0:
  183. this.isShow = (result.data.is_show || []).includes(4) || (result.data.is_show || []).includes('4')
  184. if(!this.isShow){
  185. return
  186. }
  187. break
  188. default:
  189. this.state.error = true
  190. this.state.message = result.message
  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>