verifyxiang.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. <script setup lang="ts">
  2. import { shallowRef, ref, onMounted, onUnmounted } from 'vue'
  3. import { useRoute, useRouter } from 'vue-router'
  4. import { GlobalStore } from '@/stores/index'
  5. import { fnMd5 } from '@/utils/common'
  6. import { ElMessage } from 'element-plus'
  7. import Drawer from '@/components/Drawer/index.vue'
  8. import ImageCom from '@/components/Image/index.vue'
  9. import { ColumnProps } from '@/components/TableBase/interface/index'
  10. import { Storehouse_Contract_Get, Storehouse_Contract_Approval } from '@/api/storehouse/index'
  11. interface InfoType {
  12. Id: number
  13. T_State: number
  14. T_approver: string
  15. T_approver_name: string
  16. T_customer: string
  17. T_date: string
  18. T_money: number
  19. T_number: string
  20. T_out: number
  21. T_pdf: string
  22. T_remark: string
  23. T_submit: string
  24. T_type: number
  25. T_discount: number
  26. T_start_date: string
  27. T_end_date: string
  28. T_submit_name: string
  29. T_project: string
  30. T_no_recoveries_money: number
  31. T_no_invoice_money: number
  32. }
  33. const route = useRoute()
  34. const router = useRouter()
  35. const isSale = ref(false)
  36. const isVerify = ref(true)
  37. const tableSnData = ref<any[]>([])
  38. const tableData = ref<any[]>([])
  39. const invoiceTableData = ref<any[]>([])
  40. const recoveriesTableData = ref<any[]>([])
  41. const info = ref<InfoType | undefined>()
  42. const globalStore = GlobalStore()
  43. const drawerSnRef = ref<InstanceType<typeof Drawer> | null>(null)
  44. const headerCellStyle = shallowRef({
  45. background: '#909399',
  46. height: '50px',
  47. color: '#fff'
  48. })
  49. let columns: ColumnProps[] = [
  50. { type: 'index', label: '序号', width: 80, align: 'center ' },
  51. { label: '产品图片', prop: 'T_product_img', align: 'center ', name: 'T_product_img' },
  52. { label: '产品名称', prop: 'T_product_name', align: 'center ' },
  53. { label: '产品分类', prop: 'T_product_class_name', align: 'center ' },
  54. { label: '产品型号', prop: 'T_product_model', align: 'center ', name: 'T_product_model' },
  55. { label: '产品规格', prop: 'T_product_spec', align: 'center ' },
  56. {
  57. label: '是否关联SN',
  58. prop: 'T_product_relation_sn',
  59. align: 'center ',
  60. width: 120,
  61. name: 'T_product_relation_sn'
  62. },
  63. { label: '数量', prop: 'T_product_total', align: 'center ' },
  64. { label: '已出库数量', prop: 'T_product_out', align: 'center ' },
  65. { prop: 'operation', label: '操作', width: 100, fixed: 'right', align: 'center ' }
  66. ]
  67. const VerifyColumns: ColumnProps[] = [
  68. { type: 'index', label: '序号', width: 80, align: 'center ' },
  69. { label: '产品图片', prop: 'T_product_img', align: 'center ', name: 'T_product_img' },
  70. { label: '产品名称', prop: 'T_product_name', align: 'center ' },
  71. { label: '产品分类', prop: 'T_product_class_name', align: 'center ' },
  72. { label: '产品型号', prop: 'T_product_model', align: 'center ', name: 'T_product_model' },
  73. { label: '产品规格', prop: 'T_product_spec', align: 'center ' },
  74. { label: '数量', prop: 'T_product_total', align: 'center ' },
  75. { label: '单价', prop: 'T_price', align: 'center ' },
  76. { label: '总价', prop: 'total', align: 'center ' }
  77. ]
  78. const columnsRecoveries = [
  79. { type: 'index', label: '序号', width: 80, align: 'center ' },
  80. { label: '回款时间', prop: 'T_date', align: 'center ' },
  81. { label: '回款金额', prop: 'T_money', align: 'center ' }
  82. ]
  83. const columnsInvoice = [
  84. { type: 'index', label: '序号', width: 80, align: 'center ' },
  85. { label: '开票时间', prop: 'T_date', align: 'center ' },
  86. { label: '开票金额', prop: 'T_money', align: 'center ' }
  87. ]
  88. const snColumns = [
  89. { type: 'index', label: '序号', width: 80, align: 'center ' },
  90. { label: 'SN', prop: 'sn', align: 'center ' }
  91. ]
  92. const getStorehouseContractGet = async () => {
  93. const res: any = await Storehouse_Contract_Get({ User_tokey: globalStore.GET_User_tokey, T_number: window.sessionStorage.getItem('globaId') })
  94. if (res.Code === 200) {
  95. info.value = res.Data
  96. const { T_Product, T_invoice, T_recoveries } = res.Data
  97. tableData.value = T_Product
  98. invoiceTableData.value = T_invoice
  99. recoveriesTableData.value = T_recoveries
  100. if (!isVerify.value && T_Product) {
  101. tableData.value = T_Product.map((item: any) => {
  102. item.total = item.T_product_total * item.T_price
  103. return item
  104. })
  105. }
  106. }
  107. }
  108. const previewPdf = (str: string) => window.open(str)
  109. const contractApproval = async (state: number) => {
  110. const res: any = await Storehouse_Contract_Approval({
  111. User_tokey: globalStore.GET_User_tokey,
  112. T_number: route.params.id,
  113. T_state: state
  114. })
  115. if (res.Code === 200) {
  116. ElMessage.success('审核成功!!')
  117. getStorehouseContractGet()
  118. }
  119. }
  120. const getState = (val: number, type: string) => {
  121. switch (val) {
  122. case 1:
  123. return type === 'T_State' ? '已通过' : '未出库'
  124. case 2:
  125. return type === 'T_State' ? '未通过' : '已部分出库'
  126. case 3:
  127. return type === 'T_State' ? '待审核' : '已全部出库'
  128. }
  129. }
  130. /**
  131. * 回调
  132. */
  133. const callbackSnDrawer = (done: () => void) => done()
  134. const previewSn = (devicelist: string[]) => {
  135. drawerSnRef.value?.openDrawer()
  136. if (!devicelist) return
  137. tableSnData.value = devicelist.map((item: string) => {
  138. return {
  139. sn: item
  140. }
  141. })
  142. }
  143. onUnmounted(() => {
  144. isSale.value = false
  145. })
  146. const drawerverifyRef = ref<InstanceType<typeof Drawer> | null>(null)
  147. const openDrawer = () => drawerverifyRef.value?.openDrawer()
  148. defineExpose({
  149. openDrawer,getStorehouseContractGet
  150. })
  151. </script>
  152. <template>
  153. <Drawer ref="drawerverifyRef" size="70%">
  154. <div class="contract-detail">
  155. <div class="info">
  156. <h1>
  157. 详情<span v-if="isVerify"> - {{ getState(info?.T_State!, 'T_State') }}</span>
  158. </h1>
  159. <el-divider />
  160. <div class="content">
  161. <el-row>
  162. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"><span>合同编号</span></el-col>
  163. <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5"><span>{{ info?.T_number! }}</span></el-col>
  164. </el-row>
  165. <el-row v-if="isVerify">
  166. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"> <span>客户名称</span></el-col>
  167. <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5"><span>{{ info?.T_customer! }}</span></el-col>
  168. </el-row>
  169. <el-row>
  170. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"><span>{{ isVerify ? '产品' : '验证' }}明细</span></el-col>
  171. <el-col :span="21">
  172. <el-table border stripe :data="tableData" style="width: 100%"
  173. :header-cell-style="headerCellStyle">
  174. <template v-for="item in columns" :key="item.prop">
  175. <el-table-column v-bind="item" v-if="item.fixed !== 'right'">
  176. <template #default="{ row }" v-if="item.prop === item.name">
  177. <span v-if="item.prop === 'T_product_relation_sn'">
  178. <el-tag v-if="row.T_product_relation_sn === 1" effect="dark">是</el-tag>
  179. <el-tag v-else type="success" effect="dark">否</el-tag>
  180. </span>
  181. <ImageCom v-if="item.prop === 'T_product_img'" :src="row.T_product_img" />
  182. <el-tooltip v-if="item.prop === 'T_product_model'" effect="dark"
  183. :content="row.T_product_model" placement="bottom">
  184. {{ row.T_product_model }}
  185. </el-tooltip>
  186. </template>
  187. </el-table-column>
  188. <el-table-column v-bind="item" v-if="item.fixed === 'right'">
  189. <template #default="{ row }">
  190. <el-button type="primary" :disabled="!row.T_product_relation_sn"
  191. @click="previewSn(row.T_device_list)">查看</el-button>
  192. </template>
  193. </el-table-column>
  194. </template>
  195. </el-table>
  196. </el-col>
  197. </el-row>
  198. <el-row v-if="isVerify">
  199. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"> <span>业务日期</span></el-col>
  200. <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5">
  201. <span>{{ info?.T_date! }}</span></el-col>
  202. </el-row>
  203. <el-row>
  204. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"> <span>合同金额</span></el-col>
  205. <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5">
  206. <el-text type="danger">{{ info?.T_money! }}¥</el-text>
  207. </el-col>
  208. </el-row>
  209. <el-row v-if="!isVerify">
  210. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"> <span>优惠金额</span></el-col>
  211. <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5">
  212. <el-text type="danger">{{ info?.T_discount! }}¥</el-text>
  213. </el-col>
  214. </el-row>
  215. <el-row v-if="!isVerify">
  216. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"> <span>签订时间</span></el-col>
  217. <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5">
  218. <span>{{ info?.T_date! }}</span></el-col>
  219. </el-row>
  220. <el-row v-if="!isVerify">
  221. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"> <span>起始时间</span></el-col>
  222. <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5">
  223. <span>{{ info?.T_start_date! }}</span></el-col>
  224. </el-row>
  225. <el-row v-if="!isVerify">
  226. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"> <span>终止时间</span></el-col>
  227. <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5">
  228. <span>{{ info?.T_end_date! }}</span></el-col>
  229. </el-row>
  230. <el-row>
  231. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"> <span>项目</span></el-col>
  232. <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5">
  233. <span>{{ info?.T_project }}</span>
  234. </el-col>
  235. </el-row>
  236. <el-row v-if="isVerify">
  237. <!-- 1-未出库 2-已部分出库 3-已全部出库 -->
  238. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"><span>出库状态</span></el-col>
  239. <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5"><span>{{ getState(info?.T_out!, 'T_out')
  240. }}</span></el-col>
  241. </el-row>
  242. <el-row v-if="isVerify">
  243. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"><span v-if="isVerify">经办人</span><span
  244. v-else>合同负责人</span></el-col>
  245. <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5"><span>{{ info?.T_submit_name! }}</span></el-col>
  246. </el-row>
  247. <el-row>
  248. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"><span>合同备注</span></el-col>
  249. <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5"><span>{{ info?.T_remark! }}</span></el-col>
  250. </el-row>
  251. <el-row>
  252. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"><span>附件</span></el-col>
  253. <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5"><span v-if="!info?.T_pdf!">无</span>
  254. <el-button v-else type="primary" @click="previewPdf(info?.T_pdf!)">查看附件</el-button></el-col>
  255. </el-row>
  256. <el-row>
  257. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"><span>回款明细</span></el-col>
  258. <el-col :span="21">
  259. <el-table border stripe :data="recoveriesTableData" style="width: 100%"
  260. :header-cell-style="headerCellStyle">
  261. <el-table-column v-bind="item" v-for="item in columnsRecoveries"
  262. :key="item.prop"></el-table-column>
  263. </el-table>
  264. </el-col>
  265. </el-row>
  266. <el-row v-if="isVerify">
  267. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"><span>未回款金额</span></el-col>
  268. <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5">
  269. <el-text type="danger">{{ info?.T_no_recoveries_money! }}¥</el-text>
  270. </el-col>
  271. </el-row>
  272. <el-row>
  273. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"><span>开票明细</span></el-col>
  274. <el-col :span="21">
  275. <el-table border stripe :data="invoiceTableData" style="width: 100%"
  276. :header-cell-style="headerCellStyle">
  277. <el-table-column v-bind="item" v-for="item in columnsInvoice"
  278. :key="item.prop"></el-table-column>
  279. </el-table>
  280. </el-col>
  281. </el-row>
  282. <el-row v-if="isVerify">
  283. <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="2"><span>未开票金额</span></el-col>
  284. <el-col :xs="11" :sm="9" :md="7" :lg="6" :xl="5"><el-text type="danger">{{ info?.T_no_invoice_money!
  285. }}¥</el-text></el-col>
  286. </el-row>
  287. </div>
  288. <el-divider />
  289. <div class="submit">
  290. <el-button v-if="info?.T_State === 3 && isSale" type="danger" round
  291. @click="contractApproval(2)">审核不通过</el-button>
  292. <el-button v-if="info?.T_State === 3 && isSale" type="success" round
  293. @click="contractApproval(1)">审核通过</el-button>
  294. <el-button type="primary" round @click="router.back()">返回</el-button>
  295. </div>
  296. </div>
  297. <Drawer ref="drawerSnRef" :handleClose="callbackSnDrawer" size="30%">
  298. <el-table :data="tableSnData" style="width: 100%; height: 99%" :header-cell-style="headerCellStyle">
  299. <template v-for="item in snColumns" :key="item">
  300. <el-table-column v-if="item.type === 'index'" v-bind="item" />
  301. <el-table-column v-if="item.prop" v-bind="item" />
  302. </template>
  303. </el-table>
  304. </Drawer>
  305. </div>
  306. </Drawer>
  307. </template>
  308. <style scoped lang="scss">
  309. .contract-detail {
  310. height: 100%;
  311. font-weight: bold;
  312. color: var(--el-text-color-secondary);
  313. .info {
  314. height: 100%;
  315. padding: 20px;
  316. h1 {
  317. font-size: 24px;
  318. span {
  319. color: #f56c6c;
  320. }
  321. }
  322. & .content {
  323. height: calc(100% - 72px - 25px - 40px);
  324. overflow-y: auto;
  325. .el-row {
  326. margin-bottom: 16px;
  327. }
  328. }
  329. .submit {
  330. display: flex;
  331. justify-content: center;
  332. }
  333. }
  334. }
  335. </style>