|
@@ -12,7 +12,7 @@
|
|
|
</a-col>
|
|
|
<a-col :md="6" :sm="24">
|
|
|
<a-form-item label="产品编码/原厂编码">
|
|
|
- <a-input id="shoppingProductsList-queryWord" v-model.trim="queryParam.queryWord" allowClear placeholder="请输入产品编码/原厂编码"/>
|
|
|
+ <a-input id="shoppingProductsList-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码/原厂编码"/>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :md="6" :sm="24">
|
|
@@ -27,7 +27,7 @@
|
|
|
</a-col>
|
|
|
<a-col :md="6" :sm="24">
|
|
|
<a-form-item label="产品商城状态">
|
|
|
- <v-select code="ENABLE_FLAG" id="shoppingProductsList-status" v-model="queryParam.status" allowClear placeholder="请选择产品商城状态"></v-select>
|
|
|
+ <v-select code="SHOP_PRODUCT_STATUS" id="shoppingProductsList-status" v-model="queryParam.status" allowClear placeholder="请选择产品商城状态"></v-select>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :md="6" :sm="24" style="margin-bottom: 10px;">
|
|
@@ -86,6 +86,20 @@
|
|
|
@click="handleEdit(record)"
|
|
|
class="button-info"
|
|
|
:id="'chooseProductEdit-edit-btn'+record.id">编辑</a-button>
|
|
|
+ <a-button
|
|
|
+ size="small"
|
|
|
+ type="link"
|
|
|
+ @click="changeStatus('1',record)"
|
|
|
+ class="button-info"
|
|
|
+ v-if="record.status=='0'"
|
|
|
+ :id="'chooseProductEdit-top-btn'+record.id">上架</a-button>
|
|
|
+ <a-button
|
|
|
+ size="small"
|
|
|
+ type="link"
|
|
|
+ @click="changeStatus('0',record)"
|
|
|
+ class="button-info"
|
|
|
+ v-else
|
|
|
+ :id="'chooseProductEdit-bottom-btn'+record.id">下架</a-button>
|
|
|
<a-button
|
|
|
size="small"
|
|
|
type="link"
|
|
@@ -99,6 +113,7 @@
|
|
|
<!-- 添加产品 -->
|
|
|
<chooseProduct
|
|
|
ref="chooseProduct"
|
|
|
+ :chooseData="chooseDataList"
|
|
|
:openModal="showProModal"
|
|
|
@ok="addProductSuccess"
|
|
|
@close="closeProductModal"></chooseProduct>
|
|
@@ -119,7 +134,7 @@ import productType from '@/views/common/productType.js'
|
|
|
import productBrand from '@/views/common/productBrand.js'
|
|
|
import chooseProduct from '@/views/easyPassManagement/shoppingManagement/chooseProductsModal'
|
|
|
// 接口
|
|
|
-import { shopProductList, saveBatchProduct, shopProductDel, shopProductUpdateStatus } from '@/api/shopProduct'
|
|
|
+import { shopProductList, saveBatchProduct, shopProductDel, shopProductUpdateStatus, queryProductSnList } from '@/api/shopProduct'
|
|
|
export default {
|
|
|
name: 'ShoppingProductsList',
|
|
|
mixins: [commonMixin],
|
|
@@ -134,24 +149,27 @@ export default {
|
|
|
const _this = this
|
|
|
return {
|
|
|
spinning: false,
|
|
|
+ disabled: false, // 查询、重置按钮是否可操作
|
|
|
tableHeight: 0, // 表格高度
|
|
|
+ // form表单label布局
|
|
|
formItemLayout: {
|
|
|
labelCol: { span: 6 },
|
|
|
wrapperCol: { span: 16 }
|
|
|
},
|
|
|
- chooseTypeList: [],
|
|
|
- showProModal: false,
|
|
|
- productType: [],
|
|
|
+ showProModal: false, // 打开添加产品弹窗
|
|
|
+ productType: [], // 产品分类
|
|
|
+ chooseDataList: [], // 已选产品sn集合
|
|
|
+ // 查询条件
|
|
|
queryParam: {
|
|
|
productName: '', // 产品名称
|
|
|
- queryWord: '', // 产品编码/原厂编码
|
|
|
+ productCode: '', // 产品编码/原厂编码
|
|
|
productBrandSn: undefined, // 产品品牌
|
|
|
productTypeSn1: '', // 产品一级分类
|
|
|
productTypeSn2: '', // 产品二级分类
|
|
|
productTypeSn3: '', // 产品三级分类
|
|
|
status: undefined
|
|
|
},
|
|
|
- disabled: false, // 查询、重置按钮是否可操作
|
|
|
+ // 表头
|
|
|
columns: [
|
|
|
{ title: '序号', dataIndex: 'no', align: 'center', width: '60px' },
|
|
|
{ title: '产品编码', dataIndex: 'productCode', width: '12%', align: 'center', scopedSlots: { customRender: 'productCode' } },
|
|
@@ -190,12 +208,9 @@ export default {
|
|
|
return data
|
|
|
})
|
|
|
},
|
|
|
- defaultExpandedRowKeys: [], // 树形数据默认展开项
|
|
|
- openModal: false, // 新增编辑 弹框
|
|
|
- nowData: null, // 当前记录数据
|
|
|
openGuideModal: false, // 打开导入弹窗
|
|
|
openEditModal: false, // 打开编辑弹窗
|
|
|
- itemProductSn: null
|
|
|
+ itemProductSn: null// 当前行商城产品sn
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -204,7 +219,12 @@ export default {
|
|
|
this.rowSelectionInfo = obj || null
|
|
|
},
|
|
|
// 选择产品
|
|
|
- handleChooseProduct () {
|
|
|
+ async handleChooseProduct () {
|
|
|
+ // 回显已选择产品并禁用
|
|
|
+ const res = await queryProductSnList({})
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.chooseDataList = res.data
|
|
|
+ }
|
|
|
this.showProModal = true
|
|
|
},
|
|
|
// 选择产品 成功
|
|
@@ -247,12 +267,13 @@ export default {
|
|
|
// 重置
|
|
|
resetSearchForm () {
|
|
|
this.queryParam.productName = ''
|
|
|
- this.queryParam.queryWord = ''
|
|
|
+ this.queryParam.productCode = ''
|
|
|
this.queryParam.productBrandSn = undefined
|
|
|
this.queryParam.productTypeSn1 = ''
|
|
|
this.queryParam.productTypeSn2 = ''
|
|
|
this.queryParam.productTypeSn3 = ''
|
|
|
this.queryParam.status = ''
|
|
|
+ this.productType = []
|
|
|
this.$refs.table.refresh(true)
|
|
|
},
|
|
|
// 编辑
|
|
@@ -307,16 +328,21 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
// 批量上、下架
|
|
|
- changeStatus (type) {
|
|
|
- const row = this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys
|
|
|
- if (!this.rowSelectionInfo || (row.length < 1)) {
|
|
|
- this.$message.warning('请在列表中进行勾选!')
|
|
|
- return false
|
|
|
+ changeStatus (type, row) {
|
|
|
+ let newRow = []
|
|
|
+ if (!row) {
|
|
|
+ newRow = this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys
|
|
|
+ if (!this.rowSelectionInfo || (newRow.length < 1)) {
|
|
|
+ this.$message.warning('请在列表中进行勾选!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ newRow.push(row.shopProductSn)
|
|
|
}
|
|
|
- this.handleChangeStatus(type)
|
|
|
+ this.handleChangeStatus(type, newRow)
|
|
|
},
|
|
|
// 确定上、下架
|
|
|
- handleChangeStatus (typeVal) {
|
|
|
+ handleChangeStatus (typeVal, ajaxData) {
|
|
|
const _this = this
|
|
|
this.$confirm({
|
|
|
title: '提示',
|
|
@@ -324,7 +350,7 @@ export default {
|
|
|
centered: true,
|
|
|
onOk () {
|
|
|
_this.spinning = true
|
|
|
- shopProductUpdateStatus({ shopProductSnList: _this.rowSelectionInfo.selectedRowKeys, status: typeVal }).then(res => {
|
|
|
+ shopProductUpdateStatus({ shopProductSnList: ajaxData, status: typeVal }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
_this.$message.success(res.message)
|
|
|
_this.$refs.table.clearSelected()
|
|
@@ -335,12 +361,14 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ // 初始化
|
|
|
pageInit () {
|
|
|
const _this = this
|
|
|
this.$nextTick(() => { // 页面渲染完成后的回调
|
|
|
_this.setTableH()
|
|
|
})
|
|
|
},
|
|
|
+ // 计算表格高度
|
|
|
setTableH () {
|
|
|
const tableSearchH = this.$refs.tableSearch.offsetHeight
|
|
|
this.tableHeight = window.innerHeight - tableSearchH - 240
|