|
@@ -25,7 +25,18 @@
|
|
|
</a-select>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
- <a-col flex="auto">
|
|
|
+ <a-col flex="250px" v-if="modes=='pages'">
|
|
|
+ <a-form-item label="产品状态">
|
|
|
+ <v-select
|
|
|
+ code="ONLINE_FLAG2"
|
|
|
+ id="productPricingList-onlineFalg"
|
|
|
+ v-model="queryParam.onlineFalg"
|
|
|
+ allowClear
|
|
|
+ placeholder="请选择产品状态"
|
|
|
+ ></v-select>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col flex="auto" style="margin-bottom:10px;">
|
|
|
<a-button type="primary" @click="searchForm" :disabled="disabled" id="shoppingCar-refresh">查询</a-button>
|
|
|
<a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="shoppingCar-reset">重置</a-button>
|
|
|
</a-col>
|
|
@@ -35,10 +46,10 @@
|
|
|
<div class="table-operator">
|
|
|
<a-row :gutter="16">
|
|
|
<a-col class="gutter-row" :span="24">
|
|
|
- <a-button type="primary" ghost v-if="modes=='pages'" @click="deleteMore">
|
|
|
+ <a-button type="primary" :loading="loading" ghost v-if="modes=='pages'" @click="deleteMore">
|
|
|
批量删除
|
|
|
</a-button>
|
|
|
- <a-button type="primary" ghost v-if="modes=='modals'" @click="addMore">
|
|
|
+ <a-button type="primary" :loading="loading" ghost v-if="modes=='modals'" @click="addMore">
|
|
|
批量添加
|
|
|
</a-button>
|
|
|
<span v-if="rowSelectionInfo&&rowSelectionInfo.selectedRowKeys">已选 {{ rowSelectionInfo.selectedRowKeys.length }} 项</span>
|
|
@@ -52,7 +63,7 @@
|
|
|
ref="table"
|
|
|
:style="{ height: tableHeight+84.5+'px' }"
|
|
|
size="small"
|
|
|
- :row-selection="{ columnWidth: 40 }"
|
|
|
+ :row-selection="modes=='pages'?{ columnWidth: 40 }:{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: !record.productEntity.purchasePrice } }) }"
|
|
|
@rowSelection="rowSelectionFun"
|
|
|
rowKeyName="productSn"
|
|
|
:rowKey="(record) => record.productSn"
|
|
@@ -63,7 +74,21 @@
|
|
|
bordered>
|
|
|
<!-- 采购数量 -->
|
|
|
<template slot="purchaseQty" slot-scope="text, record">
|
|
|
- <a-input placeholder="请输入采购数量" v-model="record.qty"/>
|
|
|
+ <a-input placeholder="请输入采购数量" v-model="record.qty" @change="updateQty(record)"/>
|
|
|
+ </template>
|
|
|
+ <!-- 包装数 -->
|
|
|
+ <template slot="baozh" slot-scope="text, record">
|
|
|
+ {{ record.productEntity.packQty||'--' }}/{{ record.productEntity.packQtyUnit||'--' }}
|
|
|
+ </template>
|
|
|
+ <!-- 产品编码 -->
|
|
|
+ <template slot="productCode" slot-scope="text, record">
|
|
|
+ <div v-if="modes=='pages'">
|
|
|
+ <span style="padding-right: 15px;">{{ text }}</span>
|
|
|
+ <a-tag v-if="record.onlineFalg == 0">下架</a-tag>
|
|
|
+ </div>
|
|
|
+ <div v-else>
|
|
|
+
|
|
|
+ </div>
|
|
|
</template>
|
|
|
</s-table>
|
|
|
</a-card>
|
|
@@ -71,13 +96,13 @@
|
|
|
|
|
|
<script>
|
|
|
import { commonMixin } from '@/utils/mixin'
|
|
|
-import { productList, getCurrentDealer, productUpdate } from '@/api/product'
|
|
|
+import { purchaseCartList, purchaseDeleteBatch, purchaseUpdateQty } from '@/api/purchaseCart'
|
|
|
import ProductType from '../../common/productType.js'
|
|
|
import ProductBrand from '../../common/productBrand.js'
|
|
|
-import { STable } from '@/components'
|
|
|
+import { STable, VSelect } from '@/components'
|
|
|
export default {
|
|
|
name: 'ShoppingCarList',
|
|
|
- components: { STable, ProductType, ProductBrand },
|
|
|
+ components: { STable, VSelect, ProductType, ProductBrand },
|
|
|
mixins: [commonMixin],
|
|
|
props:{
|
|
|
modes:{
|
|
@@ -87,6 +112,7 @@ export default {
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
+ loading: false,
|
|
|
tableHeight: 0,
|
|
|
productType: [],
|
|
|
queryParam: { // 查询条件
|
|
@@ -95,26 +121,24 @@ export default {
|
|
|
productBrandSn: undefined, // 产品品牌
|
|
|
productTypeSn1: '', // 产品一级分类
|
|
|
productTypeSn2: '', // 产品二级分类
|
|
|
- productTypeSn3: '' // 产品三级分类
|
|
|
+ productTypeSn3: '' ,// 产品三级分类
|
|
|
+ onlineFalg: undefined
|
|
|
},
|
|
|
openEditPriceModal: false, // 自定义报价弹窗
|
|
|
- iconShowFlag: false, // 列表配置图标显示
|
|
|
disabled: false, // 查询、重置按钮是否可操作
|
|
|
- exportLoading: false, // 导出loading
|
|
|
- dateFormat: 'YYYY-MM-DD',
|
|
|
columns: [],
|
|
|
- chooseShowList: ['A', 'B', 'C', 'D', 'E'],
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
loadData: parameter => {
|
|
|
this.disabled = true
|
|
|
this.spinning = true
|
|
|
- return productList(Object.assign(parameter, this.queryParam)).then(res => {
|
|
|
+ return purchaseCartList(Object.assign(parameter, {productEntity:this.queryParam})).then(res => {
|
|
|
let data
|
|
|
if (res.status == 200) {
|
|
|
data = res.data
|
|
|
const no = (data.pageNo - 1) * data.pageSize
|
|
|
for (var i = 0; i < data.list.length; i++) {
|
|
|
data.list[i].no = no + i + 1
|
|
|
+ data.list[i].qtyBack = data.list[i].qty
|
|
|
}
|
|
|
this.disabled = false
|
|
|
}
|
|
@@ -122,9 +146,6 @@ export default {
|
|
|
return data
|
|
|
})
|
|
|
},
|
|
|
- openModal: false, // 查看客户详情 弹框
|
|
|
- itemId: '', // 当前产品id
|
|
|
- productTypeList: [], // 分类下拉数据
|
|
|
rowSelectionInfo: null,
|
|
|
}
|
|
|
},
|
|
@@ -151,12 +172,12 @@ export default {
|
|
|
getColumns () {
|
|
|
const _this = this
|
|
|
this.columns = [
|
|
|
- { title: '产品编码', dataIndex: 'code', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品名称', dataIndex: 'name', width: '33%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
- { title: '可用库存数量', dataIndex: 'carOwnersPrice', width: '13%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '成本价', dataIndex: 'price1', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
- { title: '单位', dataIndex: 'origCode', width: '8%', align: 'center', customRender: function (text) { return (!text || text == ' ') ? '--' : text } },
|
|
|
- { title: '包装数', dataIndex: 'terminalPrice', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: '产品编码', dataIndex: 'productEntity.code',scopedSlots: { customRender: 'productCode' }, width: '15%', align: 'center' },
|
|
|
+ { title: '产品名称', dataIndex: 'productEntity.name', width: '33%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '可用库存数量', dataIndex: 'currentStockQty', width: '13%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: '成本价', dataIndex: 'productEntity.purchasePrice', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ { title: '单位', dataIndex: 'productEntity.unit', width: '8%', align: 'center', customRender: function (text) { return (!text || text == ' ') ? '--' : text } },
|
|
|
+ { title: '包装数',scopedSlots: { customRender: 'baozh' }, dataIndex: 'productEntity.packQty', width: '8%', align: 'center' },
|
|
|
{ title: '采购数量', scopedSlots: { customRender: 'purchaseQty' }, width: '15%', align: 'center' }
|
|
|
]
|
|
|
},
|
|
@@ -170,6 +191,17 @@ export default {
|
|
|
rowSelectionFun (obj) {
|
|
|
this.rowSelectionInfo = obj || null
|
|
|
},
|
|
|
+ // 修改数量
|
|
|
+ updateQty(row){
|
|
|
+ purchaseUpdateQty({qty: row.qty, purchaseCartSn: row.purchaseCartSn}).then(res => {
|
|
|
+ if(res.status == 200){
|
|
|
+ this.$message.info(res.message)
|
|
|
+ row.qtyBack = row.qty
|
|
|
+ }else{
|
|
|
+ row.qty = row.qtyBack
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
// 批量删除
|
|
|
deleteMore () {
|
|
|
const rows = this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys || []
|
|
@@ -182,7 +214,16 @@ export default {
|
|
|
content: '您已经选择'+rows.length+'个产品,确认要将已选产品从购物车中移除吗?',
|
|
|
centered: true,
|
|
|
onOk: () => {
|
|
|
- console.log('确定删除')
|
|
|
+ this.loading = true
|
|
|
+ purchaseDeleteBatch({
|
|
|
+ productSnList: rows
|
|
|
+ }).then(res => {
|
|
|
+ if(res.status == 200){
|
|
|
+ this.$message.info(res.message)
|
|
|
+ this.searchForm()
|
|
|
+ }
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
},
|