accountsReceivable.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <div class="SalesReportRejectedNew">
  3. <div v-if="!state.error && isShow">
  4. <div class="table-header" style="line-height:36px">万宇应收账款报表看板</div>
  5. <el-table
  6. :max-height="maxHeight"
  7. v-loading="loading"
  8. :data="tableData"
  9. style="width: 100%"
  10. :size="'mini'"
  11. row-key="id"
  12. border
  13. stripe
  14. >
  15. <el-table-column label="业务公司" fixed="left" width="80" prop="depart">
  16. <template slot-scope="scope">{{scope.row.depart.split('@')[1] || '总计'}}</template>
  17. </el-table-column>
  18. <el-table-column label="应收账款" prop="wpay_fee" align="center" >
  19. <template slot-scope="scope">
  20. {{ unit2TenThousand(scope.row.wpay_fee) }}
  21. </template>
  22. </el-table-column>
  23. <el-table-column label="已开票未回票" prop="wpay_ainv_fee" align="center" >
  24. <template slot-scope="scope">
  25. {{ unit2TenThousand(scope.row.wpay_ainv_fee) }}
  26. </template>
  27. </el-table-column>
  28. <el-table-column label="未开票" prop="winv_fee" align="center">
  29. <template slot-scope="scope">
  30. {{ unit2TenThousand(scope.row.winv_fee) }}
  31. </template>
  32. </el-table-column>
  33. <el-table-column label="待开票" prop="inv_fee" align="center">
  34. <template slot-scope="scope">
  35. {{ unit2TenThousand(scope.row.inv_fee) }}
  36. </template>
  37. </el-table-column>
  38. <el-table-column label="已发货未开票" prop="winv_asend_fee" align="center">
  39. <template slot-scope="scope">
  40. {{ unit2TenThousand(scope.row.winv_asend_fee) }}
  41. </template>
  42. </el-table-column>
  43. <el-table-column label="未发货" prop="wpay_send_fee" align="center">
  44. <template slot-scope="scope">
  45. {{ unit2TenThousand(scope.row.wpay_send_fee) }}
  46. </template>
  47. </el-table-column>
  48. <el-table-column label="超60天已发货未开票" prop="winv_two_month" align="center">
  49. <template slot-scope="scope">
  50. {{ unit2TenThousand(scope.row.winv_two_month) }}
  51. </template>
  52. </el-table-column>
  53. <el-table-column label="超180天应收账款" prop="wpay_six_month" align="center">
  54. <template slot-scope="scope">
  55. {{ unit2TenThousand(scope.row.wpay_six_month) }}
  56. </template>
  57. </el-table-column>
  58. </el-table>
  59. </div>
  60. <template v-else-if="!state.loading">
  61. <unusual-state :hasPermission="isShow" :message="state.message" path="accountsReceivable" />
  62. </template>
  63. </div>
  64. </template>
  65. <script>
  66. import asyncRequest from "@/api/report";
  67. import userRequest from "@/api/index"
  68. import setHeight from "@/mixins/index";
  69. import { getParameterByName } from "../utils/auth";
  70. import UnusualState from "@/components/unusual/index.vue"
  71. import {
  72. mapResponseCompletionCompanyName,
  73. unit2TenThousand,
  74. getCompanyLabel,
  75. addition
  76. } from "@/components/reports/src/_utils";
  77. export default {
  78. name: "WanyuTypeReport",
  79. props: ["date"],
  80. mixins: [setHeight],
  81. components:{UnusualState},
  82. watch: {
  83. date: function(val) {
  84. this.dataTime = val;
  85. if (val) {
  86. this.searchList();
  87. }
  88. }
  89. },
  90. data() {
  91. return {
  92. isShow:false,
  93. total:{
  94. day:0,
  95. month:0,
  96. total_tips: 0
  97. },
  98. state:{
  99. error:false,
  100. loading:false,
  101. message:'',
  102. },
  103. mapResponseCompletionCompanyName,
  104. dataTime: this.date,
  105. loading: false,
  106. maxHeight: "0",
  107. tableData: []
  108. };
  109. },
  110. async created() {
  111. document.title = "应收账款"
  112. window.onresize = () => {
  113. this.getHeight();
  114. };
  115. },
  116. mounted() {
  117. if(!getParameterByName('code')){
  118. this.login()
  119. }else{
  120. this.requestUserinfo()
  121. }
  122. },
  123. methods: {
  124. async requestUserinfo(){
  125. this.state.loading = true;
  126. const code = getParameterByName('code')
  127. const result = await userRequest.userinfo({ code })
  128. // const result ={
  129. // "code": 0,
  130. // "message": "获取成功",
  131. // "data": {
  132. // "id": "1",
  133. // "openid": "oOpc26KiZFBKIm7SB8knFGvov1qg",
  134. // "mobile": "",
  135. // "gender": "0",
  136. // "nickname": "雪寒",
  137. // "avatar": "",
  138. // "subscribe_time": "2022-12-21 15:52:14",
  139. // "addr": "\/\/",
  140. // "status": "1",
  141. // "is_show": ["1", "2", "3"],
  142. // "companyArr": [{
  143. // "companyNo": "GS2302231125079621",
  144. // "companyName": "北京百辰荣达国际科贸有限公司",
  145. // "info": [1,2]
  146. // }, {
  147. // "companyNo": "GS2302231323386950",
  148. // "companyName": "北京泓源广诚国际商贸有限公司",
  149. // "info": [1,2]
  150. // }, {
  151. // "companyNo": "GS2304031312553746",
  152. // "companyName": "北京锦兴弘昌科技有限公司",
  153. // "info": [1, 2]
  154. // }, {
  155. // "companyNo": "GS2302231124114965",
  156. // "companyName": "北京普润心堂商贸有限公司",
  157. // "info": [1, 2]
  158. // }, {
  159. // "companyNo": "GS2203161855277894",
  160. // "companyName": "北京万宇恒通国际科贸有限公司",
  161. // "info": [1, 2]
  162. // }],
  163. // "addtime": "2023-04-10 18:11:07",
  164. // "updatetime": "2023-05-09 16:22:33"
  165. // }
  166. // }
  167. this.state.loading = false
  168. switch(Number(result.code)){
  169. case 0:
  170. this.isShow = (result.data.is_show || []).includes(3) || (result.data.is_show || []).includes('3')
  171. // this.isShow = (result.data.is_show || []).includes(0) || (result.data.is_show || []).includes('0') ? false : this.isShow
  172. if(!this.isShow){
  173. return
  174. }
  175. this.$nextTick(() => this.getHeight());
  176. this.searchList();
  177. break
  178. default:
  179. this.state.error = true
  180. this.state.message = result.message
  181. break
  182. }
  183. },
  184. getCompanyLabel,
  185. unit2TenThousand,
  186. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  187. if (columnIndex === 0) {
  188. if (rowIndex % 2 === 0) {
  189. return {
  190. rowspan: 2,
  191. colspan: 1
  192. };
  193. } else {
  194. return {
  195. rowspan: 0,
  196. colspan: 0
  197. };
  198. }
  199. }
  200. },
  201. login(){
  202. const redirect_url = encodeURIComponent('http://stat.caixiao365.com/accountsReceivable')
  203. var state = 'wx_' + Math.random().toString(36).substr(2, 15)
  204. const scope = 'snsapi_userinfo'
  205. 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`
  206. window.location.href = url
  207. },
  208. async searchList() {
  209. this.loading = true;
  210. this.tableData = [];
  211. const res = await asyncRequest.list({
  212. daytime: this.date
  213. });
  214. if (res.code === 0 && res.data && res.data.length > 0) {
  215. const tableData = res.data
  216. const totalItem = res.data.reduce((prev, current) => Object.keys(current).reduce((prev, currentKey) => ({
  217. ...prev,
  218. [currentKey]: currentKey !== 'depart' ? addition(current[currentKey] || 0, prev[currentKey] || 0) : '总计'
  219. }), prev), {})
  220. this.tableData = [...tableData,totalItem]
  221. } else {
  222. this.tableData = [];
  223. }
  224. this.getHeight();
  225. this.loading = false;
  226. }
  227. }
  228. }
  229. </script>
  230. <style lang="scss" scoped>
  231. .SalesReportRejectedNew {
  232. padding: 10px;
  233. }
  234. .table-header {
  235. font-size: 18px;
  236. font-weight: 700;
  237. line-height: 30px;
  238. border-bottom: none;
  239. }
  240. .table-sub__header {
  241. span{
  242. font-weight: bold !important;
  243. }
  244. }
  245. </style>