detail.vue 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086
  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.totalUsePromoGiftsAmount" style="color: red;">优惠金额:<strong>{{ Number(detailData.totalUsePromoGiftsAmount).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. _this.verificationSuccess(isBatch)
  821. },
  822. onCancel () {
  823. _this.spinning = false
  824. }
  825. })
  826. return
  827. }
  828. // 只有累计产品
  829. if (e.length) {
  830. _this.auditText = e[0].message
  831. _this.visibleAudit = true
  832. _this.spinning = false
  833. return
  834. }
  835. // 售价是否低于参考成本价
  836. if (d.length) {
  837. if (isBatch) { // 一键审核,弹框文字提示
  838. _this.tempData = { vaildPriceList: d[0].data.map(item => item.productCode) }
  839. _this.verificationSuccess(isBatch)
  840. } else {
  841. // 审核或上级审核,弹框表格提示
  842. _this.openVaildPrice(d[0])
  843. }
  844. } else {
  845. _this.verificationSuccess(isBatch)
  846. }
  847. } else {
  848. _this.verificationSuccess(isBatch)
  849. }
  850. },
  851. // 校验销售价低于成本价提示
  852. openVaildPrice (data) {
  853. this.tempData = data
  854. this.openVaildPriceModal = true
  855. },
  856. // 关闭校验销售价低于成本价提示
  857. closeVaildPrice () {
  858. this.spinning = false
  859. this.tempData = null
  860. this.openVaildPriceModal = false
  861. },
  862. // 消息提示
  863. messageInfo (content) {
  864. this.$info({
  865. title: '提示',
  866. content: content,
  867. centered: true,
  868. onOk: () => {
  869. this.spinning = false
  870. }
  871. })
  872. },
  873. // 验证通过
  874. verificationSuccess (isBatch) {
  875. if (isBatch) { // 一键审核
  876. if (this.$refs.productActiveList && this.$refs.productActiveList.hasOutStockOfActive) {
  877. this.messageInfo('参加促销活动的产品存在缺货,不可一键审核!')
  878. return
  879. }
  880. if (this.showConvertPromoGifts) {
  881. this.messageInfo('该活动规则中,促销产品可转费用报销单,不可一键审核!')
  882. return
  883. }
  884. if (this.$refs.productList && this.$refs.productList.hasJGtire || this.$refs.productActiveList && this.$refs.productActiveList.hasJGtire) {
  885. this.messageInfo('销售单内有品牌是【箭冠】,且三级分类是【轮胎】的产品,不可一键审核!')
  886. return
  887. }
  888. if (this.tempData && this.tempData.vaildPriceList) {
  889. this.messageInfo('产品' + this.tempData.vaildPriceList + '售价已低于成本价,不可一键审核!')
  890. return
  891. }
  892. // 一键审核成功
  893. this.showDsModal = true
  894. this.$refs.dsModal.setDetail(this.detailData)
  895. this.spinning = false
  896. } else {
  897. this.auditText = null
  898. this.visibleAudit = true
  899. this.spinning = false
  900. }
  901. },
  902. // 一键审核确定
  903. handleOnceAudit (data) {
  904. const params = {
  905. salesBillSn: this.bizSn || this.$route.params.sn,
  906. billStatus: 'AUDIT_PASS',
  907. dispatchBill: data
  908. }
  909. this.spinningAudit = true
  910. this.spinning = true
  911. salesWriteAuditPush(params).then(res => {
  912. if (res.status == 200) {
  913. this.$message.success(res.message)
  914. // 关闭详情跳列表
  915. this.handleBack()
  916. }
  917. this.spinningAudit = false
  918. this.spinning = false
  919. })
  920. },
  921. // 价格低于成本校验提示,继续审核
  922. vaildPriceOk (type) {
  923. // 审核通过或不通过
  924. if (type == 'AUDIT_PASS' || type == 'AUDIT_REJECT') {
  925. this.auditOrder(type)
  926. return
  927. }
  928. // 上级审核,不通过或通过
  929. if (type == 'AUDIT_UP_PASS' || type == 'AUDIT_UP_REJECT') {
  930. const upFun = type == 'AUDIT_UP_PASS' ? salesWriteUpAuditPass : salesWriteUpAuditReject
  931. this.spinning = true
  932. upFun({
  933. salesBillSn: this.bizSn || this.$route.params.sn,
  934. billStatus: type == 'AUDIT_UP_PASS' ? 'AUDIT_PASS' : undefined
  935. }).then(res => {
  936. if (res.status == 200) {
  937. this.$message.success(res.message)
  938. this.closeVaildPrice()
  939. this.handleBack()
  940. }
  941. this.$refs.vaildPriceModal.spinning = false
  942. this.spinning = false
  943. })
  944. }
  945. },
  946. // 审核
  947. auditOrder (billStatus) {
  948. this.spinningAudit = true
  949. const auditFun = billStatus == 'AUDIT_PASS' ? salesWriteAuditPass : salesWriteAuditReject
  950. auditFun({
  951. salesBillSn: this.bizSn || this.$route.params.sn,
  952. billStatus: billStatus
  953. }).then(res => {
  954. if (res.status == 200) {
  955. this.visibleAudit = false
  956. this.$message.success(res.message)
  957. this.spinningAudit = false
  958. const _this = this
  959. this.closeVaildPrice()
  960. this.$nextTick(() => {
  961. // 审核通过,跳转到带下推页面
  962. if (billStatus == 'AUDIT_PASS' && !_this.auditText) {
  963. _this.$emit('close')
  964. _this.$router.push({ name: 'waitDispatchNew', params: { salesBillSn: _this.bizSn || _this.$route.params.sn } })
  965. } else {
  966. // 不通过关闭详情返回列表
  967. _this.handleBack()
  968. }
  969. })
  970. } else {
  971. this.visibleAudit = false
  972. this.spinningAudit = false
  973. }
  974. })
  975. },
  976. // 打印导出弹框
  977. handlePrint (type, authCode) {
  978. const _this = this
  979. _this.$store.state.app.curActionPermission = authCode
  980. // 销售分类导出
  981. if (type == 'typeExport') {
  982. const params = {
  983. salesBillSn: this.bizSn || this.$route.params.sn
  984. }
  985. _this.spinning = true
  986. exportExcel(salesDetailTypeExcel, params, '销售分类' + moment().format('YYYYMMDDHHmmss'), () => {
  987. _this.spinning = false
  988. _this.closePrint()
  989. })
  990. } else {
  991. this.detailData.authCode = authCode
  992. this.nowType = type
  993. this.openModal = true
  994. }
  995. },
  996. // 关闭打印弹框
  997. closePrint () {
  998. this.$store.state.app.curActionPermission = ''
  999. this.openModal = false
  1000. },
  1001. // 确定打印或预览,导出
  1002. handleOk (objs) {
  1003. const _this = this
  1004. const params = JSON.parse(JSON.stringify(objs))
  1005. _this.$store.state.app.curActionPermission = this.detailData.authCode
  1006. delete params.type
  1007. _this.spinning = true
  1008. if (this.nowType == 'export') { // 导出
  1009. exportExcel(salesDetailExcel, params, '销售' + moment().format('YYYYMMDDHHmmss'), () => {
  1010. _this.spinning = false
  1011. _this.closePrint()
  1012. })
  1013. } else { // 打印
  1014. const taskName = this.nowType == 'SALES_BILL' ? '销售单' : '销售分类'
  1015. printFun(salesDetailPrint, params, objs.type, taskName, () => {
  1016. _this.spinning = false
  1017. _this.closePrint()
  1018. })
  1019. }
  1020. }
  1021. },
  1022. mounted () {
  1023. if (!this.$store.state.app.isNewTab || this.bizSn) { // 页签刷新时调用
  1024. this.getDetail()
  1025. }
  1026. },
  1027. activated () {
  1028. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  1029. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  1030. this.getDetail()
  1031. }
  1032. },
  1033. beforeRouteEnter (to, from, next) {
  1034. next(vm => {
  1035. vm.fromRouter = from
  1036. vm.authCode = to.meta.permission
  1037. })
  1038. }
  1039. }
  1040. </script>
  1041. <style lang="less">
  1042. .salesDetail-wrap{
  1043. position: relative;
  1044. height: 100%;
  1045. padding-bottom: 45px;
  1046. box-sizing: border-box;
  1047. .empty-data-box{
  1048. width: 100%;
  1049. padding: 10% 30px;
  1050. }
  1051. >.ant-spin-nested-loading{
  1052. overflow-y: auto;
  1053. height: 100%;
  1054. }
  1055. .salesDetail-cont{
  1056. margin-bottom: 6px;
  1057. }
  1058. .active-title{
  1059. display: flex;
  1060. align-items: center;
  1061. justify-content: space-between;
  1062. padding: 10px;
  1063. background: #f3f8fa;
  1064. }
  1065. .flexBox{
  1066. display: flex;
  1067. justify-content: space-between;
  1068. align-items: center;
  1069. }
  1070. .affix-footer-bar{
  1071. text-align: center;
  1072. background: #fff;
  1073. }
  1074. .redStyle{
  1075. font-weight: bold;
  1076. color: red;
  1077. }
  1078. .form-grid{
  1079. display: flex;
  1080. flex:1;
  1081. }
  1082. }
  1083. </style>