|
@@ -8,375 +8,60 @@
|
|
<a-icon type="left" />
|
|
<a-icon type="left" />
|
|
返回列表
|
|
返回列表
|
|
</a>
|
|
</a>
|
|
- <span style="margin: 0 15px;color: #666;font-weight: bold;">类目名称:{{ detailsData&&detailsData.sparePartsNo }}</span>
|
|
|
|
|
|
+ <span style="margin: 0 15px;color: #666;font-weight: bold;">类目名称:{{ detailsData&&detailsData.categoryName }}</span>
|
|
</template>
|
|
</template>
|
|
</a-page-header>
|
|
</a-page-header>
|
|
<a-card size="small" :bordered="false" class="chooseProductEdit-cont table-page-search-wrapper">
|
|
<a-card size="small" :bordered="false" class="chooseProductEdit-cont table-page-search-wrapper">
|
|
- <!-- 搜索条件 -->
|
|
|
|
- <div ref="tableSearch">
|
|
|
|
- <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
|
|
|
|
- <a-row :gutter="15">
|
|
|
|
- <a-col :md="6" :sm="24">
|
|
|
|
- <a-form-item label="产品名称">
|
|
|
|
- <a-input id="productPricingList-name" v-model.trim="queryParam.name" allowClear placeholder="请输入产品名称"/>
|
|
|
|
- </a-form-item>
|
|
|
|
- </a-col>
|
|
|
|
- <a-col :md="6" :sm="24">
|
|
|
|
- <a-form-item label="产品编码/原厂编码">
|
|
|
|
- <a-input id="productPricingList-queryWord" v-model.trim="queryParam.queryWord" allowClear placeholder="请输入产品编码/原厂编码"/>
|
|
|
|
- </a-form-item>
|
|
|
|
- </a-col>
|
|
|
|
- <a-col :md="6" :sm="24">
|
|
|
|
- <a-form-item label="品牌">
|
|
|
|
- <ProductBrand id="productPricingList-productBrandSn" v-model="queryParam.productBrandSn"></ProductBrand>
|
|
|
|
- </a-form-item>
|
|
|
|
- </a-col>
|
|
|
|
- <a-col :md="6" :sm="24">
|
|
|
|
- <a-form-item label="产品分类">
|
|
|
|
- <ProductType id="productPricingList-productType" placeholder="请选择产品分类" @change="changeProductType" v-model="productType"></ProductType>
|
|
|
|
- </a-form-item>
|
|
|
|
- </a-col>
|
|
|
|
- <a-col :md="6" :sm="24">
|
|
|
|
- <a-form-item label="产品商城状态">
|
|
|
|
- <v-select code="ENABLE_FLAG" id="promotionRulesList-enabledFlag" v-model="queryParam.enabledFlag" allowClear placeholder="请选择产品商城状态"></v-select>
|
|
|
|
- </a-form-item>
|
|
|
|
- </a-col>
|
|
|
|
- <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
|
|
|
|
- <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="promotionRulesList-refresh">查询</a-button>
|
|
|
|
- <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="promotionRulesList-reset">重置</a-button>
|
|
|
|
- </a-col>
|
|
|
|
- </a-row>
|
|
|
|
- </a-form>
|
|
|
|
- </div>
|
|
|
|
- <!-- 操作按钮 -->
|
|
|
|
- <div class="table-operator">
|
|
|
|
- <a-button type="primary" @click="handleAddProduct">选择产品</a-button>
|
|
|
|
- <span>
|
|
|
|
- <a-button type="primary" class="button-info" @click="handleAdd">批量上架</a-button>
|
|
|
|
- <a-button @click="handleAdd">批量下架</a-button>
|
|
|
|
- <a-button type="primary" class="button-error" ghost @click="handleAdd">批量删除</a-button>
|
|
|
|
- <span>已选1项</span>
|
|
|
|
- </span>
|
|
|
|
- </div>
|
|
|
|
- <s-table
|
|
|
|
- class="sTable fixPagination"
|
|
|
|
- ref="table"
|
|
|
|
- size="small"
|
|
|
|
- :style="{ height: tableHeight+65+'px' }"
|
|
|
|
- :rowKey="(record) => record.id"
|
|
|
|
- :columns="columns"
|
|
|
|
- :data="loadData"
|
|
|
|
- :pageSize="30"
|
|
|
|
- :row-selection="{ columnWidth: 40 }"
|
|
|
|
- @rowSelection="rowSelectionFun"
|
|
|
|
- :scroll="{ y: tableHeight-170 }"
|
|
|
|
- :defaultLoadData="false"
|
|
|
|
- bordered>
|
|
|
|
- <!-- 产品编码 -->
|
|
|
|
- <template slot="productCode" slot-scope="text, record">
|
|
|
|
- <span style="padding-right: 15px;">{{ record.productCode }}</span>
|
|
|
|
- <a-badge count="热" :number-style="{ zoom:'80%' }"></a-badge>
|
|
|
|
- </template>
|
|
|
|
- <!-- 操作 -->
|
|
|
|
- <template slot="action" slot-scope="text, record">
|
|
|
|
- <a-button
|
|
|
|
- size="small"
|
|
|
|
- type="link"
|
|
|
|
- v-if="$hasPermissions('B_chooseProductEdit_edit')"
|
|
|
|
- @click="handleAddEdit(record)"
|
|
|
|
- class="button-info"
|
|
|
|
- :id="'chooseProductEdit-edit-btn'+record.id">编辑</a-button>
|
|
|
|
- <a-button
|
|
|
|
- size="small"
|
|
|
|
- type="link"
|
|
|
|
- :loading="delLoading"
|
|
|
|
- class="button-error"
|
|
|
|
- v-if="$hasPermissions('B_chooseProductEdit_del')"
|
|
|
|
- @click="handleDel(record)"
|
|
|
|
- :id="'chooseProductEdit-del-btn'+record.id">删除</a-button>
|
|
|
|
- </template>
|
|
|
|
- </s-table>
|
|
|
|
|
|
+ <!-- 主要内容 -->
|
|
|
|
+ <main-content :itemCategorySn="$route.params.sn"></main-content>
|
|
</a-card>
|
|
</a-card>
|
|
</a-spin>
|
|
</a-spin>
|
|
- <!-- 编辑弹窗-->
|
|
|
|
- <editProductModal
|
|
|
|
- v-drag
|
|
|
|
- :itemSn="itemSn"
|
|
|
|
- :openModal="opeEditModal"
|
|
|
|
- @ok="resetTable"
|
|
|
|
- @close="opeEditModal=false" />
|
|
|
|
- <!-- 添加产品 -->
|
|
|
|
- <chooseProduct
|
|
|
|
- ref="chooseProduct"
|
|
|
|
- :chooseType="chooseTypeList"
|
|
|
|
- :itemSn="$route.params.sn"
|
|
|
|
- :openModal="showProModal"
|
|
|
|
- @ok="addProductSuccess"
|
|
|
|
- @close="closeProductModal"></chooseProduct>
|
|
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import { commonMixin } from '@/utils/mixin'
|
|
import { commonMixin } from '@/utils/mixin'
|
|
// 组件
|
|
// 组件
|
|
-import { STable, VSelect } from '@/components'
|
|
|
|
-// import addModal from './addModal.vue'
|
|
|
|
-// import basicInfoModal from './basicInfoModal.vue'
|
|
|
|
-import chooseProduct from './chooseProductsModal.vue'
|
|
|
|
-import ProductType from '@/views/common/productType.js'
|
|
|
|
-import ProductBrand from '@/views/common/productBrand.js'
|
|
|
|
|
|
+import mainContent from '@/views/easyPassManagement/shoppingProducts/list'
|
|
// 接口
|
|
// 接口
|
|
-import { shopProductList } from '@/api/shopProduct'
|
|
|
|
-import { getThirdStockQty } from '@/api/salesNew'
|
|
|
|
|
|
+import { shopCategoryDetail } from '@/api/shopCategory'
|
|
export default {
|
|
export default {
|
|
name: 'ChooseProductEdit',
|
|
name: 'ChooseProductEdit',
|
|
mixins: [commonMixin],
|
|
mixins: [commonMixin],
|
|
- components: { STable, VSelect, ProductType, ProductBrand, chooseProduct },
|
|
|
|
|
|
+ components: { mainContent },
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
spinning: false,
|
|
spinning: false,
|
|
- showDetail: true, // 是否显示基础信息
|
|
|
|
- delLoading: false, // 删除loading
|
|
|
|
- openAddModal: false, // 打开新增产品弹窗
|
|
|
|
- openBasicInfoModal: false, // 打开编辑基础信息弹窗
|
|
|
|
- openGuideModal: false, // 导入产品弹窗
|
|
|
|
- detailsData: null, // 基础信息数据
|
|
|
|
- addMoreLoading: false, // 防止多次添加 加载状态
|
|
|
|
- loading: false, // 第三方库存按钮加载状态
|
|
|
|
- opeEditModal: false, // 编辑弹窗
|
|
|
|
- showProModal: false, // 选择产品弹窗
|
|
|
|
- // 查询参数
|
|
|
|
- productForm: {
|
|
|
|
- productCode: '', // 产品编码
|
|
|
|
- productName: '' // 产品名称
|
|
|
|
- },
|
|
|
|
- statisticsObj: undefined, // 统计明细
|
|
|
|
- sparePartsSn: undefined, // 采购入库sn
|
|
|
|
- itemSn: undefined, // 列表行 sn
|
|
|
|
- itemObj: null, // 基础信息弹窗回显数据
|
|
|
|
- queryParam: {
|
|
|
|
- name: '',
|
|
|
|
- queryWord: '', // 产品编码/原厂编码
|
|
|
|
- productBrandSn: undefined, // 产品品牌
|
|
|
|
- productTypeSn1: '', // 产品一级分类
|
|
|
|
- productTypeSn2: '', // 产品二级分类
|
|
|
|
- productTypeSn3: '' // 产品三级分类
|
|
|
|
- },
|
|
|
|
- productType: [],
|
|
|
|
- rowSelectionInfo: null,
|
|
|
|
- tableHeight: 0, // 表格高度
|
|
|
|
- // 加载数据方法 必须为 Promise 对象
|
|
|
|
- loadData: parameter => {
|
|
|
|
- this.productForm.sparePartsSn = this.sparePartsSn
|
|
|
|
- const parames = Object.assign(parameter, this.productForm)
|
|
|
|
- // 获取列表数据 有分页
|
|
|
|
- return shopProductList(parames).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
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return data
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- computed: {
|
|
|
|
- // 列表表头配置
|
|
|
|
- columns () {
|
|
|
|
- const _this = this
|
|
|
|
- const arr = [
|
|
|
|
- { title: '序号', dataIndex: 'no', align: 'center', width: '4%' },
|
|
|
|
- { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'center', scopedSlots: { customRender: 'productCode' } },
|
|
|
|
- { title: '产品名称', dataIndex: 'productName', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
|
- { title: '原厂编码', dataIndex: 'unit', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
|
|
|
|
- { title: '品牌', dataIndex: 'unit', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
|
|
|
|
- { title: '产品分类', dataIndex: 'unit', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
|
|
|
|
- { title: '售价', dataIndex: 'productCost', width: '7%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
|
|
|
|
- { title: '售价类型', dataIndex: 'unit', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
|
|
|
|
- { title: '终端价', dataIndex: 'productCost', width: '7%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
|
|
|
|
- { title: '车主价', dataIndex: 'productCost', width: '7%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
|
|
|
|
- { title: '优先级', dataIndex: 'unit', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
|
|
|
|
- { title: '添加时间', dataIndex: 'unit', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
|
|
|
|
- { title: '产品商城状态', dataIndex: 'unit', align: 'center', width: '9%', customRender: function (text) { return text || '--' } },
|
|
|
|
- { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
|
|
|
|
- ]
|
|
|
|
- // if (this.$hasPermissions('M_chooseProductEdit_costPrice')) {
|
|
|
|
- // arr.splice(6, 0, { title: '采购单价', dataIndex: 'productCost', width: '8%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } })
|
|
|
|
- // if (this.detailsData && this.detailsData.supplierName) {
|
|
|
|
- // arr.splice(7, 0, { title: '采购金额', dataIndex: 'subtotal', width: '8%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } })
|
|
|
|
- // } else {
|
|
|
|
- // arr.splice(7, 0, { title: '采购金额', dataIndex: 'subtotal', width: '8%', align: 'right', customRender: function (text) { return text || '--' } })
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- return arr
|
|
|
|
- },
|
|
|
|
- // 计算选中数据条数
|
|
|
|
- selectCount () {
|
|
|
|
- return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length
|
|
|
|
|
|
+ detailsData: null, // 类目详情
|
|
|
|
+ tableHeight: 0 // 表格高度
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- // 表格选中项
|
|
|
|
- rowSelectionFun (obj) {
|
|
|
|
- this.rowSelectionInfo = obj || null
|
|
|
|
- },
|
|
|
|
- // 添加产品
|
|
|
|
- handleAddProduct () {
|
|
|
|
- this.showProModal = true
|
|
|
|
- },
|
|
|
|
- // 新增产品成功 刷新基础信息时间,防止重复提交
|
|
|
|
- handleAddOk () {
|
|
|
|
- this.pageInit()
|
|
|
|
- },
|
|
|
|
- // 第三方库存
|
|
|
|
- handleThirdQty () {
|
|
|
|
- const params = {
|
|
|
|
- sparePartsSn: this.sparePartsSn
|
|
|
|
- }
|
|
|
|
- getThirdStockQty(params).then(res => {
|
|
|
|
- if (res.status == 200) {
|
|
|
|
- this.handleAddOk(true)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- // 导入产品
|
|
|
|
- hanldleImportOk (listCon) {
|
|
|
|
- this.spinning = true
|
|
|
|
- purchaseImportBatchInsert(listCon).then(res => {
|
|
|
|
- if (res.status == 200) {
|
|
|
|
- this.$message.success('导入成功')
|
|
|
|
- this.handleAddOk()
|
|
|
|
- }
|
|
|
|
- this.spinning = false
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- // 编辑基础信息
|
|
|
|
- handleEditBase () {
|
|
|
|
- this.itemObj = { dealerName: this.detailsData.lockBizDealerName, lockBizNo: this.detailsData.lockBizNo, bizRemark: this.detailsData.bizRemark }
|
|
|
|
- this.openBasicInfoModal = true
|
|
|
|
- },
|
|
|
|
// 返回列表并刷新
|
|
// 返回列表并刷新
|
|
handleBack () {
|
|
handleBack () {
|
|
- this.$router.push({ name: 'purchaseReceiptList', query: { closeLastOldTab: true } })
|
|
|
|
- },
|
|
|
|
- // 新增/编辑产品
|
|
|
|
- handleAddEdit (row) {
|
|
|
|
- // if (this.detailsData && !this.detailsData.supplierName) {
|
|
|
|
- // this.$message.warning('供应商不能为空,请先编辑基础信息!')
|
|
|
|
- // return
|
|
|
|
- // }
|
|
|
|
- // this.itemSn = (row && row.sparePartsDetailSn) ? row.sparePartsDetailSn : null
|
|
|
|
- this.openEditModal = true
|
|
|
|
|
|
+ this.$router.push({ name: 'shoppingManagementList', query: { closeLastOldTab: true } })
|
|
},
|
|
},
|
|
- // 导入产品
|
|
|
|
- handleImport () {
|
|
|
|
- this.openGuideModal = true
|
|
|
|
- },
|
|
|
|
- // 删除所选产品
|
|
|
|
- handleDel (row) {
|
|
|
|
- const _this = this
|
|
|
|
- this.$confirm({
|
|
|
|
- title: '提示',
|
|
|
|
- content: '确认删除产品吗?',
|
|
|
|
- centered: true,
|
|
|
|
- closable: true,
|
|
|
|
- onOk () {
|
|
|
|
- _this.delLoading = true
|
|
|
|
- _this.spinning = true
|
|
|
|
- purchaseDetailDel({ sn: row.sparePartsDetailSn })
|
|
|
|
- .then(res => {
|
|
|
|
- if (res.status == 200) {
|
|
|
|
- _this.resetTable()
|
|
|
|
- }
|
|
|
|
- _this.$message.info(res.message)
|
|
|
|
- _this.delLoading = false
|
|
|
|
- _this.spinning = false
|
|
|
|
- })
|
|
|
|
- .catch(err => {
|
|
|
|
- _this.$message.info(err.message)
|
|
|
|
- _this.delLoading = false
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- // 刷新列表 更新操作时间
|
|
|
|
- resetTable () {
|
|
|
|
- this.opeEditModal = false
|
|
|
|
- this.$refs.table.refresh(true)
|
|
|
|
- },
|
|
|
|
- // 重置
|
|
|
|
- resetSearchForm () {
|
|
|
|
- this.queryParam.name = ''
|
|
|
|
- this.queryParam.queryWord = ''
|
|
|
|
- this.queryParam.productBrandSn = undefined
|
|
|
|
- this.queryParam.productTypeSn1 = ''
|
|
|
|
- this.queryParam.productTypeSn2 = ''
|
|
|
|
- this.queryParam.productTypeSn3 = ''
|
|
|
|
- this.productType = []
|
|
|
|
- this.$refs.table.refresh(true)
|
|
|
|
- },
|
|
|
|
- // 提交采购入库
|
|
|
|
- handleSubmit (data) {
|
|
|
|
|
|
+ // 获取目录详情
|
|
|
|
+ getCategoryDetail () {
|
|
this.spinning = true
|
|
this.spinning = true
|
|
- purchaseSubmit({ sn: this.sparePartsSn }).then(res => {
|
|
|
|
|
|
+ shopCategoryDetail({ categorySn: this.$route.params.sn }).then(res => {
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
- this.handleBack()
|
|
|
|
- this.$message.success(res.message)
|
|
|
|
|
|
+ this.detailsData = res.data || {}
|
|
}
|
|
}
|
|
this.spinning = false
|
|
this.spinning = false
|
|
})
|
|
})
|
|
- },
|
|
|
|
- // 初始化
|
|
|
|
- pageInit () {
|
|
|
|
- this.sparePartsSn = this.$route.query.sn
|
|
|
|
- this.$nextTick(() => {
|
|
|
|
- this.resetSearchForm()
|
|
|
|
- this.setTableH()
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- // 计算表格高度
|
|
|
|
- setTableH () {
|
|
|
|
- const headHeight = this.$refs.tableSearch.offsetHeight
|
|
|
|
- this.tableHeight = window.innerHeight - headHeight - 280
|
|
|
|
- },
|
|
|
|
- // 获取页面统计数据
|
|
|
|
- getStatisticsData (ajaxData) {
|
|
|
|
- purchaseDetailPageCount(ajaxData).then(res => {
|
|
|
|
- if (res.status == 200) {
|
|
|
|
- if (res.data) {
|
|
|
|
- this.statisticsObj = res.data
|
|
|
|
- } else {
|
|
|
|
- this.statisticsObj = null
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- // 获取基础信息
|
|
|
|
- getBasicsData () {
|
|
|
|
- queryDetailCount({ sn: this.sparePartsSn }).then(res => {
|
|
|
|
- if (res.status == 200) {
|
|
|
|
- this.detailsData = res.data
|
|
|
|
- } else {
|
|
|
|
- this.detailsData = null
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
mounted () {
|
|
mounted () {
|
|
if (!this.$store.state.app.isNewTab) {
|
|
if (!this.$store.state.app.isNewTab) {
|
|
// 页签刷新时调用
|
|
// 页签刷新时调用
|
|
- this.pageInit()
|
|
|
|
|
|
+ this.getCategoryDetail()
|
|
}
|
|
}
|
|
},
|
|
},
|
|
activated () {
|
|
activated () {
|
|
// 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
|
|
// 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
|
|
if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
|
|
if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
|
|
- this.pageInit()
|
|
|
|
|
|
+ this.getCategoryDetail()
|
|
}
|
|
}
|
|
},
|
|
},
|
|
beforeRouteEnter (to, from, next) {
|
|
beforeRouteEnter (to, from, next) {
|
|
@@ -395,9 +80,6 @@ export default {
|
|
}
|
|
}
|
|
.chooseProductEdit-cont {
|
|
.chooseProductEdit-cont {
|
|
margin-top: 6px;
|
|
margin-top: 6px;
|
|
- .table-operator{
|
|
|
|
- margin-bottom:6px;
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|