detail.vue 47 KB

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