Compare commits

..

No commits in common. '69afce5015f2fb7b9ad9c96280dfb21adbf1696d' and '16cc7fb9ff6277c5f78ee4db96ff74212f743d38' have entirely different histories.

  1. 7
      src/api/product/productAttr.js
  2. 78
      src/views/product/productAdd/components/OilStationSelection.vue
  3. 36
      src/views/product/productList/index.vue

@ -61,13 +61,6 @@ export default {
data data
}) })
}, },
batchShelves(data) {
return request({
url: `/${service_name}/mallProductInfo/upOrDownShelves`,
method: 'post',
data
})
},
getAllSites(data) { getAllSites(data) {
return request({ return request({
url: `/${service_name}/mallProductSiteRelation/getAllSites`, url: `/${service_name}/mallProductSiteRelation/getAllSites`,

@ -12,11 +12,11 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table max-height="500" @selection-change="selectionChange" v-loading="loading" ref="table" :data="tableList" <el-table max-height="500" @selection-change="selectionChange" v-loading="loading" ref="table" :data="tableList"
:row-key="(row) => row.siteId" highlight-current-row empty-text="暂无数据" class="mt14"> highlight-current-row empty-text="暂无数据" class="mt14">
<el-table-column type="selection" reserve-selection width="55"> <el-table-column type="selection" width="55">
</el-table-column> </el-table-column>
<el-table-column label="油站名称" prop="siteName"></el-table-column> <el-table-column label="油站名称" prop="siteName"> </el-table-column>
<el-table-column label="渠道" prop="channel"></el-table-column> <el-table-column label="渠道" prop="channel"> </el-table-column>
</el-table> </el-table>
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
:current-page="page.currentPage" :page-sizes="[10, 15, 20, 30]" :page-size="page.pageSize" :current-page="page.currentPage" :page-sizes="[10, 15, 20, 30]" :page-size="page.pageSize"
@ -24,10 +24,9 @@
</div> </div>
</template> </template>
<script> <script>
import productApi from '@/api/product/productAttr.js' import productApi from '@/api/product/productAttr.js';
export default { export default {
name: 'OilStationSelection', name: "OilStationSelection",
props: { props: {
OilStationSelectionList: { OilStationSelectionList: {
type: Array, type: Array,
@ -35,7 +34,7 @@ export default {
}, },
selectAttrId: { selectAttrId: {
type: String, type: String,
default: () => '' default: () => ""
} }
}, },
data() { data() {
@ -44,24 +43,24 @@ export default {
loading: false, loading: false,
tableList: [], tableList: [],
page: { page: {
'currentPage': 1, "currentPage": 1,
'pageSize': 10, "pageSize": 10,
'totalCount': 0, "totalCount": 0,
'params': { "params": {
'siteName': '' "siteName": ""
} },
} }
} }
}, },
watch: { watch: {
OilStationSelectionList: { OilStationSelectionList:{
handler(n, o) { handler(n,o){
this.$refs.table.clearSelection() this.$refs.table.clearSelection();
n.forEach(element => { n.forEach(element => {
this.$refs.table.toggleRowSelection(element) this.$refs.table.toggleRowSelection(element);
}) });
}, },
deep: true deep:true
} }
}, },
created() { created() {
@ -84,28 +83,27 @@ export default {
return !!value return !!value
&& typeof value === 'object' && typeof value === 'object'
&& typeof value.then === 'function' && typeof value.then === 'function'
&& typeof value.finally === 'function' && typeof value.finally === 'function';
}, },
loadingFn(callback) { loadingFn(callback) {
this.loading = true this.loading = true;
if (this.isStrictPromise(callback)) { if (this.isStrictPromise(callback)) {
callback.finally(() => { callback.finally(() => {
this.loading = false this.loading = false;
}) })
} };
}, },
getByPage() { getByPage() {
this.loadingFn(productApi.getAllSites(this.page).then(res => { this.loadingFn(productApi.getAllSites(this.page).then(res => {
if (res.code === 20000) { // ({
this.tableList = res.data.list // data: this.tableList = [],
this.page.totalCount = parseInt(res.data.totalCount) // currentPage: this.page.currentPage,
// pageSize: this.page.pageSize,
} else { // totalCount: this.page.totalCount
this.tableList = [] // } = res.data);
this.page.totalCount = 0 this.tableList = res.data
} console.log(res)
})) }));
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.page.currentPage = val this.page.currentPage = val
@ -119,20 +117,20 @@ export default {
productApi.delete(e).then(res => { productApi.delete(e).then(res => {
if (res.code == 20000) { if (res.code == 20000) {
this.$message.success('操作成功') this.$message.success('操作成功')
this.handleCurrentChange() this.handleCurrentChange();
} }
}) })
}, },
edit(row) { edit(row) {
let data = Object.assign({}, row, { let data = Object.assign({}, row, {
name: this.selectAttrId.split('/')[1] || '', name: this.selectAttrId.split("/")[1] || "",
spec: [{ spec: [{
value: row.attributeName, value: row.attributeName,
detail: row.attributeContent.split(',') detail: row.attributeContent.split(",")
}] }],
}) })
this.$parent.$parent.selection = [data] this.$parent.$parent.selection = [data];
this.$parent.$parent.addAttr('typeUpdate') this.$parent.$parent.addAttr('typeUpdate');
}, },
init() { init() {
// this.getByPage(); // this.getByPage();

@ -41,8 +41,8 @@
</el-form> </el-form>
</div> </div>
<div class="Button"> <div class="Button">
<!-- <el-button type="primary" class="mr14">添加商品</el-button>--> <el-button type="primary" class="mr14">添加商品</el-button>
<!-- <el-button type="success" class="mr14" @click="onCopy">商品采集</el-button>--> <el-button type="success" class="mr14" @click="onCopy">商品采集</el-button>
<!-- <el-dropdown class="bnt mr14" @command="batchSelect"> <!-- <el-dropdown class="bnt mr14" @command="batchSelect">
<el-button>批量修改<i class="el-icon-arrow-down el-icon--right"></i></el-button> <el-button>批量修改<i class="el-icon-arrow-down el-icon--right"></i></el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
@ -54,11 +54,9 @@
<el-dropdown-item :command="6">活动推荐</el-dropdown-item> <el-dropdown-item :command="6">活动推荐</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> --> </el-dropdown> -->
<!-- <el-button @click="onDismount" v-show="artFrom.type === '1'">批量下架</el-button>--> <el-button @click="onDismount" v-show="artFrom.type === '1'">批量下架</el-button>
<!-- <el-button @click="onShelves" v-show="artFrom.type === '2'">批量上架</el-button>--> <el-button @click="onShelves" v-show="artFrom.type === '2'">批量上架</el-button>
<!-- <el-button class="export" @click="exports">导出</el-button>--> <el-button class="export" @click="exports">导出</el-button>
<el-button @click="batchShelves('1')">批量上架</el-button>
<el-button @click="batchShelves('2')">批量下架</el-button>
</div> </div>
<el-table <el-table
ref="table" ref="table"
@ -528,6 +526,8 @@ export default {
} }
}) })
}, },
getList() {},
batchSub() {}, batchSub() {},
clearBatchData(status) {}, clearBatchData(status) {},
// //
@ -588,24 +588,10 @@ export default {
}, },
getExcelData(excelData) {}, getExcelData(excelData) {},
freight() {}, freight() {},
// //
batchShelves(productStatus) { onShelves() {},
let selected = this.$refs.table.selection //
if (selected&&selected.length>0){ onDismount() {},
let selectedIds = selected.map(item=>item.id)
productApi.batchShelves({
list:selectedIds,
productStatus:productStatus
}).then(res=>{
if (res.code===20000){
this.$message.success(res.msg)
this.getDataList()
}
})
}else {
this.$message.error('请选择需要操作的数据')
}
},
getRowKey(row) { getRowKey(row) {
return row.id return row.id
}, },

Loading…
Cancel
Save