invoice.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. <template>
  2. <div v-loading="loading" style="padding: 20px">
  3. <div class="qs_search" style="margin-bottom: 10px">
  4. <el-tag
  5. v-for="v in status"
  6. :key="v.id"
  7. :type="v.id===search.status?'success':'info'"
  8. @click="getData_(v.id)"
  9. >{{ v.name }}
  10. </el-tag>
  11. <el-button size="small" @click="show_user_invoice_order_my(0)" type="primary">待开票<span v-if="user_invoice_order>0">({{user_invoice_order}}个)</span></el-button>
  12. <div class="flex_1" />
  13. </div>
  14. <div class="qs_search" style="margin-bottom: 0px;display: flex;justify-content: space-between;align-items: center;">
  15. <el-form ref="form" label-width="80px" style="display: flex;flex-direction: row;">
  16. <el-form-item label="销售方">
  17. <el-input size="small" v-model="search.sale_company_name"></el-input>
  18. </el-form-item>
  19. <el-form-item label="购买方">
  20. <el-input size="small" v-model="search.buy_company_name"></el-input>
  21. </el-form-item>
  22. <el-form-item label-width="5px">
  23. <el-button @click="search_" size="small" type="primary">查询</el-button>
  24. <el-checkbox style="margin-left: 15px" @change="search_" true-label="1" false-label="0" v-model="search.is_gd">挂单({{search.gd_total}}个)</el-checkbox>
  25. </el-form-item>
  26. </el-form>
  27. <div>
  28. <el-button size="small" @click="show_user_invoice_add(0)" type="primary">上传发票</el-button>
  29. </div>
  30. </div>
  31. <el-row>
  32. <el-col :span="24">
  33. <el-table row-key="id" :data="list">
  34. <el-table-column prop="sale_company_name" width="220px" label="销售方"></el-table-column>
  35. <el-table-column prop="buy_company_name" width="220px" label="购买方"></el-table-column>
  36. <el-table-column prop="money" label="发票金额">
  37. <template slot-scope="scope">
  38. <span>{{scope.row.money}}</span>
  39. <br/>
  40. <a style="color: red" target="_blank" :href="scope.row.file">查看发票</a>
  41. </template>
  42. </el-table-column>
  43. <el-table-column prop="is_income" width="200px" label="发票号码">
  44. <template slot-scope="scope">
  45. <span>{{scope.row.tax_number}}</span>
  46. </template>
  47. </el-table-column>
  48. <el-table-column prop="is_income" label="进账类型">
  49. <template slot-scope="scope">
  50. <span :style="`color:${scope.row.is_income_obj.color}`">{{scope.row.is_income_obj.name}}</span>
  51. </template>
  52. </el-table-column>
  53. <el-table-column prop="is_income" label="发票类型">
  54. <template slot-scope="scope">
  55. <span>{{scope.row.type_obj.name}}</span>
  56. </template>
  57. </el-table-column>
  58. <el-table-column prop="status" label="审核状态">
  59. <template slot-scope="scope">
  60. <span :style="`color:${scope.row.status_obj.color}`">{{scope.row.status_obj.name}}</span>
  61. </template>
  62. </el-table-column>
  63. <el-table-column prop="status" label="备注">
  64. <template slot-scope="scope">
  65. <el-button type="text" size="small" @click="manager_space('log',scope.row.id)">查看备注</el-button>
  66. </template>
  67. </el-table-column>
  68. <el-table-column prop="addtime" width="160px" label="发票日期"></el-table-column>
  69. <el-table-column prop="uid" label="关联用户">
  70. <template slot-scope="scope">
  71. <a :href="scope.row.user_link" style="color:#409EFF" target="_blank">{{scope.row.uid}}</a>
  72. </template>
  73. </el-table-column>
  74. <el-table-column fixed="right" width="250px" prop="uid" label="操作">
  75. <template slot-scope="scope">
  76. <el-button v-if="scope.row.order_type==1" type="text" @click="show_user_settlement(scope.row)">关联订单</el-button>
  77. <el-button v-if="scope.row.order_type==2" type="text" @click="show_order_settlement(scope.row)">关联订单</el-button>
  78. <el-button v-if="scope.row.is_gd==0" type="text" @click="add_gd(scope.row.id)">申请挂单</el-button>
  79. <el-button v-if="scope.row.is_gd==1" style="color: #E6A23C" type="text" @click="add_gd(scope.row.id)">取消挂单</el-button>
  80. <el-button type="text" @click="add_memo(scope.row.id,'添加备注')">备注</el-button>
  81. <el-dropdown @command="(command) => manager_space(command, scope.row.id)" style="margin-left: 10px">
  82. <el-button type="text">更多</el-button>
  83. <el-dropdown-menu slot="dropdown">
  84. <el-dropdown-item v-if="scope.row.status!=4" command="edit">编辑</el-dropdown-item>
  85. <el-dropdown-item v-if="scope.row.status==1" command="agree">审核通过</el-dropdown-item>
  86. <el-dropdown-item v-if="scope.row.status==1" command="refuse">审核拒绝</el-dropdown-item>
  87. <el-dropdown-item command="log">操作日志</el-dropdown-item>
  88. <el-dropdown-item v-if="scope.row.status!=4" command="del">删除</el-dropdown-item>
  89. </el-dropdown-menu>
  90. </el-dropdown>
  91. </template>
  92. </el-table-column>
  93. </el-table>
  94. </el-col>
  95. </el-row>
  96. <el-pagination
  97. background
  98. style="margin-top: 10px"
  99. layout="prev, pager, next"
  100. @current-change="page_event"
  101. :page-size="search.pagesize"
  102. :total="search.total">
  103. </el-pagination>
  104. <pub_log v-if="drawer_obj.pub_log" :back="this" :pro="drawer_obj.id" action="user_invoice"></pub_log>
  105. <user_settlement v-if="drawer_obj.user_settlement" :fp_info="drawer_obj.obj" :back="this" :pro="drawer_obj.id"></user_settlement>
  106. <user_invoice_add v-if="drawer_obj.user_invoice_add" :back="this" :pro="drawer_obj.id"></user_invoice_add>
  107. <order_settlement v-if="drawer_obj.order_settlement" :fp_info="drawer_obj.obj" :back="this" :pro="drawer_obj.id"></order_settlement>
  108. <user_invoice_order_all v-if="drawer_obj.user_invoice_order_all" :fp_info="drawer_obj.obj" :back="this" :pro="drawer_obj.id"></user_invoice_order_all>
  109. </div>
  110. </template>
  111. <script>
  112. import user_invoice_add from '@/components/drawer/invoice/user_invoice_add';
  113. import pub_log from '@/components/drawer/pub_log';
  114. import user_settlement from '@/components/drawer/invoice/user_settlement';
  115. import order_settlement from '@/components/drawer/invoice/order_settlement';
  116. import user_invoice_order_all from '@/components/drawer/user_invoice_order/all';
  117. export default {
  118. props: [],
  119. components: {order_settlement,user_invoice_add,pub_log,user_settlement,user_invoice_order_all},
  120. props: {
  121. back:{
  122. type:Object
  123. },
  124. },
  125. data() {
  126. return {
  127. loading: true,
  128. drawer_obj:{
  129. user_settlement:false,
  130. order_settlement:false,
  131. user_invoice_add:false,
  132. user_invoice_order_all:false,
  133. id:0,
  134. pub_log:false,
  135. obj:{},
  136. },
  137. user_invoice_order:0,
  138. search: {
  139. pagesize: 15,
  140. total: 0,
  141. status:1,
  142. name: "",
  143. gd_total:0,
  144. },
  145. status:[
  146. ],
  147. list: []
  148. };
  149. },
  150. computed: {},
  151. watch: {},
  152. created() {
  153. },
  154. mounted() {
  155. this.getList();
  156. this.get_status();
  157. },
  158. methods: {
  159. show_user_settlement(row)
  160. {
  161. this.drawer_obj.obj=row;
  162. this.drawer_obj.id = row.id;
  163. this.drawer_obj.user_settlement = true;
  164. },
  165. show_user_invoice_order_my()
  166. {
  167. this.drawer_obj.obj={};
  168. this.drawer_obj.id = 0;
  169. this.drawer_obj.user_invoice_order_all = true;
  170. },
  171. show_order_settlement(row)
  172. {
  173. this.drawer_obj.obj=row;
  174. this.drawer_obj.id = row.id;
  175. this.drawer_obj.order_settlement = true;
  176. },
  177. show_user_invoice_add(id)
  178. {
  179. this.drawer_obj.id = id;
  180. this.drawer_obj.user_invoice_add = true;
  181. },
  182. async add_memo(id) {
  183. this.$prompt('请输入备注信息', '提示', {
  184. confirmButtonText: '确定',
  185. cancelButtonText: '取消',
  186. }).then(async ({ value }) => {
  187. this.loading = true;
  188. let res =await this.$post("/uapi/pub/info/user/user_invoice/add_memo",{id:id,memo:value});
  189. if (res.status == 1) {
  190. this.$message({
  191. type: 'success',
  192. message: '成功!'
  193. });
  194. await this.getList();
  195. }
  196. this.loading = false;
  197. }).catch(() => {
  198. this.$message({
  199. type: 'info',
  200. message: '已取消'
  201. });
  202. });
  203. },
  204. async add_gd(id) {
  205. this.$prompt('请输入原因', '提示', {
  206. confirmButtonText: '确定',
  207. cancelButtonText: '取消',
  208. }).then(async ({ value }) => {
  209. this.loading = true;
  210. let res =await this.$post("/uapi/pub/info/user/user_invoice/add_gd",{id:id,memo:value});
  211. if (res.status == 1) {
  212. this.$message({
  213. type: 'success',
  214. message: '成功!'
  215. });
  216. await this.getList();
  217. }
  218. this.loading = false;
  219. }).catch(() => {
  220. this.$message({
  221. type: 'info',
  222. message: '已取消'
  223. });
  224. });
  225. },
  226. manager_space(command,id)
  227. {
  228. if(command=='log')
  229. {
  230. this.drawer_obj.id=id;
  231. this.drawer_obj.pub_log=true;
  232. }
  233. else if(command=='del')
  234. {
  235. this.admin_del(id);
  236. }
  237. else if(command=='agree')
  238. {
  239. this.admin_agree(id);
  240. }
  241. else if(command=='refuse')
  242. {
  243. this.admin_refuse(id);
  244. }
  245. else if(command=='edit')
  246. {
  247. this.show_user_invoice_add(id);
  248. }
  249. },
  250. async getList() {
  251. this.loading = true;
  252. this.drawer = false;
  253. let res = await this.$post("/uapi/pub/info/user/user_invoice/admin_list", this.search);
  254. this.loading = false;
  255. if (res.status == 1) {
  256. this.list = res.data.list;
  257. this.search.total = res.data.total;
  258. this.search.pagesize = res.data.pagesize;
  259. this.search.gd_total=res.data.gd_total;
  260. }
  261. },
  262. async get_status() {
  263. this.loading = true;
  264. let res = await this.$post("/uapi/pub/info/user/user_invoice/get_status", this.search);
  265. this.loading = false;
  266. if (res.status == 1) {
  267. this.status = res.data.list;
  268. this.user_invoice_order=res.data.user_invoice_order;
  269. }
  270. },
  271. async admin_refuse(id) {
  272. this.$prompt('请输入拒绝的理由', '提示', {
  273. confirmButtonText: '确定',
  274. cancelButtonText: '取消',
  275. }).then(async ({ value }) => {
  276. this.loading = true;
  277. let res =await this.$post("/uapi/pub/info/user/user_invoice/admin_refuse",{id:id,reason:value});
  278. if (res.status == 1) {
  279. this.$message({
  280. type: 'success',
  281. message: '成功!'
  282. });
  283. await this.getList();
  284. await this.get_status();
  285. }
  286. this.loading = false;
  287. }).catch(() => {
  288. this.$message({
  289. type: 'info',
  290. message: '已取消删除'
  291. });
  292. });
  293. },
  294. async admin_agree(id) {
  295. this.$confirm('是否确认通过?', '提示', {
  296. confirmButtonText: '确定',
  297. cancelButtonText: '取消',
  298. type: 'warning'
  299. }).then(async () => {
  300. this.loading = true;
  301. let res =await this.$post("/uapi/pub/info/user/user_invoice/admin_agree",{id:id});
  302. if (res.status == 1) {
  303. this.$message({
  304. type: 'success',
  305. message: '成功!'
  306. });
  307. await this.getList();
  308. await this.get_status();
  309. }
  310. this.loading = false;
  311. }).catch(() => {
  312. this.$message({
  313. type: 'info',
  314. message: '已取消删除'
  315. });
  316. });
  317. },
  318. async admin_del(id) {
  319. this.$confirm('是否确认删除?', '提示', {
  320. confirmButtonText: '确定',
  321. cancelButtonText: '取消',
  322. type: 'warning'
  323. }).then(async () => {
  324. this.loading = true;
  325. let res =await this.$post("/uapi/pub/info/user/user_invoice/admin_del",{id:id});
  326. if (res.status == 1) {
  327. this.$message({
  328. type: 'success',
  329. message: '成功!'
  330. });
  331. await this.getList();
  332. }
  333. this.loading = false;
  334. }).catch(() => {
  335. this.$message({
  336. type: 'info',
  337. message: '已取消删除'
  338. });
  339. });
  340. },
  341. page_event(page) {
  342. this.search.page = page;
  343. this.getList();
  344. },
  345. getData_(id) {
  346. this.search.status = id;
  347. this.search.page=0;
  348. this.getList();
  349. },
  350. search_() {
  351. this.search.page = 0;
  352. this.getList();
  353. }
  354. }
  355. };
  356. </script>
  357. <style scoped>
  358. .el-tag {
  359. cursor: pointer;
  360. }
  361. </style>