productList.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. <template>
  2. <div>
  3. <div class="table-page-search-wrapper" v-show="showDescBox&&descDetail">
  4. <a-descriptions :column="4">
  5. <a-descriptions-item label="促销类型">
  6. {{ descDetail.promotionRuleTypeDictValue }}
  7. </a-descriptions-item>
  8. <a-descriptions-item label="促销门槛" span="3">
  9. <div v-if="descDetail.gateFlag === '1'">
  10. <span v-if="descDetail.gateType==='RATIO_AMOUNT'">
  11. 购买门槛产品金额{{ descDetail.gateAmount*100 }}%作为配额
  12. </span>
  13. <span v-else-if="descDetail.gateType==='MIN_AMOUNT'">
  14. 购买门槛产品满最低金额{{ descDetail.gateAmount }}不限制配额。
  15. </span>
  16. <span v-else>购买满{{ descDetail.gateAmount }}元门槛产品,可使用 {{ descDetail.quotaAmount }}元配额,采购规则中的正价商品</span>
  17. </div>
  18. <span v-else>--</span>
  19. </a-descriptions-item>
  20. <a-descriptions-item label="促销规则">
  21. <div v-if="descDetail.promotionRuleType == 'BUY_PROD_GIVE_PROD'">
  22. 购买满{{ descDetail.regularQty }}个正价产品,送{{ descDetail.promotionQty }}个促销产品
  23. </div>
  24. <div v-else-if="descDetail.promotionRuleType == 'BUY_PROD_GIVE_MONEY'">
  25. 购买满{{ descDetail.regularAmount }}元正价产品,送{{ descDetail.giveAmount }}元促销品采购额
  26. </div>
  27. <div v-else>
  28. 特价产品
  29. </div>
  30. </a-descriptions-item>
  31. <a-descriptions-item label="显示正价产品款数">
  32. 40
  33. </a-descriptions-item>
  34. <a-descriptions-item label="订单起订金额">
  35. {{ descDetail.minOrderAmount }}
  36. </a-descriptions-item>
  37. <a-descriptions-item label="活动经费上线">
  38. {{ descDetail.upperLimitAmount }}
  39. </a-descriptions-item>
  40. </a-descriptions>
  41. </div>
  42. <!-- 筛选条件 -->
  43. <div class="table-page-search-wrapper" style="margin:0" v-show="showSearchBox">
  44. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  45. <a-row :gutter="15">
  46. <a-col :md="4" :sm="24">
  47. <a-form-item label="出库仓库" prop="warehouseSn">
  48. <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn" @load="warehouseLoad"></chooseWarehouse>
  49. </a-form-item>
  50. </a-col>
  51. <a-col :md="4" :sm="24">
  52. <a-form-item label="产品编码" prop="productCode">
  53. <a-input id="salesEdit-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
  54. </a-form-item>
  55. </a-col>
  56. <a-col :md="4" :sm="24">
  57. <a-form-item label="产品名称" prop="productName">
  58. <a-input id="salesEdit-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
  59. </a-form-item>
  60. </a-col>
  61. <a-col :md="4" :sm="24">
  62. <a-form-item label="品牌">
  63. <ProductBrand id="salesEdit-productBrandSn" v-model="queryParam.productBrandSn"></ProductBrand>
  64. </a-form-item>
  65. </a-col>
  66. <a-col :md="4" :sm="24">
  67. <a-form-item label="产品分类">
  68. <productTypeAll placeholder="请选择产品分类" @change="changeProductType" v-model="productType" id="salesEdit-productType"></productTypeAll>
  69. </a-form-item>
  70. </a-col>
  71. <a-col :md="4" :sm="24" style="margin-bottom: 10px;">
  72. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="salesEdit-refresh">查询</a-button>
  73. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesEdit-reset">重置</a-button>
  74. </a-col>
  75. </a-row>
  76. </a-form>
  77. </div>
  78. <div class="table-page-search-wrapper">
  79. <a-row :gutter="15" type="flex" justify="space-between" align="middle">
  80. <a-col :md="12" :sm="24" style="text-align:left;">
  81. <a-dropdown>
  82. <a-menu slot="overlay" @click="handleMenuClick">
  83. <a-menu-item key="0">
  84. 仓库设置
  85. </a-menu-item>
  86. <a-menu-item key="1">
  87. 删除已选项
  88. </a-menu-item>
  89. <a-menu-item key="2">
  90. 全部删除
  91. </a-menu-item>
  92. </a-menu>
  93. <a-button
  94. type="default"
  95. class="button-info"
  96. > 批量操作 <a-icon type="down" /> </a-button>
  97. </a-dropdown>
  98. <span v-if="selectTotal" style="margin-left:5px;">已选{{ selectTotal }}项</span>
  99. </a-col>
  100. <a-col :md="12" :sm="24" style="text-align:right;">
  101. <a-button
  102. type="link"
  103. class="button-info"
  104. @click="showSearchBox=!showSearchBox" ><a-icon type="search"/> 筛选</a-button>
  105. <a-dropdown>
  106. <a-menu slot="overlay" @click="handleImportClick">
  107. <a-menu-item key="0">
  108. 导入门槛产品
  109. </a-menu-item>
  110. <a-menu-item key="1">
  111. 导入正价产品
  112. </a-menu-item>
  113. <a-menu-item key="2">
  114. 导入促销产品
  115. </a-menu-item>
  116. </a-menu>
  117. <a-button
  118. type="link"
  119. class="button-info"
  120. > 导入产品 <a-icon type="down" /> </a-button>
  121. </a-dropdown>
  122. <a-button
  123. type="link"
  124. class="button-info"
  125. @click="openCpModal"><a-icon type="plus" /> 添加产品</a-button>
  126. </a-col>
  127. </a-row>
  128. </div>
  129. <!-- 已选配件列表 -->
  130. <s-table
  131. class="sTable"
  132. ref="table"
  133. size="small"
  134. :rowKey="(record) => record.id"
  135. :columns="columns"
  136. :data="loadData"
  137. :row-selection="{ columnWidth: 40 }"
  138. @rowSelection="rowSelectionFun"
  139. :pageSize="10"
  140. bordered>
  141. <!-- 产品编码 -->
  142. <template slot="productCode" slot-scope="text, record">
  143. <a-badge count="缺" v-if="Number(record.stockQty||0) < Number(record.unpushedQty||0)">
  144. <div style="padding-right: 15px;">{{ text }}</div>
  145. </a-badge>
  146. <span v-if="!(Number(record.stockQty||0) < Number(record.unpushedQty||0))">{{ text }}</span>
  147. </template>
  148. <!-- 产品名称 -->
  149. <template slot="productName" slot-scope="text, record">
  150. <div class="ellipsisCon">
  151. <a-tooltip placement="rightBottom">
  152. <template slot="title">
  153. <span>{{ text }}</span>
  154. </template>
  155. <span class="ellipsisText">{{ text }}</span>
  156. </a-tooltip>
  157. <a-badge :number-style="{ backgroundColor: '#52c41a' }" count="活动" v-if="record.promotableFlag == 1"></a-badge>
  158. </div>
  159. </template>
  160. <!-- 销售数量 -->
  161. <template slot="salesNums" slot-scope="text, record">
  162. <a-input-number
  163. id="salesEdit-qty"
  164. size="small"
  165. v-model="record.qty"
  166. :precision="0"
  167. :min="1"
  168. :max="999999"
  169. placeholder="请输入"
  170. @blur="e => onCellBlur(e.target.value, record)"
  171. style="width: 100%;" />
  172. </template>
  173. <!-- 当前库存 -->
  174. <template slot="stockQty" slot-scope="text, record">
  175. <div v-if="record.stockQty || record.stockQty==0">
  176. <p style="margin: 0;" v-if="Number(record.stockQty) < Number(record.unpushedQty)">{{ record.stockQty }}(<span class="redStyle">缺{{ Number(record.unpushedQty||0) - Number(record.stockQty||0) }}</span>)</p>
  177. <p style="margin: 0;" v-else>{{ record.stockQty }}</p>
  178. </div>
  179. <span v-else>--</span>
  180. </template>
  181. <!-- 出库仓库 -->
  182. <template slot="warehouseBox" slot-scope="text, record">
  183. <a-select
  184. size="small"
  185. style="width:100%;"
  186. placeholder="请选择仓库"
  187. v-model="record.warehouseSn"
  188. :showSearch="true"
  189. @change="handleWarehouseBox(record)"
  190. mode="default"
  191. :filter-option="filterOption">
  192. <a-select-option v-for="item in warehouseDataList" :key="item.warehouseSn" :value="item.warehouseSn">{{ item.name }}</a-select-option>
  193. </a-select>
  194. </template>
  195. <!-- 操作 -->
  196. <template slot="action" slot-scope="text, record">
  197. <a-button
  198. size="small"
  199. type="link"
  200. :loading="delLoading"
  201. class="button-error"
  202. @click="handleDel(record)"
  203. >删除</a-button>
  204. <a-button
  205. size="small"
  206. type="link"
  207. :loading="delLoading"
  208. class="button-primary"
  209. @click="handleUpdateActive(record)"
  210. >换促销</a-button>
  211. </template>
  212. <template slot="footer" slot-scope="currentPageData">
  213. <!-- 总计 -->
  214. <a-alert type="info" banner :showIcon="false">
  215. <div slot="message" class="alert-bar">
  216. <div>
  217. 还需门槛产品金额1000/4000(5000),已选择0元(可使用8000元配额)正价产品,已选择8个正价产品(满10送2),<strong>再满2件产品,可享受优惠</strong>,差200元到订单起订金额(1800元),可选择4个促销产品,已选择2个促销产品
  218. </div>
  219. <div>
  220. <div v-if="$hasPermissions('B_salesEdit_salesPrice')">总金额:<strong>{{ detailData&&(detailData.totalCommonAmount || detailData.totalCommonAmount==0) ? toThousands(detailData.totalCommonAmount) : '--' }}</strong></div>
  221. <div v-if="$hasPermissions('B_salesEdit_salesPrice')">优惠金额:<strong>{{ detailData&&(detailData.totalCommonAmount || detailData.totalCommonAmount==0) ? toThousands(detailData.totalCommonAmount) : '--' }}</strong></div>
  222. </div>
  223. </div>
  224. </a-alert>
  225. </template>
  226. </s-table>
  227. <!-- 导入产品 -->
  228. <importGuideModal :openModal="openGuideModal" :params="{salesBillSn: $route.params.sn}" @close="closeGuideModel" @ok="hanldeImportOk" />
  229. <!-- 仓库设置 -->
  230. <setWarehouse :show="openWarehouseModal" @ok="chooseWarehouseOk" @cancel="openWarehouseModal=false"></setWarehouse>
  231. <!-- 换促销 -->
  232. <updateActiveModal :show="openUpActiveModal" @ok="upActiveOk" @cancel="openUpActiveModal=false"></updateActiveModal>
  233. </div>
  234. </template>
  235. <script>
  236. import { commonMixin } from '@/utils/mixin'
  237. import { STable, VSelect } from '@/components'
  238. import ImportGuideModal from './importGuideModal.vue'
  239. import setWarehouse from './setWarehouse.vue'
  240. import updateActiveModal from './updateActiveModal.vue'
  241. import chooseWarehouse from '@/views/common/chooseWarehouse'
  242. import ProductBrand from '@/views/common/productBrand.js'
  243. import productTypeAll from '@/views/common/productTypeAll.js'
  244. import { salesDetailList, salesDetailInsert, salesDetailUpdateQty, salesDetailDel, salesDetailBatchDel, deleteAll, updateWarehouse, salesBatchInsert } from '@/api/salesDetailNew'
  245. export default {
  246. name: 'ProductList',
  247. mixins: [commonMixin],
  248. components: {
  249. STable,
  250. VSelect,
  251. ImportGuideModal,
  252. chooseWarehouse,
  253. setWarehouse,
  254. ProductBrand,
  255. productTypeAll,
  256. updateActiveModal
  257. },
  258. props: {
  259. openModal: { // 弹框显示状态
  260. type: Boolean,
  261. default: false
  262. },
  263. newLoading: Boolean,
  264. detailData: {
  265. type: Object,
  266. default: function(){return null}
  267. },
  268. id: {
  269. type: String,
  270. default: ''
  271. },
  272. warehouseSn: {
  273. type: String,
  274. default: ''
  275. },
  276. salesBillSn: {
  277. type: String,
  278. default: ''
  279. }
  280. },
  281. data () {
  282. return {
  283. spinning: false,
  284. // 加载数据方法 必须为 Promise 对象
  285. loadData: parameter => {
  286. this.disabled = true
  287. this.queryParam.salesBillSn = this.salesBillSn || ''
  288. return salesDetailList(Object.assign(parameter, this.queryParam, {showStock: true})).then(res => {
  289. let data
  290. if (res.status == 200) {
  291. data = res.data
  292. const no = (data.pageNo - 1) * data.pageSize
  293. for (var i = 0; i < data.list.length; i++) {
  294. data.list[i].no = no + i + 1
  295. data.list[i].qtyBackups = data.list[i].qty
  296. }
  297. this.disabled = false
  298. this.dataSource = data.list
  299. }
  300. return data
  301. })
  302. },
  303. showSearchBox: false,
  304. showDescBox: false,
  305. openWarehouseModal: false, // 打开仓库设置
  306. openGuideModal: false, // 导入产品引导
  307. delLoading: false,
  308. chooseDisabled: false,
  309. disabled: false, // 查询、重置按钮是否可操作
  310. queryParam: {
  311. warehouseSn: undefined,
  312. productCode: '',
  313. productName: '',
  314. productBrandSn: undefined,
  315. productTypeSn1: '', // 产品一级分类
  316. productTypeSn2: '', // 产品二级分类
  317. productTypeSn3: '' // 产品三级分类
  318. },
  319. productType: [],
  320. rowSelectionInfo: null,
  321. warehouseDataList: [],
  322. openUpActiveModal: false,
  323. descDetail: null
  324. }
  325. },
  326. computed: {
  327. selectTotal () {
  328. return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length || 0
  329. },
  330. columns () {
  331. const arr = [
  332. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  333. { title: '产品编码', dataIndex: 'productEntity.code', scopedSlots: { customRender: 'productCode' }, width: '13%', align: 'center', sorter: true },
  334. { title: '产品名称', dataIndex: 'productEntity.name', scopedSlots: { customRender: 'productName' }, width: '20%', align: 'left' },
  335. // { title: '售价', dataIndex: 'price', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  336. { title: '销售数量', scopedSlots: { customRender: 'salesNums' }, width: '8%', align: 'center' },
  337. { title: '库存', dataIndex: 'stockQty', scopedSlots: { customRender: 'stockQty' }, width: '8%', align: 'center' },
  338. { title: '出库仓库', scopedSlots: { customRender: 'warehouseBox' }, width: '15%', align: 'center' },
  339. { title: '单位', dataIndex: 'productEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  340. // { title: '售价小计', dataIndex: 'totalAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  341. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
  342. ]
  343. if (this.$hasPermissions('B_salesEdit_salesPrice')) { // 售价权限
  344. arr.splice(3, 0, { title: '售价', dataIndex: 'price', width: '8%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
  345. arr.splice(7, 0, { title: '售价小计', dataIndex: 'totalAmount', width: '8%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
  346. }
  347. return arr
  348. }
  349. },
  350. watch: {
  351. salesBillSn(newValue, oldValue) {
  352. this.resetSearchForm()
  353. }
  354. },
  355. methods: {
  356. filterOption (input, option) {
  357. return (
  358. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  359. )
  360. },
  361. warehouseLoad(sn,list){
  362. this.warehouseDataList = list
  363. },
  364. showSearch(){
  365. this.showSearchBox = !this.showSearchBox
  366. },
  367. showDesc(descDetail){
  368. this.showDescBox = !this.showDescBox
  369. this.descDetail = descDetail
  370. },
  371. openCpModal(){
  372. this.$emit('openCpModal', 1, 'productList-'+this.id)
  373. },
  374. // 表格选中项
  375. rowSelectionFun (obj) {
  376. this.rowSelectionInfo = obj || null
  377. },
  378. // 产品分类 change
  379. changeProductType (val, opt) {
  380. this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
  381. this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
  382. this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
  383. },
  384. // 重置
  385. resetSearchForm (flag) {
  386. this.queryParam.productCode = ''
  387. this.queryParam.productName = ''
  388. this.queryParam.warehouseSn = undefined
  389. this.queryParam.productBrandSn = undefined
  390. this.queryParam.productTypeSn1 = ''
  391. this.queryParam.productTypeSn2 = ''
  392. this.queryParam.productTypeSn3 = ''
  393. this.productType = []
  394. this.$refs.table.refresh(!!flag)
  395. },
  396. // 删除全部产品
  397. handleBatchDelAll () {
  398. const _this = this
  399. if (_this.dataSource.length == 0) {
  400. _this.$message.warning('暂无可删除的已选产品!')
  401. return
  402. }
  403. this.$confirm({
  404. title: '提示',
  405. content: '确认要删除全部已选产品吗?',
  406. centered: true,
  407. onOk () {
  408. _this.spinning = true
  409. deleteAll({ salesBillSn: _this.salesBillSn }).then(res => {
  410. if (res.status == 200) {
  411. _this.resetSearchForm(true)
  412. _this.$message.success(res.message)
  413. }
  414. _this.spinning = false
  415. })
  416. }
  417. })
  418. },
  419. // 批量删除已选产品
  420. handleBatchDel () {
  421. const _this = this
  422. if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
  423. _this.$message.warning('请先选择要删除的产品后再进行批量操作!')
  424. return
  425. }
  426. const obj = []
  427. _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => {
  428. obj.push(item.salesBillDetailSn)
  429. })
  430. this.$confirm({
  431. title: '提示',
  432. content: '已选产品' + obj.length + '项,确认要批量删除吗?',
  433. centered: true,
  434. onOk () {
  435. _this.spinning = true
  436. salesDetailBatchDel({
  437. salesBillSn: _this.salesBillSn,
  438. salesBillDetailSnList: obj
  439. }).then(res => {
  440. if (res.status == 200) {
  441. _this.resetSearchForm(true)
  442. _this.$message.success(res.message)
  443. }
  444. _this.spinning = false
  445. })
  446. }
  447. })
  448. },
  449. // 设置单个出库仓库
  450. handleWarehouseBox (row) {
  451. const snArr = [row.salesBillDetailSn]
  452. const ajax_data = {
  453. warehouseSn: row.warehouseSn,
  454. salesBillDetailSnList: snArr,
  455. salesBillSn: this.salesBillSn
  456. }
  457. this.setWarehouseInfo(ajax_data)
  458. },
  459. chooseWarehouseOk (sn) {
  460. const _this = this
  461. const snArr = []
  462. _this.rowSelectionInfo.selectedRows.forEach(item => {
  463. snArr.push(item.salesBillDetailSn)
  464. })
  465. const ajax_data = {
  466. warehouseSn: sn,
  467. salesBillDetailSnList: snArr,
  468. salesBillSn: _this.salesBillSn
  469. }
  470. _this.setWarehouseInfo(ajax_data)
  471. },
  472. setWarehouseInfo (data) {
  473. const _this = this
  474. _this.spinning = true
  475. updateWarehouse(data).then(res => {
  476. if (res.status == 200) {
  477. _this.openWarehouseModal = false
  478. _this.resetSearchForm(true)
  479. _this.$message.success(res.message)
  480. }
  481. _this.$refs.table.refresh(true)
  482. _this.spinning = false
  483. })
  484. },
  485. handleMenuClick (e) {
  486. const _this = this
  487. if (e.key == 0) { // 仓库设置
  488. if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
  489. _this.$message.warning('请先选择要设置的产品!')
  490. } else {
  491. _this.openWarehouseModal = true
  492. }
  493. } else if (e.key == 1) { // 删除已选项
  494. this.handleBatchDel()
  495. } else {
  496. this.handleBatchDelAll()
  497. }
  498. },
  499. // 换促销
  500. upActiveOk(data){
  501. this.openUpActiveModal = false
  502. },
  503. handleUpdateActive(record){
  504. this.openUpActiveModal = true
  505. },
  506. // 已选产品 blur
  507. onCellBlur (val, record) {
  508. const _this = this
  509. // 光标移出,值发生改变再调用编辑接口
  510. if (val && val != record.qtyBackups) {
  511. _this.spinning = true
  512. salesDetailUpdateQty({
  513. salesBillDetailSn: record.salesBillDetailSn,
  514. qty: record.qty,
  515. salesBillSn: _this.salesBillSn
  516. }).then(res => {
  517. _this.resetSearchForm(true)
  518. if (res.status == 200) {
  519. _this.$message.success(res.message)
  520. }
  521. _this.spinning = false
  522. })
  523. } else {
  524. record.qty = record.qtyBackups
  525. }
  526. },
  527. // 删除产品
  528. handleDel (row) {
  529. const _this = this
  530. this.$confirm({
  531. title: '提示',
  532. content: '确认要删除吗?',
  533. centered: true,
  534. closable: true,
  535. onOk () {
  536. _this.delLoading = true
  537. _this.spinning = true
  538. salesDetailDel({ salesBillDetailSn: row.salesBillDetailSn, salesBillSn: _this.salesBillSn }).then(res => {
  539. if (res.status == 200) {
  540. _this.resetSearchForm(true)
  541. _this.$message.success(res.message)
  542. }
  543. _this.delLoading = false
  544. _this.spinning = false
  545. })
  546. }
  547. })
  548. },
  549. // 添加产品
  550. insterProduct (row, promotionFlag) {
  551. console.log(row, promotionFlag)
  552. // 防止多次添加产品
  553. if (this.isInster) { return }
  554. const _this = this
  555. _this.saveNewProduct(row, promotionFlag)
  556. },
  557. // 保存添加的产品到销售列表
  558. saveNewProduct (row, promotionFlag) {
  559. this.$message.loading('正在添加产品...', 1)
  560. this.isInster = true
  561. this.spinning = true
  562. salesDetailInsert({
  563. packQty: row.productPackQty,
  564. productSn: row.productSn,
  565. showCost: row.lastStockCost,
  566. price: row.productPrice,
  567. origPrice: row.productPrice,
  568. promotionGiftsAmount: 0,
  569. usePromotionGiftsAmount: 0,
  570. qty: row.salesNums,
  571. salesBillSn: this.detailData.salesBillSn,
  572. salesBillNo: this.detailData.salesBillNo,
  573. purchaseBillSn: this.detailData.purchaseBillSn,
  574. purchaseBillNo: this.detailData.purchaseBillNo,
  575. stockSn: row.stockSn,
  576. promotableFlag: row.isJoinActivityProduct || 0, // 可促销标记 有活动的传1,没活动的传0
  577. promotionFlag: promotionFlag, // 促销标记 正品传0,促销品传1
  578. warehouseSn: row.warehouseSn
  579. }).then(res => {
  580. if (res.status == 200) {
  581. this.resetSearchForm()
  582. this.$message.success('产品添加成功', 2.5)
  583. }
  584. this.spinning = false
  585. this.isInster = false
  586. }).catch(err => {
  587. this.isInster = false
  588. this.spinning = false
  589. })
  590. },
  591. // 导入产品
  592. handleImportClick(e){
  593. this.openGuideModal = true
  594. },
  595. closeGuideModel () {
  596. this.openGuideModal = false
  597. },
  598. hanldeImportOk (obj) {
  599. salesBatchInsert(obj).then(res => {
  600. if (res.status == 200) {
  601. this.$refs.table.refresh(true)
  602. this.getOrderDetail(false)
  603. }
  604. })
  605. },
  606. }
  607. }
  608. </script>
  609. <style lang="less">
  610. .alert-bar{
  611. display: flex;
  612. justify-content: space-between;
  613. align-items: center;
  614. > div{
  615. &:first-child{
  616. flex-grow: 1;
  617. width:70%;
  618. padding-right: 100px;
  619. }
  620. }
  621. }
  622. </style>