detail.vue 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102
  1. <template>
  2. <div class="salesDetail-wrap" :style="{paddingBottom:hideFooter||bizSn?'0px':'45px'}">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="salesDetail-cont">
  5. <template slot="subTitle">
  6. <a id="salesDetail-back-btn" href="javascript:;" v-if="!bizSn" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  7. <span style="margin: 0 15px;color: #666;font-weight: bold;">单号:{{ detailData&&detailData.salesBillNo }}</span>
  8. <span v-if="detailData&&detailData.salesBillNoSource">(原:{{ detailData&&detailData.salesBillNoSource || '--' }})</span>
  9. <span style="margin: 0 10px;color: #666;">客户名称:{{ detailData&&detailData.buyerName }}</span>
  10. <a-button size="small" type="link" class="button-default" @click="showDetail=!showDetail">
  11. <a-icon :type="showDetail ? 'eye-invisible' : 'eye'"/> {{ showDetail?'隐藏':'查看' }}信息
  12. </a-button>
  13. </template>
  14. <template slot="extra">
  15. <a-button
  16. key="1"
  17. type="primary"
  18. class="button-info"
  19. id="salesDetail-xs-print-btn"
  20. v-if="$hasPermissions('B_salesPrint')"
  21. :disabled="hasData"
  22. @click="handlePrint('SALES_BILL','B_salesPrint')">销售打印</a-button>
  23. <a-button
  24. key="2"
  25. type="primary"
  26. class="button-info"
  27. id="salesDetail-xsfl-print-btn"
  28. v-if="$hasPermissions('B_salesTypePrint')"
  29. :disabled="hasData"
  30. @click="handlePrint('SALES_BILL_TYPE','B_salesTypePrint')">销售分类打印</a-button>
  31. <a-divider type="vertical" />
  32. <a-button
  33. key="3"
  34. type="default"
  35. class="button-info"
  36. id="salesDetail-export-btn"
  37. v-if="$hasPermissions('B_salesDetailExport')"
  38. :disabled="hasData"
  39. @click="handlePrint('export','B_salesDetailExport')">导出Excel</a-button>
  40. <a-button
  41. key="4"
  42. type="default"
  43. class="button-info"
  44. id="salesDetail-exportType-btn"
  45. v-if="$hasPermissions('B_salesTypeExport')"
  46. :disabled="hasData"
  47. @click="handlePrint('typeExport','B_salesTypeExport')">销售分类导出</a-button>
  48. </template>
  49. </a-page-header>
  50. <!-- 基础信息 -->
  51. <a-card size="small" :bordered="false" class="pages-wrap" style="margin-bottom: 6px;" v-show="showDetail">
  52. <div style="padding: 0;">
  53. <a-descriptions size="small" :column="3">
  54. <a-descriptions-item label="客户名称">{{ detailData&&detailData.buyerName || '--' }}</a-descriptions-item>
  55. <a-descriptions-item label="收货地址" :span="2">{{ shippingAddress||'--' }}</a-descriptions-item>
  56. <a-descriptions-item label="收货人">{{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.consigneeName || '--' }}</a-descriptions-item>
  57. <a-descriptions-item label="收货电话">{{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.consigneeTel || '--' }}</a-descriptions-item>
  58. <a-descriptions-item label="收款方式">{{ detailData&&detailData.settleStyleSnDictValue || '--' }}</a-descriptions-item>
  59. <a-descriptions-item label="审核时间">{{ detailData&&detailData.auditDate || '--' }}</a-descriptions-item>
  60. <a-descriptions-item label="业务状态" v-if="detailData">{{ detailData.billStatusDictValue || '--' }}{{ (detailData.billStatus=='SUPERIOR_AUDIT_REJECT'||detailData.billStatus=='TRANSFER_AUDIT_REJECT')?'('+detailData.transferDealerName+')':'' }}</a-descriptions-item>
  61. <a-descriptions-item label="财务状态">{{ detailData&&detailData.financialStatusDictValue || '--' }}</a-descriptions-item>
  62. <a-descriptions-item label="转单时间" v-if="detailData&&detailData.transferDate">{{ detailData.transferDate }}</a-descriptions-item>
  63. <a-descriptions-item label="改单时间" v-if="detailData&&detailData.salesBillSource=='PURCHASE'&&detailData.submitDate">{{ detailData.submitDate }}</a-descriptions-item>
  64. <a-descriptions-item label="最新提交时间" v-if="detailData&&detailData.salesBillSource=='SALES'&&detailData.submitDate">{{ detailData.submitDate }}</a-descriptions-item>
  65. <a-descriptions-item label="发货经销商" v-if="detailData&&detailData.billStatus&&(detailData.billStatus=='TRANSFER_YES'||detailData.billStatus=='TRANSFER_FINISH')">{{ detailData.transferDealerName || '--' }}</a-descriptions-item>
  66. <a-descriptions-item label="备注" :span="3">{{ detailData&&detailData.remarks || '--' }}</a-descriptions-item>
  67. </a-descriptions>
  68. </div>
  69. </a-card>
  70. <a-card
  71. size="small"
  72. :bordered="false"
  73. class="pages-wrap"
  74. style="margin-bottom: 6px;"
  75. :bodyStyle="{padding:'10px 10px 0'}">
  76. <!-- 统计信息 -->
  77. <a-alert type="info" style="margin-bottom: 10px;">
  78. <div slot="message">
  79. <div class="form-grid">
  80. <div class="tongji-bar-col">
  81. <div v-if="$hasPermissions(authCode + '_costPrice')">总成本:<strong>{{ detailData&&(detailData.totalCost || detailData.totalCost==0) ? toThousands(detailData.totalCost) : '--' }}</strong>;</div>
  82. <div v-if="$hasPermissions(authCode + '_costPrice')">总毛利:<strong>{{ detailData&&(detailData.grossProfit || detailData.grossProfit==0) ? toThousands(detailData.grossProfit) : '--' }}</strong>;</div>
  83. </div>
  84. <div class="tongji-bar-col">
  85. <div>总数量:<strong>{{ detailData&&(detailData.totalQty || detailData.totalQty==0) ? detailData.totalQty : '--' }}</strong>;</div>
  86. <div v-if="$hasPermissions(authCode + '_salesPrice')">总售价:<strong>{{ detailData&&(detailData.totalAmount || detailData.totalAmount==0) ? toThousands(detailData.totalAmount) : '--' }}</strong>;</div>
  87. </div>
  88. <div class="tongji-bar-col">
  89. <div>已取消数量:<strong>{{ detailData&&(detailData.totalCancelQty || detailData.totalCancelQty==0) ? detailData.totalCancelQty : '--' }}</strong>;</div>
  90. <div v-if="$hasPermissions(authCode + '_salesPrice')">已取消金额:<strong>{{ detailData&&(detailData.totalCancelAmount || detailData.totalCancelAmount==0) ? toThousands(detailData.totalCancelAmount) : '--' }}</strong>;</div>
  91. </div>
  92. <div class="tongji-bar-col">
  93. <div>已下推数量:<strong>{{ detailData&&(detailData.totalPushedQty || detailData.totalPushedQty==0) ? detailData.totalPushedQty : '--' }}</strong>;</div>
  94. <div v-if="$hasPermissions(authCode + '_salesPrice')">已下推金额:<strong>{{ detailData&&(detailData.totalPushedAmount || detailData.totalPushedAmount==0) ? toThousands(detailData.totalPushedAmount) : '--' }}</strong>;</div>
  95. </div>
  96. <div class="tongji-bar-col">
  97. <div>待下推数量:<strong>{{ detailData&&(detailData.totalUnpushedQty || detailData.totalUnpushedQty==0) ? detailData.totalUnpushedQty : '--' }}</strong>;</div>
  98. <div v-if="$hasPermissions(authCode + '_salesPrice')"> 待下推金额:<strong>{{ detailData&&(detailData.totalUnpushedAmount || detailData.totalUnpushedAmount==0) ? toThousands(detailData.totalUnpushedAmount) : '--' }}</strong>;</div>
  99. </div>
  100. <div class="tongji-bar-col">
  101. <div>已发货数量:<strong>{{ detailData&&(detailData.totalDispatchQty || detailData.totalDispatchQty==0) ? detailData.totalDispatchQty : '--' }}</strong>;</div>
  102. <div v-if="$hasPermissions(authCode + '_salesPrice')">已发货金额:<strong>{{ detailData&&(detailData.totalDispatchAmount || detailData.totalDispatchAmount==0) ? toThousands(detailData.totalDispatchAmount) : '--' }}</strong>;</div>
  103. </div>
  104. <div class="tongji-bar-col">
  105. <div>待发货数量:<strong>{{ detailData&&(detailData.totalUndispatchQty || detailData.totalUndispatchQty==0) ? detailData.totalUndispatchQty : '--' }}</strong>;</div>
  106. <div v-if="$hasPermissions(authCode + '_salesPrice')">待发货金额:<strong>{{ detailData&&(detailData.totalUndispatchAmount || detailData.totalUndispatchAmount==0) ? toThousands(detailData.totalUndispatchAmount) : '--' }}</strong>;</div>
  107. </div>
  108. <div class="tongji-bar-col">
  109. <div v-if="$hasPermissions(authCode + '_costPrice')&&isAveragePrice"><label style="width:108px;">平均成本公斤单价:<strong>{{ detailData&&(detailData.totalWeightAvgCost || detailData.totalWeightAvgCost==0) ? toThousands(detailData.totalWeightAvgCost) : '--' }}</strong>;</label></div>
  110. <div v-if="$hasPermissions(authCode + '_salesPrice')&&isAveragePrice"><label style="width:108px;">平均售价公斤单价:<strong>{{ detailData&&(detailData.totalWeightAvgPrice || detailData.totalWeightAvgPrice==0) ? toThousands(detailData.totalWeightAvgPrice) : '--' }}</strong>;</label></div>
  111. </div>
  112. <div class="tongji-bar-col">
  113. <div v-if="isAveragePrice">合计重量(kg):<strong>{{ detailData&&(detailData.totalWeightKg || detailData.totalWeightKg==0) ? detailData.totalWeightKg : '--' }}</strong>;</div>
  114. <div v-if="isCityPrice">&nbsp;&nbsp;市级总售价:<strong>{{ detailData&&(detailData.totalCityAmount || detailData.totalCityAmount==0) ? toThousands(detailData.totalCityAmount) : '--' }}</strong>;</div>
  115. </div>
  116. <div class="tongji-bar-col">
  117. <div v-if="$hasPermissions(authCode + '_salesPrice')&&detailData&&detailData.totalDiscountAmount" style="color: red;">优惠金额:<strong>{{ Number(detailData.totalDiscountAmount).toFixed(2) }}</strong>;</div>
  118. <div v-if="$hasPermissions(authCode + '_salesPrice')&&detailData&&detailData.totalConvertPromoGiftsAmount" style="color: red;width:170px;">促销产品转采购额金额:<strong>{{ Number(detailData.totalConvertPromoGiftsAmount).toFixed(2) }}</strong>;</div>
  119. </div>
  120. </div>
  121. </div>
  122. </a-alert>
  123. <!-- 查询 -->
  124. <div class="table-page-search-wrapper">
  125. <div style="display: flex;justify-content: space-between;align-items: center;">
  126. <div style="flex-grow: 1;width: 60%;">
  127. <a-form layout="inline" @keyup.enter.native="searchTable">
  128. <a-row :gutter="15" type="flex">
  129. <a-col flex="300px">
  130. <a-form-item label="出库仓库">
  131. <chooseWarehouse id="salesDetail-warehouse" ref="warehouse" v-model="warehouseSn"></chooseWarehouse>
  132. </a-form-item>
  133. </a-col>
  134. <a-col flex="300px" v-if="hasPrompActive">
  135. <a-form-item label="产品类型">
  136. <a-select
  137. v-model="promoFlag"
  138. @change="e=> {borrowFlag = undefined}"
  139. id="salesDetail-promoFlag"
  140. allowClear
  141. :dropdownMatchSelectWidth="false"
  142. placeholder="请选择产品类型">
  143. <a-select-option value="0">
  144. 正常产品
  145. </a-select-option>
  146. <a-select-option value="REGULAR">
  147. 正价产品(活动)
  148. </a-select-option>
  149. <a-select-option value="DISCOUNT">
  150. 特价产品
  151. </a-select-option>
  152. <a-select-option value="GIFT">
  153. 促销产品
  154. </a-select-option>
  155. <a-select-option value="convertPromoGiftsFlag" v-if="showConvertPromoGifts">
  156. 促销产品(转采购额)
  157. </a-select-option>
  158. <a-select-option value="GATE">
  159. 门槛产品
  160. </a-select-option>
  161. </a-select>
  162. </a-form-item>
  163. </a-col>
  164. <a-col flex="200px" v-if="hasPrompActive&&promoFlag!=='0'">
  165. <a-form-item label="累计产品">
  166. <v-select code="FLAG" v-model="borrowFlag" allowClear placeholder="请选择是否累计产品"></v-select>
  167. </a-form-item>
  168. </a-col>
  169. <a-col flex="300px" v-if="showTransferDealer">
  170. <a-form-item label="发货经销商库存">
  171. <v-select
  172. code="STOCK_LABEL"
  173. id="purchaseOrder-basicInfo-transferQty"
  174. v-model="transferQty"
  175. allowClear
  176. placeholder="请选择是否满足"
  177. ></v-select>
  178. </a-form-item>
  179. </a-col>
  180. <a-col :md="6" :sm="24">
  181. <a-button type="primary" @click="searchTable" :disabled="disabled" id="salesDetail-refresh">查询</a-button>
  182. <a-button style="margin-left: 5px" @click="resetSearchForm" id="salesDetail-reset">重置</a-button>
  183. </a-col>
  184. </a-row>
  185. </a-form>
  186. </div>
  187. <div>
  188. <span v-if="selectedDealer">发货经销商:{{ selectedDealer }}</span>
  189. <a-button
  190. id="salesDetail-updateStock"
  191. type="link"
  192. v-if="showTransferDealer"
  193. @click="openDealerModal"
  194. class="button-dealerStock">选择发货经销商</a-button>
  195. <a-button id="salesDetail-stockOut" v-if="detailData && (detailData.billStatus == 'WAIT_AUDIT' || detailData.billStatus == 'HQ_CHANGE')" type="link" @click="openStockOut">缺货明细</a-button>
  196. <a-checkbox id="salesDetail-updateStock" @change="e=>getThreeStock(e)" v-if="showStock"><span style="display: inline-block;margin-top: 1px;">第三方库存</span></a-checkbox>
  197. <a-checkbox id="salesDetail-cityPrice" v-model="isCityPrice" v-if="$hasPermissions(authCode + '_cityPrice')"><span style="display: inline-block;margin-top: 1px;">市级价</span></a-checkbox>
  198. <a-checkbox id="salesDetail-cityPrice" v-model="isAveragePrice" v-if="$hasPermissions(authCode + '_avgprice')"><span style="display: inline-block;margin-top: 1px;">平均公斤单价</span></a-checkbox>
  199. </div>
  200. </div>
  201. </div>
  202. </a-card>
  203. <!-- 正常产品列表 -->
  204. <a-card
  205. size="small"
  206. :bordered="false"
  207. class="salesEdit-cont"
  208. style="margin-bottom: 6px;"
  209. v-show="!hideNormalTable"
  210. >
  211. <div>
  212. <detailProductList
  213. ref="productList"
  214. :maxHeight="pageHeight"
  215. :detailData="detailData"
  216. :warehouseSn="warehouseSn"
  217. :promoFlag="promoFlag"
  218. :pageType="$route.params.pageType"
  219. :salesBillSn="$route.params.sn || bizSn"
  220. :authCode="authCode"
  221. :chooseList="chooseDealerList"
  222. :transferQty="transferQty"
  223. :borrowFlag="borrowFlag"
  224. :showTransferDealer="showTransferDealer"
  225. :showCityPrice="isCityPrice"
  226. :showAveragePrice="isAveragePrice"
  227. @hideTable="hideTable">
  228. </detailProductList>
  229. </div>
  230. <div v-if="hideNormalTable&&hideActiveTable" :style="{height:pageHeight+10+'px'}" class="empty-data-box">
  231. <a-empty description="暂无产品" :image="simpleImage"/>
  232. </div>
  233. </a-card>
  234. <!-- 活动产品列表 -->
  235. <a-card
  236. size="small"
  237. :bordered="false"
  238. class="salesEdit-cont"
  239. v-if="!hideActiveTable"
  240. >
  241. <div slot="title">
  242. <div style="display: flex;justify-content: space-between;align-items: center;">
  243. <strong>活动产品</strong>
  244. <div>
  245. <a-popover placement="bottom">
  246. <template slot="content">
  247. <a-checkbox-group v-model="colsValue">
  248. <a-row style="width:100px;padding:0;">
  249. <a-col :span="24" style="margin:3px 0;" v-for="(item) in colsOptions" :key="item.value">
  250. <a-checkbox :value="item.value">{{ item.label }}</a-checkbox>
  251. </a-col>
  252. </a-row>
  253. </a-checkbox-group>
  254. </template>
  255. <a-button size="small" type="link" class="button-info"><a-icon type="eye"/> 显示列</a-button>
  256. </a-popover>
  257. </div>
  258. </div>
  259. </div>
  260. <activeStatisticsList
  261. ref="activeTjList"
  262. type="view"
  263. @selected="active => salesPromoSnSet = active"
  264. :activeList="activeList"
  265. :warehouseSn="warehouseSn"
  266. :salesBillSn="$route.params.sn || bizSn"
  267. :showCols="colsValue"
  268. ></activeStatisticsList>
  269. <detailProductList
  270. ref="productActiveList"
  271. type="active"
  272. :maxHeight="pageHeight"
  273. :detailData="detailData"
  274. :activeList="activeList"
  275. :warehouseSn="warehouseSn"
  276. :promoFlag="promoFlag"
  277. :borrowFlag="borrowFlag"
  278. :pageType="$route.params.pageType"
  279. :salesBillSn="$route.params.sn || bizSn"
  280. :salesPromoSnSet="salesPromoSnSet"
  281. :authCode="authCode"
  282. :showCityPrice="isCityPrice"
  283. :showAveragePrice="isAveragePrice"
  284. @hideTable="hideTable">
  285. </detailProductList>
  286. </a-card>
  287. </a-spin>
  288. <div class="affix-cont" :class="bizSn?'affix-footer-bar':''" :style="{padding:hideFooter?0:'10px 0'}">
  289. <a-button
  290. style="width: 100px;margin: 0 10px;"
  291. :disabled="spinning"
  292. type="primary"
  293. class="button-info"
  294. id="salesDetail-transfer-btn"
  295. v-if="$hasPermissions('B_salesTransfer')&&$route.params.pageType=='salesNewDetailTransfer'&&(detailData&&detailData.promoFlag!=1&&(detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'SUPERIOR_AUDIT_REJECT' || detailData.billStatus == 'TRANSFER_AUDIT_REJECT')&&detailData.salesBillSource=='PURCHASE'&&detailData.orderType=='TIRE')"
  296. @click="handleOrder()"
  297. >
  298. 转单
  299. </a-button>
  300. <a-button
  301. type="default"
  302. class="button-info"
  303. :disabled="spinning"
  304. style="width: 100px;margin: 0 10px;"
  305. id="salesDetail-edit-btn"
  306. v-if="detailData&&detailData.salesBillSource == 'SALES' && (detailData.billStatus == 'WAIT_SUBMIT' || detailData.billStatus == 'WAIT_AUDIT' || detailData.billStatus == 'AUDIT_REJECT' || detailData.billStatus == 'HQ_CHANGE')&&$hasPermissions('B_salesEdit')"
  307. @click="handleEdit()"
  308. >
  309. 编辑
  310. </a-button>
  311. <a-button
  312. style="width: 100px;margin: 0 10px;"
  313. :disabled="spinning"
  314. type="default"
  315. id="salesDetail-edit1-btn"
  316. v-if="detailData&&detailData.salesBillSource == 'PURCHASE' && (detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'HQ_CHANGE'||detailData.billStatus == 'SUPERIOR_AUDIT_REJECT' || detailData.billStatus == 'TRANSFER_AUDIT_REJECT')&&$hasPermissions('B_salesEdit')"
  317. @click="handleChangeOrder()"
  318. >
  319. 改单
  320. </a-button>
  321. <a-button
  322. style="width: 100px;margin: 0 10px;"
  323. :disabled="spinning"
  324. type="primary"
  325. class="button-info"
  326. id="salesDetail-UPaudit-btn"
  327. v-if="detailData&&(detailData.billStatus == 'WAIT_AUDIT'||isSupAudit||detailData.billStatus == 'SUPERIOR_AUDIT_REJECT' || detailData.billStatus == 'TRANSFER_AUDIT_REJECT')&&$hasPermissions('B_salesAudit')"
  328. @click="handleAudit()"
  329. >
  330. {{ isSupAudit?'上级':'' }}审核
  331. </a-button>
  332. <!-- 转单审核 -->
  333. <a-button
  334. style="width: 100px;margin: 0 10px;"
  335. :disabled="spinning"
  336. type="primary"
  337. class="button-info"
  338. id="salesDetail-audit-btn"
  339. v-if="$hasPermissions('B_higherLevelAudit')&&detailData&&detailData.billStatus == 'SUPERIOR_WAIT_AUDIT'&&detailData.orderType=='TIRE'"
  340. @click="handleTransferAudit"
  341. >
  342. 审核
  343. </a-button>
  344. <a-button
  345. style="width: 100px;margin: 0 10px;"
  346. :disabled="spinning"
  347. type="primary"
  348. class="button-success"
  349. id="salesDetail-batchAudit-btn"
  350. v-if="detailData&&(detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'SUPERIOR_AUDIT_REJECT' || detailData.billStatus == 'TRANSFER_AUDIT_REJECT')&&$hasPermissions('B_salesAudit')&&$route.params.pageType!='salesNewDetailTransfer'"
  351. @click="handleAudit('batch')"
  352. >
  353. 一键审核
  354. </a-button>
  355. <a-button
  356. id="salesDetail-dispatch"
  357. style="width: 100px;margin: 0 10px;"
  358. type="primary"
  359. class="button-warning"
  360. v-if="detailData&&detailData.billStatus == 'WAIT_PUSH'&&$hasPermissions('B_salesDispatch')"
  361. @click="handleDispatch(detailData)"
  362. >下推</a-button>
  363. </div>
  364. <!-- 打印导出 -->
  365. <print-modal :openModal="openModal" :itemData="detailData" :nowType="nowType" @ok="handleOk" @close="closePrint" />
  366. <!-- 审核 -->
  367. <auditModal
  368. :openModal="visibleAudit"
  369. :content="auditText"
  370. :spinning="spinningAudit"
  371. @close="visibleAudit=false"
  372. @ok="auditOrder('AUDIT_PASS')"
  373. @fail="auditOrder('AUDIT_REJECT')" />
  374. <!-- 审核加下推 -->
  375. <dsModal ref="dsModal" title="销售单一键审核" :openModal="showDsModal" @close="showDsModal=false" @ok="handleOnceAudit" />
  376. <!-- 缺货明细 -->
  377. <stockOutDetail :openModal="showStockOut" :detailData="detailData" :salesBillSn="$route.params.sn || bizSn" @close="showStockOut=false"></stockOutDetail>
  378. <!-- 改单时价格变更提示 -->
  379. <tipModal ref="tipModal" :openModal="openTipModal" :dataList="sourceData" @close="closeTipModal" @ok="openTipModalOk"></tipModal>
  380. <!-- 审核时校验销售价低于成本价提示 -->
  381. <vaildPriceModal
  382. ref="vaildPriceModal"
  383. :openModal="openVaildPriceModal"
  384. :dataObj="tempData"
  385. @close="closeVaildPrice"
  386. @ok="vaildPriceOk"></vaildPriceModal>
  387. <!-- 发货经销商库存 弹窗 -->
  388. <dealerStockModal :itemSn="$route.params.sn" :openModal="openDealerStock" @close="openDealerStock = false" @ok="openDealerStockOk"></dealerStockModal>
  389. <!-- 审核弹窗 -->
  390. <auditConfirmModal :openModal="openTransferOrder" :detailData="detailData" @ok="transferOrderAuditOk" @close="openTransferOrder=false"></auditConfirmModal>
  391. </div>
  392. </template>
  393. <script>
  394. import { printFun, exportExcel } from '@/libs/JGPrint.js'
  395. import { commonMixin } from '@/utils/mixin'
  396. import moment from 'moment'
  397. import { Empty } from 'ant-design-vue'
  398. import { VSelect } from '@/components'
  399. import printModal from './printModal.vue'
  400. import auditModal from '@/views/common/auditModal.vue'
  401. import dsModal from '@/views/salesManagement/waitDispatchNew/dsModal.vue'
  402. import stockOutDetail from './stockOutDetailModal.vue'
  403. import chooseWarehouse from '@/views/common/chooseWarehouse'
  404. import detailProductList from './comps/detailProductList.vue'
  405. import activeStatisticsList from './comps/activeStatisticsList.vue'
  406. import tipModal from './tipModal.vue'
  407. import vaildPriceModal from './vaildPriceModal.vue'
  408. import dealerStockModal from './comps/dealerStockModal.vue'
  409. import auditConfirmModal from './auditModal.vue'
  410. // 接口
  411. import {
  412. salesPromoQueryList,
  413. salesDetailBySn,
  414. salesDetailPrint,
  415. salesDetailExcel,
  416. salesDetailTypeExcel,
  417. salesWriteAuditPass,
  418. salesWriteUpAuditPass,
  419. salesWriteAuditReject,
  420. salesWriteUpAuditReject,
  421. salesWriteAuditPush,
  422. getThirdStockQty,
  423. salesPromoValidaAudit,
  424. changeBillCheckUpdatePrice,
  425. changeBillCheck } from '@/api/salesNew'
  426. import { transferVerify, transfer, transferAudit } from '@/api/sales'
  427. export default {
  428. name: 'SalesDetailNew',
  429. mixins: [commonMixin],
  430. components: { VSelect, printModal, auditModal, dsModal, stockOutDetail, chooseWarehouse, detailProductList, activeStatisticsList, tipModal, vaildPriceModal, dealerStockModal, auditConfirmModal },
  431. props: {
  432. bizSn: { // 有值则为弹框,无值则为页面
  433. type: [Number, String],
  434. default: ''
  435. }
  436. },
  437. data () {
  438. return {
  439. spinning: false,
  440. disabled: false,
  441. simpleImage: Empty.PRESENTED_IMAGE_SIMPLE, // 空图片
  442. hideNormalTable: false, // 是否隐藏表格
  443. hideActiveTable: true, // 是否隐藏活动表格
  444. showDsModal: false, // 一键审核弹框
  445. showStockOut: false, // 缺货明细弹框
  446. activeList: [], // 参与活动列表
  447. authCode: '', // 权限码
  448. hasData: false, // 是否有数据
  449. showDetail: false, // 基础信息是否显示
  450. openModal: false, // 打印导出弹框
  451. detailData: null, // 详情数据
  452. nowType: null, // 打印导出类型
  453. isCityPrice: false, // 是否显示市级价
  454. isAveragePrice: false, // 是否显示
  455. visibleAudit: false, // 审核弹框
  456. spinningAudit: false, // 审核loading
  457. auditText: null, // 审核备注信息
  458. fromRouter: null, // 从那个页面打开当前页面
  459. warehouseSn: undefined, // 所在仓库
  460. promoFlag: undefined, // 产品类型
  461. openTipModal: false, // 改单弹窗
  462. sourceData: undefined, // 价格变动数据
  463. tempData: undefined, // 校验临时数据
  464. openVaildPriceModal: false, // 校验价格弹框
  465. transferQty: undefined, // 发货经销商库存查询
  466. borrowFlag: undefined, // 是否累计产品
  467. openDealerStock: false, // 打开经销商库存弹窗
  468. openTransferOrder: false, // 打开转单弹窗
  469. selectedDealer: '', // 发货经销商名称
  470. selectedDealerSn: undefined, // 发货经销商sn
  471. salesPromoSnSet: [], // 当前勾选的活动sn
  472. chooseDealerList: [], // 发货经销商数据
  473. colsOptions: [],
  474. colsValue: []
  475. }
  476. },
  477. computed: {
  478. // 详细地址
  479. shippingAddress () {
  480. const shippingAddrProvinceName = this.detailData && this.detailData.salesBillExtEntity && this.detailData.salesBillExtEntity.shippingAddrProvinceName ? this.detailData.salesBillExtEntity.shippingAddrProvinceName : ''
  481. const shippingAddrCityName = this.detailData && this.detailData.salesBillExtEntity && this.detailData.salesBillExtEntity.shippingAddrCityName ? this.detailData.salesBillExtEntity.shippingAddrCityName : ''
  482. const shippingAddrCountyName = this.detailData && this.detailData.salesBillExtEntity && this.detailData.salesBillExtEntity.shippingAddrCountyName ? this.detailData.salesBillExtEntity.shippingAddrCountyName : ''
  483. const shippingAddr = this.detailData && this.detailData.salesBillExtEntity && this.detailData.salesBillExtEntity.shippingAddr ? this.detailData.salesBillExtEntity.shippingAddr : ''
  484. if (!shippingAddrProvinceName && !shippingAddrCityName && !shippingAddrCountyName && !shippingAddr) {
  485. return '--'
  486. } else {
  487. return shippingAddrProvinceName + shippingAddrCityName + shippingAddrCountyName + shippingAddr
  488. }
  489. },
  490. // 是否因此底部栏按钮
  491. hideFooter () {
  492. const detailData = this.detailData
  493. return detailData && ((detailData.salesBillSource != 'SALES' && detailData.billStatus == 'AUDIT_REJECT') || detailData.billStatus == 'FINISH' || detailData.billStatus == 'OUTING_WAREHOUSE' || detailData.billStatus == 'TRANSFER_FINISH' || detailData.billStatus == 'TRANSFER_YES')
  494. },
  495. // 是否有促销活动产品
  496. hasPrompActive () {
  497. return this.detailData && this.detailData.promoFlag == 1
  498. },
  499. // 是否有可转采购额
  500. hasConvertPromoGifts () {
  501. return this.detailData && this.detailData.totalConvertPromoGiftsQty
  502. },
  503. // 是否有促销产品(转采购额)
  504. showConvertPromoGifts () {
  505. return this.activeList && this.activeList.filter(item => item.enabledFlag == 1).find(item => item.promotionRule && item.promotionRule.convertExpenseFlag == 1 && item.promotionRule.promotionRuleType == 'BUY_PROD_GIVE_PROD')
  506. },
  507. // 是否显示三方库存列
  508. showStock () {
  509. return this.detailData && (this.detailData.billStatus == 'WAIT_AUDIT' || this.detailData.billStatus == 'HQ_CHANGE') && this.$hasPermissions('B_salesAudit')
  510. },
  511. // 是否显示发货经销商按钮 发货经销商库存
  512. showTransferDealer () {
  513. return this.$hasPermissions('B_salesTransfer') && this.$route.params.pageType != 'salesNewDetailAudit' && (this.detailData && this.detailData.promoFlag != 1 && (this.detailData.billStatus == 'WAIT_AUDIT' || this.detailData.billStatus == 'SUPERIOR_AUDIT_REJECT' || this.detailData.billStatus == 'TRANSFER_AUDIT_REJECT') && this.detailData.salesBillSource == 'PURCHASE' && this.detailData.orderType == 'TIRE')
  514. },
  515. // 表格高度计算
  516. pageHeight () {
  517. if (!this.bizSn && (this.hideNormalTable || this.hideActiveTable || this.activeList.length == 0)) {
  518. return window.innerHeight - 330 + (this.hideFooter ? 45 : 0)
  519. }
  520. return 'auto'
  521. },
  522. // 是否上级审核
  523. isSupAudit () {
  524. return this.detailData && this.detailData.billStatus == 'SUPERIOR_WAIT_AUDIT' && this.detailData.orderType !== 'TIRE'
  525. }
  526. },
  527. methods: {
  528. // 返回
  529. handleBack () {
  530. this.$emit('close')
  531. this.$router.push({ name: 'salesQueryNewList' })
  532. },
  533. // 打开 发货经销商库存弹窗
  534. openDealerModal () {
  535. this.openDealerStock = true
  536. },
  537. getColsOptions () {
  538. this.colsOptions = [
  539. { label: '序号', value: '0' },
  540. { label: '活动类型', value: '1' },
  541. { label: '规则简称', value: '2' },
  542. { label: '门槛产品', value: '3' },
  543. { label: '特价', value: '4' },
  544. { label: '正价产品', value: '5' },
  545. { label: '促销品', value: '6' },
  546. { label: '采购额', value: '7' },
  547. { label: '款数', value: '8' },
  548. { label: '数量', value: '9' },
  549. { label: '总金额', value: '10' },
  550. { label: '优惠金额', value: '11' }
  551. ]
  552. // this.colsValue = this.colsOptions.filter(item => item.value < 8 && item.value != 3 || item.value == 11).map(item => item.value)
  553. this.colsValue = this.colsOptions.map(item => item.value)
  554. },
  555. // 确定选择经销商库存转单
  556. openDealerStockOk (val, data) {
  557. this.selectedDealer = val.dealerName
  558. this.selectedDealerSn = val.dealerSn
  559. this.chooseDealerList = data
  560. this.openDealerStock = false
  561. this.$nextTick(() => {
  562. this.searchTable()
  563. })
  564. },
  565. // 是否隐藏表格
  566. hideTable (type, len) {
  567. this.spinning = false
  568. if (type == 'normal') {
  569. this.hideNormalTable = !(this.promoFlag == 0 || this.promoFlag == undefined) || this.borrowFlag != undefined || (len == 0 && this.activeList.length)
  570. } else {
  571. if (this.promoFlag == 0) {
  572. this.hideActiveTable = true
  573. }
  574. }
  575. },
  576. // 编辑
  577. handleEdit () {
  578. const row = this.detailData
  579. this.$emit('close')
  580. this.$router.push({ name: 'salesNewEdit', params: { sn: row.salesBillSn, wSn: row.warehouseSn } })
  581. },
  582. // 改单
  583. handleChangeOrder () {
  584. const _this = this
  585. const row = _this.detailData
  586. changeBillCheck({ salesBillSn: row.salesBillSn }).then(res => {
  587. let data
  588. if (res.status == 200) {
  589. data = res.data
  590. if (data && data.length > 0) {
  591. _this.sourceData = res.data
  592. const obj = {
  593. buyerName: row.buyerName,
  594. salesBillNo: row.salesBillNo
  595. }
  596. _this.$refs.tipModal.getShowInfo(obj)
  597. _this.openTipModal = true
  598. } else {
  599. _this.$emit('close')
  600. _this.$router.push({ name: 'salesNewEdit', params: { sn: row.salesBillSn, wSn: row.warehouseSn } })
  601. }
  602. }
  603. })
  604. },
  605. // 改单成功 关闭弹窗
  606. openTipModalOk (ajaxData) {
  607. const row = this.detailData
  608. ajaxData.salesBillSn = row.salesBillSn
  609. ajaxData.detailList = this.sourceData
  610. changeBillCheckUpdatePrice(ajaxData).then(res => {
  611. if (res.status == 200) {
  612. this.$message.success(res.message)
  613. this.openTipModal = false
  614. this.$nextTick(() => {
  615. this.$emit('close')
  616. this.$router.push({ name: 'salesNewEdit', params: { sn: row.salesBillSn, wSn: row.warehouseSn } })
  617. })
  618. }
  619. })
  620. },
  621. // 取消时,跳转编辑页面
  622. closeTipModal () {
  623. this.openTipModal = false
  624. this.$emit('close')
  625. this.$router.push({ name: 'salesNewEdit', params: { sn: this.$route.params.sn || this.bizSn } })
  626. },
  627. // 查询第三方库存
  628. getThreeStock (e) {
  629. this.hideActiveTable = this.activeList.length == 0
  630. this.$refs.productList.showThreeStock(e.target.checked)
  631. if (!this.hideActiveTable) this.$refs.productActiveList.showThreeStock(e.target.checked)
  632. },
  633. // 重置
  634. resetSearchForm () {
  635. this.warehouseSn = undefined
  636. this.promoFlag = undefined
  637. this.transferQty = undefined
  638. this.borrowFlag = undefined
  639. this.searchTable()
  640. },
  641. // 查询数据
  642. searchTable () {
  643. this.hideNormalTable = false
  644. this.hideActiveTable = this.activeList.length == 0
  645. this.spinning = true
  646. this.$nextTick(() => {
  647. this.$refs.productList.searchTable()
  648. if (!this.hideActiveTable) this.$refs.productActiveList.searchTable()
  649. })
  650. },
  651. // 详情
  652. getDetail () {
  653. this.spinning = true
  654. salesDetailBySn({ salesBillSn: this.bizSn || this.$route.params.sn }).then(res => {
  655. if (res.status == 200) {
  656. this.detailData = res.data || null
  657. this.detailData.totalDiscountAmount = Number(this.detailData.totalOrigAmount || 0) - Number(this.detailData.totalAmount || 0)
  658. }
  659. this.getActiveList()
  660. this.getColsOptions()
  661. })
  662. },
  663. // 获取销售单参与的活动列表
  664. async getActiveList () {
  665. // 已参与活动列表
  666. const list = await salesPromoQueryList({ salesBillSn: this.$route.params.sn || this.bizSn }).then(res => res.data || [])
  667. this.activeList = list.filter(item => {
  668. return item.promotion && item.promotionRule && item.enabledFlag == 1
  669. })
  670. this.hideActiveTable = this.activeList.length == 0
  671. // 触发活动统计查询变量
  672. this.$nextTick(() => {
  673. if (!this.hideActiveTable) {
  674. this.$refs.activeTjList.hasInit = false
  675. }
  676. })
  677. this.spinning = false
  678. setTimeout(() => {
  679. this.resetSearchForm()
  680. }, 300)
  681. },
  682. // 打开缺货明细弹框
  683. openStockOut () {
  684. if (this.$refs.productList && this.$refs.productList.outStockStr != '' || this.activeList.length && this.$refs.productActiveList.outStockStr != '') {
  685. this.showStockOut = true
  686. } else {
  687. this.$info({
  688. title: '提示',
  689. content: '此销售单暂无缺货产品!',
  690. centered: true
  691. })
  692. }
  693. },
  694. // 下推
  695. handleDispatch (row) {
  696. this.$emit('close')
  697. this.$router.push({ name: 'waitDispatchNew', params: { salesBillSn: row.salesBillSn } })
  698. },
  699. // 转单
  700. handleOrder () {
  701. const _this = this
  702. if (!_this.selectedDealerSn) {
  703. _this.$message.warning('请选择发货经销商!')
  704. return
  705. }
  706. _this.spinning = true
  707. // 验证
  708. transferVerify({ salesBillSn: _this.$route.params.sn, transferDealerSn: _this.selectedDealerSn }).then(res => {
  709. if (res.status == 200) {
  710. if (res.data && Object.keys(res.data).length) {
  711. _this.$confirm({
  712. title: '提示',
  713. content: <div><strong style="color:#ed1c24;">{res.data.dealerName}</strong>非<strong style="color:#ed1c24;">{res.data.buyerName}</strong>的轮胎上级或省仓,提交后待上级审核通过完成转单</div>,
  714. centered: true,
  715. closable: true,
  716. okText: '提交',
  717. onOk () {
  718. _this.spinning = false
  719. // 验证成功
  720. _this.handleTransfer()
  721. },
  722. onCancel () {
  723. _this.spinning = false
  724. }
  725. })
  726. } else {
  727. this.handleTransfer()
  728. }
  729. }
  730. })
  731. },
  732. // 提交转单
  733. handleTransfer () {
  734. this.spinning = true
  735. transfer({ salesBillSn: this.$route.params.sn, transferDealerSn: this.selectedDealerSn }).then(res => {
  736. if (res.status == 200) {
  737. this.$message.success(res.message)
  738. // 转单成功 关闭详情跳列表
  739. this.handleBack()
  740. }
  741. this.spinning = false
  742. })
  743. },
  744. // 打开 转单审核弹窗
  745. handleTransferAudit () {
  746. this.openTransferOrder = true
  747. },
  748. // 确认转单审核
  749. transferOrderAuditOk (val) {
  750. transferAudit({ salesBillSn: this.$route.params.sn, auditPassFlag: val }).then(res => {
  751. if (res.status == 200) {
  752. this.openTransferOrder = false
  753. this.$message.success(res.message)
  754. // 转单成功 关闭详情跳列表
  755. this.handleBack()
  756. }
  757. })
  758. },
  759. // 打开审核/一键审核弹框
  760. async handleAudit (isBatch) {
  761. const _this = this
  762. this.spinning = true
  763. // 校验产品是否付个促销活动规则
  764. const vaildActive = await salesPromoValidaAudit({ salesBillSn: this.bizSn || this.$route.params.sn }).then(res => res.data)
  765. if (vaildActive && vaildActive.length > 0) {
  766. const a = vaildActive.filter(item => item.type == 1) // 不可提交
  767. const c = vaildActive.filter(item => item.type == 'price_less_0') // 不可提交
  768. const b = vaildActive.filter(item => item.type == 0) // 文字提示,可跳过继续提交
  769. const d = vaildActive.filter(item => item.type == 'price_less_cost' || item.type == 'wait_up_audit_price_less_cost') // 价格校验表格提示,可跳过继续提交
  770. const e = vaildActive.filter(item => item.type == 'allBorrowProductFlag') // 只有累计产品
  771. // 弹出不符合规则弹框,不可提交
  772. if (a.length) {
  773. this.$info({
  774. title: '提示',
  775. centered: true,
  776. class: 'confirm-center',
  777. okText: '关闭',
  778. width: 600,
  779. content: <div style="padding-top:15px;">
  780. <ol>
  781. {a.map(item => (
  782. <li style="padding:3px 0;">{item.message}</li>
  783. ))}
  784. </ol>
  785. <div style="padding:10px 0;text-align:center"><strong>请按照以上提示修改后再提交</strong></div>
  786. </div>
  787. })
  788. _this.spinning = false
  789. return
  790. }
  791. // 不可提交
  792. if (c.length) {
  793. // 弹框显示表格提示
  794. if (!isBatch) {
  795. _this.openVaildPrice(c[0])
  796. } else {
  797. // 弹框文字提示
  798. _this.tempData = { vaildPriceList: c[0].data.map(item => item.productCode) }
  799. _this.verificationSuccess(isBatch)
  800. }
  801. return
  802. }
  803. // 文字提示,可跳过继续提交
  804. if (b.length) {
  805. // 弹出确认提示信息,可跳过继续提交
  806. _this.$confirm({
  807. title: '提示',
  808. centered: true,
  809. class: 'confirm-center',
  810. okText: '确定',
  811. width: 600,
  812. content: <div style="padding-top:15px;">
  813. <ol>
  814. {b.map(item => (
  815. <li style="padding:3px 0;">{item.message}</li>
  816. ))}
  817. </ol>
  818. </div>,
  819. onOk () {
  820. // 只有累计产品
  821. if (e.length) {
  822. _this.onlyBorrowProduct(e)
  823. return
  824. }
  825. // 售价是否低于参考成本价
  826. _this.validPriceLessCost(d, isBatch)
  827. },
  828. onCancel () {
  829. _this.spinning = false
  830. }
  831. })
  832. return
  833. }
  834. // 只有累计产品
  835. if (e.length) {
  836. _this.onlyBorrowProduct(e)
  837. return
  838. }
  839. // 售价是否低于参考成本价
  840. _this.validPriceLessCost(d, isBatch)
  841. } else {
  842. _this.verificationSuccess(isBatch)
  843. }
  844. },
  845. // 只有累计产品弹框
  846. onlyBorrowProduct (e) {
  847. const _this = this
  848. _this.auditText = e[0].message
  849. _this.visibleAudit = true
  850. _this.spinning = false
  851. },
  852. // 售价是否低于参考成本价提示弹框
  853. validPriceLessCost (d, isBatch) {
  854. const _this = this
  855. if (d.length) {
  856. if (isBatch) { // 一键审核,弹框文字提示
  857. _this.tempData = { vaildPriceList: d[0].data.map(item => item.productCode) }
  858. _this.verificationSuccess(isBatch)
  859. } else {
  860. // 审核或上级审核,弹框表格提示
  861. _this.openVaildPrice(d[0])
  862. }
  863. } else {
  864. _this.verificationSuccess(isBatch)
  865. }
  866. },
  867. // 校验销售价低于成本价提示
  868. openVaildPrice (data) {
  869. this.tempData = data
  870. this.openVaildPriceModal = true
  871. },
  872. // 关闭校验销售价低于成本价提示
  873. closeVaildPrice () {
  874. this.spinning = false
  875. this.tempData = null
  876. this.openVaildPriceModal = false
  877. },
  878. // 消息提示
  879. messageInfo (content) {
  880. this.$info({
  881. title: '提示',
  882. content: content,
  883. centered: true,
  884. onOk: () => {
  885. this.spinning = false
  886. }
  887. })
  888. },
  889. // 验证通过
  890. verificationSuccess (isBatch) {
  891. if (isBatch) { // 一键审核
  892. if (this.$refs.productActiveList && this.$refs.productActiveList.hasOutStockOfActive) {
  893. this.messageInfo('参加促销活动的产品存在缺货,不可一键审核!')
  894. return
  895. }
  896. if (this.showConvertPromoGifts) {
  897. this.messageInfo('该活动规则中,促销产品可转费用报销单,不可一键审核!')
  898. return
  899. }
  900. if (this.$refs.productList && this.$refs.productList.hasJGtire || this.$refs.productActiveList && this.$refs.productActiveList.hasJGtire) {
  901. this.messageInfo('销售单内有品牌是【箭冠】,且三级分类是【轮胎】的产品,不可一键审核!')
  902. return
  903. }
  904. if (this.tempData && this.tempData.vaildPriceList) {
  905. this.messageInfo('产品' + this.tempData.vaildPriceList + '售价已低于成本价,不可一键审核!')
  906. return
  907. }
  908. // 一键审核成功
  909. this.showDsModal = true
  910. this.$refs.dsModal.setDetail(this.detailData)
  911. this.spinning = false
  912. } else {
  913. this.auditText = null
  914. this.visibleAudit = true
  915. this.spinning = false
  916. }
  917. },
  918. // 一键审核确定
  919. handleOnceAudit (data) {
  920. const params = {
  921. salesBillSn: this.bizSn || this.$route.params.sn,
  922. billStatus: 'AUDIT_PASS',
  923. dispatchBill: data
  924. }
  925. this.spinningAudit = true
  926. this.spinning = true
  927. salesWriteAuditPush(params).then(res => {
  928. if (res.status == 200) {
  929. this.$message.success(res.message)
  930. // 关闭详情跳列表
  931. this.handleBack()
  932. }
  933. this.spinningAudit = false
  934. this.spinning = false
  935. })
  936. },
  937. // 价格低于成本校验提示,继续审核
  938. vaildPriceOk (type) {
  939. // 审核通过或不通过
  940. if (type == 'AUDIT_PASS' || type == 'AUDIT_REJECT') {
  941. this.auditOrder(type)
  942. return
  943. }
  944. // 上级审核,不通过或通过
  945. if (type == 'AUDIT_UP_PASS' || type == 'AUDIT_UP_REJECT') {
  946. const upFun = type == 'AUDIT_UP_PASS' ? salesWriteUpAuditPass : salesWriteUpAuditReject
  947. this.spinning = true
  948. upFun({
  949. salesBillSn: this.bizSn || this.$route.params.sn,
  950. billStatus: type == 'AUDIT_UP_PASS' ? 'AUDIT_PASS' : undefined
  951. }).then(res => {
  952. if (res.status == 200) {
  953. this.$message.success(res.message)
  954. this.closeVaildPrice()
  955. this.handleBack()
  956. }
  957. this.$refs.vaildPriceModal.spinning = false
  958. this.spinning = false
  959. })
  960. }
  961. },
  962. // 审核
  963. auditOrder (billStatus) {
  964. this.spinningAudit = true
  965. const auditFun = billStatus == 'AUDIT_PASS' ? salesWriteAuditPass : salesWriteAuditReject
  966. auditFun({
  967. salesBillSn: this.bizSn || this.$route.params.sn,
  968. billStatus: billStatus
  969. }).then(res => {
  970. if (res.status == 200) {
  971. this.visibleAudit = false
  972. this.$message.success(res.message)
  973. this.spinningAudit = false
  974. const _this = this
  975. this.closeVaildPrice()
  976. this.$nextTick(() => {
  977. // 审核通过,跳转到带下推页面
  978. if (billStatus == 'AUDIT_PASS' && !_this.auditText) {
  979. _this.$emit('close')
  980. _this.$router.push({ name: 'waitDispatchNew', params: { salesBillSn: _this.bizSn || _this.$route.params.sn } })
  981. } else {
  982. // 不通过关闭详情返回列表
  983. _this.handleBack()
  984. }
  985. })
  986. } else {
  987. this.visibleAudit = false
  988. this.spinningAudit = false
  989. }
  990. })
  991. },
  992. // 打印导出弹框
  993. handlePrint (type, authCode) {
  994. const _this = this
  995. _this.$store.state.app.curActionPermission = authCode
  996. // 销售分类导出
  997. if (type == 'typeExport') {
  998. const params = {
  999. salesBillSn: this.bizSn || this.$route.params.sn
  1000. }
  1001. _this.spinning = true
  1002. exportExcel(salesDetailTypeExcel, params, '销售分类' + moment().format('YYYYMMDDHHmmss'), () => {
  1003. _this.spinning = false
  1004. _this.closePrint()
  1005. })
  1006. } else {
  1007. this.detailData.authCode = authCode
  1008. this.nowType = type
  1009. this.openModal = true
  1010. }
  1011. },
  1012. // 关闭打印弹框
  1013. closePrint () {
  1014. this.$store.state.app.curActionPermission = ''
  1015. this.openModal = false
  1016. },
  1017. // 确定打印或预览,导出
  1018. handleOk (objs) {
  1019. const _this = this
  1020. const params = JSON.parse(JSON.stringify(objs))
  1021. _this.$store.state.app.curActionPermission = this.detailData.authCode
  1022. delete params.type
  1023. _this.spinning = true
  1024. if (this.nowType == 'export') { // 导出
  1025. exportExcel(salesDetailExcel, params, '销售' + moment().format('YYYYMMDDHHmmss'), () => {
  1026. _this.spinning = false
  1027. _this.closePrint()
  1028. })
  1029. } else { // 打印
  1030. const taskName = this.nowType == 'SALES_BILL' ? '销售单' : '销售分类'
  1031. printFun(salesDetailPrint, params, objs.type, taskName, () => {
  1032. _this.spinning = false
  1033. _this.closePrint()
  1034. })
  1035. }
  1036. }
  1037. },
  1038. mounted () {
  1039. if (!this.$store.state.app.isNewTab || this.bizSn) { // 页签刷新时调用
  1040. this.getDetail()
  1041. }
  1042. },
  1043. activated () {
  1044. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  1045. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  1046. this.getDetail()
  1047. }
  1048. },
  1049. beforeRouteEnter (to, from, next) {
  1050. next(vm => {
  1051. vm.fromRouter = from
  1052. vm.authCode = to.meta.permission
  1053. })
  1054. }
  1055. }
  1056. </script>
  1057. <style lang="less">
  1058. .salesDetail-wrap{
  1059. position: relative;
  1060. height: 100%;
  1061. padding-bottom: 45px;
  1062. box-sizing: border-box;
  1063. .empty-data-box{
  1064. width: 100%;
  1065. padding: 10% 30px;
  1066. }
  1067. >.ant-spin-nested-loading{
  1068. overflow-y: auto;
  1069. height: 100%;
  1070. }
  1071. .salesDetail-cont{
  1072. margin-bottom: 6px;
  1073. }
  1074. .active-title{
  1075. display: flex;
  1076. align-items: center;
  1077. justify-content: space-between;
  1078. padding: 10px;
  1079. background: #f3f8fa;
  1080. }
  1081. .flexBox{
  1082. display: flex;
  1083. justify-content: space-between;
  1084. align-items: center;
  1085. }
  1086. .affix-footer-bar{
  1087. text-align: center;
  1088. background: #fff;
  1089. }
  1090. .redStyle{
  1091. font-weight: bold;
  1092. color: red;
  1093. }
  1094. .form-grid{
  1095. display: flex;
  1096. flex:1;
  1097. }
  1098. }
  1099. </style>