queryPart.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. <template>
  2. <div class="productInfoList-wrap">
  3. <!-- 搜索条件 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="searchTable">
  6. <a-row :gutter="15">
  7. <a-col :md="4" :sm="24">
  8. <a-form-item label="产品名称">
  9. <a-input id="productInfoList-name" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :md="4" :sm="24">
  13. <a-form-item label="产品编码">
  14. <a-input id="productInfoList-code" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
  15. </a-form-item>
  16. </a-col>
  17. <a-col :md="4" :sm="24">
  18. <a-form-item label="是否促销品">
  19. <v-select
  20. code="FLAG"
  21. id="productInfoList-promoFlag"
  22. v-model="queryParam.promoFlag"
  23. allowClear
  24. placeholder="请选择是否"
  25. ></v-select>
  26. </a-form-item>
  27. </a-col>
  28. <a-col :md="4" :sm="24">
  29. <a-form-item label="类型">
  30. <a-select v-model.trim="queryParam.ptype" :dropdownMatchSelectWidth="false" >
  31. <a-select-option value="0">
  32. 全部产品
  33. </a-select-option>
  34. <a-select-option value="1">
  35. 剩余待下推数量>0的产品
  36. </a-select-option>
  37. <a-select-option value="2">
  38. 可全部下推的产品
  39. </a-select-option>
  40. <a-select-option value="3">
  41. 不可全部下推的产品
  42. </a-select-option>
  43. </a-select>
  44. </a-form-item>
  45. </a-col>
  46. <a-col :md="4" :sm="24">
  47. <a-form-item label="出库仓库">
  48. <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn"></chooseWarehouse>
  49. </a-form-item>
  50. </a-col>
  51. <a-col :md="4" :sm="24" style="margin-bottom: 10px;">
  52. <a-button type="primary" class="button-info" @click="searchTable" :disabled="disabled" id="productInfoList-refresh">查询</a-button>
  53. <a-button style="margin-left: 5px" @click="resetSearchForm" id="productInfoList-reset">重置</a-button>
  54. </a-col>
  55. </a-row>
  56. </a-form>
  57. </div>
  58. <!-- alert -->
  59. <div style="margin-bottom: 10px;display: flex;align-items: center;" v-if="detailData">
  60. <div style="display: flex;align-items: center;">
  61. <a-button type="primary" :disabled="newLoading" class="button-info" @click="handlePlAdd">批量添加</a-button>
  62. <a-button type="danger" :disabled="newLoading" class="button-error" @click="handlePlCancel">批量取消</a-button>
  63. <span style="margin-left: 10px;" v-if="selectedRowKeys.length">已选 {{ selectedRowKeys.length }} 项</span>
  64. </div>
  65. <div style="padding-left: 20px;">
  66. 总销售数量:<strong>{{ detailData&&(detailData.totalQty || detailData.totalQty==0) ? detailData.totalQty : '--' }}</strong>;
  67. 已取消数量:<strong>{{ detailData&&(detailData.totalCancelQty || detailData.totalCancelQty==0) ? detailData.totalCancelQty : '--' }}</strong>;
  68. 已下推数量:<strong>{{ detailData&&(detailData.totalPushedQty || detailData.totalPushedQty==0) ? detailData.totalPushedQty : '--' }}</strong>;
  69. 待下推数量:<strong>{{ detailData&&(detailData.totalUnpushedQty || detailData.totalUnpushedQty==0) ? detailData.totalUnpushedQty : '--' }}</strong>;
  70. <span v-if="$hasPermissions('B_salesDispatch_salesPrice')">总售价:<strong>{{ detailData&&(detailData.totalAmount || detailData.totalAmount==0) ? toThousands(detailData.totalAmount) : '--' }}</strong>;</span>
  71. <span v-if="$hasPermissions('B_salesDispatch_costPrice')">总成本:<strong>{{ detailData&&(detailData.totalCost || detailData.totalCost==0) ? toThousands(detailData.totalCost) : '--' }}</strong>;</span>
  72. <span v-if="$hasPermissions('B_salesDispatch_costPrice')&&$hasPermissions('B_salesDispatch_salesPrice')">总毛利:<strong>{{ detailData&&(detailData.grossProfit || detailData.grossProfit==0) ? toThousands(detailData.grossProfit) : '--' }}</strong>;</span>
  73. <span v-if="$hasPermissions('B_salesDispatch_salesPrice')">已取消金额:<strong>{{ detailData&&(detailData.totalCancelAmount || detailData.totalCancelAmount==0) ? toThousands(detailData.totalCancelAmount) : '--' }}</strong>;</span>
  74. <span v-if="$hasPermissions('B_salesDispatch_salesPrice')">已下推金额:<strong>{{ detailData&&(detailData.totalPushedAmount || detailData.totalPushedAmount==0) ? toThousands(detailData.totalPushedAmount) :'--' }}</strong>;</span>
  75. <span v-if="$hasPermissions('B_salesDispatch_salesPrice')">待下推金额:<strong>{{ detailData&&(detailData.totalUnpushedAmount || detailData.totalUnpushedAmount==0) ? toThousands(detailData.totalUnpushedAmount) : '--' }}</strong>;</span>
  76. </div>
  77. </div>
  78. <a-spin :spinning="spinning" tip="Loading...">
  79. <ve-table
  80. border-y
  81. v-show="!showEmpty"
  82. :scroll-width="0"
  83. :max-height="tableHeight"
  84. :show-header="showTableHead"
  85. :row-style-option="{clickHighlight: true}"
  86. :cellSelectionOption="{enable: false}"
  87. :virtual-scroll-option="{enable: true}"
  88. :columns="columns"
  89. :table-data="tableData"
  90. row-key-field-name="id"
  91. :cell-style-option="cellStyleOption"
  92. :cell-span-option="cellSpanOption"
  93. :column-width-resize-option="columnWidthResizeOption"
  94. :checkbox-option="checkboxOption"
  95. />
  96. <div v-show="showEmpty" class="empty-data"><a-empty description="暂无产品"/></div>
  97. <!-- 活动规则详情 -->
  98. <detailModal :openModal="openDetailModal" :itemSn="detailSn" @close="closeDetailModal"></detailModal>
  99. </a-spin>
  100. </div>
  101. </template>
  102. <script>
  103. import { commonMixin } from '@/utils/mixin'
  104. import { salesPromoQueryList } from '@/api/salesNew'
  105. import detailModal from '@/views/promotionRulesManagement/dealerPromotions/detailModal.vue'
  106. import { salesDetailAllList, salesPromoDetailCount, salesDetaiCount } from '@/api/salesDetailNew'
  107. import { STable, VSelect } from '@/components'
  108. import chooseWarehouse from '@/views/common/chooseWarehouse'
  109. export default {
  110. name: 'QueryPart',
  111. mixins: [commonMixin],
  112. components: { STable, VSelect, chooseWarehouse, detailModal },
  113. props: {
  114. newLoading: {
  115. type: Boolean,
  116. default: false
  117. },
  118. maxHeight:{
  119. type: [String,Number],
  120. default: '300'
  121. },
  122. showHeader: {
  123. type: Boolean,
  124. default: true
  125. }
  126. },
  127. data () {
  128. return {
  129. advanced: true, // 高级搜索 展开/关闭
  130. openDetailModal: false,
  131. detailSn: null,
  132. productType: [],
  133. salesBillSn: '',
  134. detailData: null,
  135. queryParam: {
  136. ptype: '0', // 类型
  137. productCode: '', // 产品编码
  138. productName: '', // 产品名称
  139. promoFlag: undefined, // 是否促销品
  140. brandSn: undefined, // 产品品牌
  141. productTypeSn1: '', // 产品一级分类
  142. productTypeSn2: '', // 产品二级分类
  143. productTypeSn3: '', // 产品三级分类
  144. salesBillSn: '',
  145. warehouseSn: undefined
  146. },
  147. disabled: false, // 查询、重置按钮是否可操作
  148. activeList: [], // 活动列表
  149. spinning: false,
  150. dataSource: [],
  151. tableData: [],
  152. tableHeight: this.maxHeight,
  153. cellStyleOption: {
  154. bodyCellClass: ({ row, column, rowIndex }) => {
  155. if (row.id.indexOf('promo-')>=0 && column.field === "no") {
  156. return "table-body-cell-no";
  157. }
  158. },
  159. },
  160. columnWidthResizeOption: {
  161. // default false
  162. enable: true,
  163. // column resize min width
  164. minWidth: 50
  165. },
  166. cellSpanOption: {
  167. bodyCellSpan: this.bodyCellSpan,
  168. },
  169. showEmpty: false,
  170. showTableHead: true,
  171. disableSelectedRowKeys: [],
  172. selectedRowKeys: [],
  173. colspanNums: 16
  174. }
  175. },
  176. computed: {
  177. checkboxOption () {
  178. return {
  179. disableSelectedRowKeys: this.disableSelectedRowKeys,
  180. selectedRowKeys: this.selectedRowKeys,
  181. // 行选择改变事件
  182. selectedRowChange: ({ row, isSelected, selectedRowKeys }) => {
  183. this.selectedRowChange({ row, isSelected, selectedRowKeys })
  184. },
  185. // 全选改变事件
  186. selectedAllChange: ({ isSelected, selectedRowKeys }) => {
  187. this.selectedAllChange({ isSelected, selectedRowKeys })
  188. },
  189. }
  190. },
  191. columns () {
  192. const _this = this
  193. const priceFormat = function(data){
  194. return _this.toThousands(data) || '--'
  195. }
  196. const numsFormat = function(data){
  197. return data || data == 0 ? data : '--'
  198. }
  199. const codeFormat = function(record,data,h){
  200. let ftext = ''
  201. let fcolor = ''
  202. if(record.promotionFlag == 'GIFT'){
  203. ftext = '促'
  204. fcolor = '#52c41a'
  205. }
  206. // if(record.promotionFlag == 'REGULAR'){
  207. // ftext = '正'
  208. // fcolor = '#108ee9'
  209. // }
  210. if(record.promotionFlag == 'DISCOUNT'){
  211. ftext = '特'
  212. fcolor = '#faad14'
  213. }
  214. return (
  215. <div>
  216. <span style="padding-right: 15px;">{data}</span>
  217. {ftext?(<a-badge count={ftext} number-style={{ backgroundColor: fcolor, zoom:'80%' }}></a-badge>):''}
  218. {Number(record.stockQty||0) < Number(record.unpushedQty||0)?(<a-badge count="缺" number-style={{ zoom:'80%' }}></a-badge>):''}
  219. </div>
  220. )
  221. }
  222. // 输入框
  223. const inputFormat = function(record,data,h) {
  224. if(record.surplusQty>0){
  225. return (
  226. <div>
  227. <a-input-number
  228. size="small"
  229. value={record.cancelNums}
  230. onChange={e => _this.cancelNumsChange(e,record)}
  231. precision={0}
  232. min={0}
  233. max={record.surplusQty}
  234. style="width: 100%;"
  235. placeholder="请输入" />
  236. </div>
  237. )
  238. }
  239. return '--'
  240. }
  241. // 操作按钮
  242. const actionFormat = function(record,data,h) {
  243. if(record.surplusQty>0){
  244. return (
  245. <div>
  246. <a-button
  247. size="small"
  248. type="link"
  249. class="button-info"
  250. onClick={()=>_this.handleAdd(record)}
  251. >添加</a-button>
  252. </div>
  253. )
  254. }
  255. return '--'
  256. }
  257. // 编号,并且格式化活动分类行
  258. const noFormat = function(record,data,h){
  259. return (
  260. <div>
  261. {record.id.indexOf('promo-')>=0 ? (
  262. <div class="active-title">
  263. {record.promo?(
  264. <div>
  265. <strong style="margin-right:10px;font-size:14px;">{record.promo.promotion.title} ({record.promo.promotionRule.description})</strong>
  266. <span style="margin-left:10px;color:#00aaff;cursor: pointer;" onClick={()=>_this.showDesc(record.promo)}>
  267. <a-icon title="查看活动详情" type="eye"/> 活动详情
  268. </span>
  269. </div>
  270. ):(<div></div>)}
  271. <div>
  272. 款数:<strong>{record.total&&record.total.totalCategory||'--'}</strong>;
  273. 数量:<strong>{record.total&&record.total.totalQty||'--'}</strong>;
  274. {_this.$hasPermissions('B_salesEdit_salesPrice') ? (<span>总金额:<strong>{record.total&&record.total.totalAmount||'--'}</strong>;</span>):('')}
  275. {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total&&record.total.lossAmount ? (<span>优惠金额:<strong>{record.total.lossAmount}</strong>;</span>):('')}
  276. {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total&&record.total.cgejyAmount ? (<span>采购额结余:<strong>{_this.toThousands(record.total.cgejyAmount)}</strong>;</span>):('')}
  277. {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total&&record.total.cgeccAmount ? (<span>采购额超出:<strong>{_this.toThousands(record.total.cgeccAmount)}</strong>;</span>):('')}
  278. {record.expenseAccountFlag!='WAIT' ? record.expenseAccountFlagDictValue : ''}
  279. </div>
  280. </div>
  281. ):(<span>{data}</span>)}
  282. </div>
  283. )
  284. }
  285. let arr= [
  286. { title: "", field: "", key: "acheck", type: "checkbox", align: "center" },
  287. { title: '序号', field: 'no',key: "a", width: 50, align: 'center', operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return noFormat(row,row[column.field],h)} },
  288. { title: '产品编码', field: 'productCode',key: "b", width: 150, align: 'center',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return codeFormat(row,row[column.field],h)} },
  289. { title: '产品名称', field: 'productName',key: "c", width: 250, align: 'center',operationColumn: false , ellipsis: { showTitle: true },renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}},
  290. { title: '原厂编码', field: 'productOrigCode',key: "d", width: 150, align: 'center',operationColumn: false,ellipsis: { showTitle: true },renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'} },
  291. { title: '出库仓库', field: 'warehouseName',key: "e", width: 100, align: 'center',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}}
  292. ]
  293. this.colspanNums = 6
  294. if (this.$hasPermissions('B_salesDispatch_salesPrice')) { // 售价权限
  295. this.colspanNums = this.colspanNums + 1
  296. arr.push({ title: '销售价', field: 'price', width: 80,key: "f", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} })
  297. }
  298. if (this.$hasPermissions('B_salesDispatch_costPrice')) {
  299. this.colspanNums = this.colspanNums + 1
  300. arr.push({ title: '成本价', field: 'showCost', width: 80,key: "g", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} })
  301. }
  302. this.colspanNums = this.colspanNums + 8
  303. arr = arr.concat([
  304. { title: '单位', field: 'productOrigUnit',key: "i", width: 80, align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}},
  305. { title: '可用库存', field: 'stockQty', width: 80,key: "j", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
  306. { title: '销售数量', field: 'qty', width: 80,key: "k", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
  307. { title: '已取消', field: 'cancelQty', width: 80,key: "o", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
  308. { title: '已下推', field: 'pushedQty', width: 80,key: "p", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
  309. { title: '待下推', field: 'surplusQty', width: 80,key: "q", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
  310. { title: '取消数量', field: 'surplusQty', width: 80,key: "r", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return inputFormat(row,row[column.field],h)} },
  311. { title: '操作', field: 'action', width: 80,key: "s", align: 'center',fixed: 'right',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return actionFormat(row,row[column.field],h)} },
  312. ])
  313. return arr
  314. }
  315. },
  316. methods: {
  317. // 查看活动详情
  318. showDesc(row){
  319. this.detailSn = row.promoRuleSn
  320. this.openDetailModal = true
  321. },
  322. // 关闭详情弹窗
  323. closeDetailModal () {
  324. this.detailSn = null
  325. this.openDetailModal = false
  326. },
  327. // 合并活动分类单元格
  328. bodyCellSpan({ row, column, rowIndex }) {
  329. if (row.id.indexOf('promo-')>=0) {
  330. if(column.field=='no'){
  331. return {
  332. rowspan: 1,
  333. colspan: this.colspanNums,
  334. };
  335. }else{
  336. return {
  337. rowspan: 0,
  338. colspan: 0,
  339. }
  340. }
  341. }
  342. },
  343. cancelNumsChange(v,record){
  344. record.cancelNums = v
  345. this.dataSource.splice()
  346. },
  347. // 选择单元格
  348. selectedRowChange({ row, isSelected, selectedRowKeys }){
  349. // console.log(row, isSelected, selectedRowKeys);
  350. this.selectedRowKeys = selectedRowKeys;
  351. },
  352. // 全选行
  353. selectedAllChange({ isSelected, selectedRowKeys }){
  354. // console.log(isSelected, selectedRowKeys);
  355. this.selectedRowKeys = selectedRowKeys;
  356. },
  357. // 获取销售单参与的活动列表
  358. getActiveList(){
  359. salesPromoQueryList({ salesBillSn: this.salesBillSn }).then(res => {
  360. if(res.status == 200){
  361. this.activeList = res.data || []
  362. }
  363. this.$nextTick(()=>{
  364. this.searchTable()
  365. })
  366. })
  367. },
  368. async searchTable(){
  369. this.selectedRowKeys = []
  370. this.disableSelectedRowKeys = []
  371. this.dataSource = []
  372. this.disabled = true
  373. this.spinning = true
  374. this.queryParam.salesBillSn = this.salesBillSn
  375. this.queryParam.showStock = true
  376. const params = this.queryParam
  377. const active = this.activeList
  378. // 正常产品
  379. const proList = await salesDetailAllList(params).then(res => res.data)
  380. const norTotal = await salesDetaiCount(params).then(res => res.data)
  381. //没有活动时不显示统计
  382. let listData = active.length ? [{
  383. id: 'promo-normal',
  384. total: norTotal
  385. },...proList] : proList
  386. // 循环获取活动产品
  387. for(let i=0;i<active.length;i++){
  388. const promo = active[i]
  389. const activeParams = {
  390. promoRuleSn: promo.promoRuleSn,
  391. promoSn: promo.promoSn,
  392. salesPromoSn: promo.salesPromoSn,
  393. ...params
  394. }
  395. // 获取活动产品列表
  396. const aclist = await salesDetailAllList(activeParams).then(res => res.data)
  397. // 获取活动产品统计
  398. const acTotal = await salesPromoDetailCount(activeParams).then(res => res.data)
  399. // 采购额结余
  400. acTotal.cgejyAmount = Number(acTotal.totalPromoGiftsAmount) - Number(acTotal.totalUsePromoGiftsAmount)
  401. // 采购额超出
  402. acTotal.cgeccAmount = Number(acTotal.totalUsePromoGiftsAmount) - Number(acTotal.totalPromoGiftsAmount)
  403. const retList = [{
  404. id: 'promo-'+i,
  405. promo: promo,
  406. total: acTotal
  407. },...aclist]
  408. listData = aclist&&aclist.length ? listData.concat(retList) : listData
  409. }
  410. console.log(listData)
  411. this.dataSource = listData
  412. // 格式化数据
  413. let f = 0
  414. this.dataSource.map((item,i) => {
  415. if(item.id.indexOf('promo-')>=0){f = f - 1}
  416. item.no = i + 1 + f
  417. const productCode = (item.productEntity && item.productEntity.code) || (item.dealerProductEntity && item.dealerProductEntity.code)
  418. const productName = (item.productEntity && item.productEntity.name) || (item.dealerProductEntity && item.dealerProductEntity.name)
  419. const productOrigCode = (item.productEntity && item.productEntity.origCode) || (item.dealerProductEntity && item.dealerProductEntity.origCode)
  420. const productOrigUnit = (item.productEntity && item.productEntity.unit) || (item.dealerProductEntity && item.dealerProductEntity.unit)
  421. item.productCode = productCode || '--'
  422. item.productName = productName || '--'
  423. item.productOrigCode = productOrigCode == ' ' ? '--' : productOrigCode
  424. item.productOrigUnit = productOrigUnit || '--'
  425. item.cancelNums = item.surplusQty
  426. // 库存为0或待下推数为0,不可添加
  427. if(!item.surplusQty || item.surplusQty<0){
  428. this.disableSelectedRowKeys.push(item.id)
  429. }
  430. })
  431. this.showEmpty = this.dataSource.length <= 0
  432. this.tableHeight = (this.showEmpty ? 200 : this.maxHeight) + 'px'
  433. this.tableData = this.dataSource
  434. this.spinning = false
  435. this.disabled = false
  436. },
  437. // 重置
  438. resetSearchForm () {
  439. this.queryParam.ptype = '0'
  440. this.queryParam.productCode = ''
  441. this.queryParam.productName = ''
  442. this.queryParam.promotionFlag = undefined
  443. this.queryParam.brandSn = undefined
  444. this.queryParam.productTypeSn1 = ''
  445. this.queryParam.productTypeSn2 = ''
  446. this.queryParam.productTypeSn3 = ''
  447. this.queryParam.warehouseSn = undefined
  448. this.queryParam.promoFlag = undefined
  449. this.productType = []
  450. this.dataSource = []
  451. this.clearSelectTable()
  452. this.searchTable()
  453. },
  454. pageInit (salesBillSn, detailData) {
  455. this.salesBillSn = salesBillSn
  456. this.detailData = detailData
  457. // 获取活动列表
  458. this.getActiveList()
  459. },
  460. // 清空选项
  461. clearSelectTable () {
  462. this.selectedRowKeys = []
  463. },
  464. // 添加
  465. handleAdd (row) {
  466. if (row.stockQty > 0) { // 可用库存大于0才可添加
  467. this.$emit('addProduct', [row.salesBillDetailSn])
  468. } else {
  469. this.$message.warning('库存为0,不可添加!')
  470. }
  471. },
  472. // 批量添加
  473. handlePlAdd () {
  474. const _this = this
  475. const chooseList = this.selectedRowKeys
  476. if (chooseList.length == 0) {
  477. _this.$message.warning('请先选择产品!')
  478. return
  479. }
  480. const chooseRow = this.dataSource.filter(item => chooseList.includes(item.id) && item.id.indexOf('promo-')<0)
  481. const obj = []
  482. chooseRow && chooseRow.map(item => {
  483. if (item.stockQty > 0) {
  484. obj.push(item.salesBillDetailSn)
  485. }
  486. })
  487. this.$confirm({
  488. title: '提示',
  489. content: '确认要批量添加到待下推列表吗?',
  490. centered: true,
  491. closable: true,
  492. onOk () {
  493. _this.$emit('addProduct', obj)
  494. }
  495. })
  496. },
  497. // 批量取消
  498. handlePlCancel () {
  499. const _this = this
  500. const chooseList = this.selectedRowKeys
  501. if (chooseList.length == 0) {
  502. _this.$message.warning('请先选择产品!')
  503. return
  504. }
  505. const chooseRow = this.dataSource.filter(item => chooseList.includes(item.id) && item.id.indexOf('promo-')<0)
  506. const obj = []
  507. chooseRow && chooseRow.map(item => {
  508. obj.push({
  509. 'cancelQty': item.cancelNums,
  510. 'salesBillDetailSn': item.salesBillDetailSn
  511. })
  512. })
  513. this.$emit('cancelProduct', obj)
  514. }
  515. }
  516. }
  517. </script>
  518. <style lang="less">
  519. .empty-data{
  520. color: #999;
  521. text-align: center;
  522. padding: 20px;
  523. }
  524. .ve-table-body-td{
  525. .active-title{
  526. display: flex;
  527. align-items: center;
  528. justify-content: space-between;
  529. padding: 10px;
  530. background: #f3f8fa;
  531. }
  532. }
  533. .ve-table .ve-table-container .ve-table-content-wrapper table.ve-table-content tbody.ve-table-body tr.ve-table-body-tr td.table-body-cell-no,
  534. .ve-table .ve-table-container .ve-table-content-wrapper table.ve-table-content tbody.ve-table-body tr.ve-table-expand-tr td.table-body-cell-no{
  535. padding: 0;
  536. }
  537. .ve-table .ve-table-container .ve-table-content-wrapper{
  538. border-bottom: 1px solid #ddd;
  539. }
  540. </style>