From 64f45c75ea93911b9841bf00bb4c436cd294be3a Mon Sep 17 00:00:00 2001 From: k94314517 <8417338+k94314517@user.noreply.gitee.com> Date: 星期五, 15 九月 2023 18:30:47 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev --- company_admin/src/views/business/goods.vue | 110 ++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 68 insertions(+), 42 deletions(-) diff --git a/company_admin/src/views/business/goods.vue b/company_admin/src/views/business/goods.vue index 16d2c4f..5998a93 100644 --- a/company_admin/src/views/business/goods.vue +++ b/company_admin/src/views/business/goods.vue @@ -10,41 +10,40 @@ <el-input v-model="searchForm.id" placeholder="璇疯緭鍏ュ晢鍝両D" @keypress.enter.native="search"></el-input> </el-form-item> <el-form-item label="绫诲埆" prop="categoryId"> - <el-select v-model="searchForm.categoryId" clearable placeholder="璇烽�夋嫨"> - <el-option - v-for="item in categoryList" - :key="item.id" - :label="item.name" - :value="item.id"> - </el-option> - </el-select> + <el-select v-model="searchForm.categoryId" clearable placeholder="璇烽�夋嫨"> + <el-option + v-for="item in categoryList" + :key="item.id" + :label="item.name" + :value="item.id"> + </el-option> + </el-select> <!-- <el-input v-model="searchForm.categoryId" placeholder="璇疯緭鍏ユ墍灞炲搧绫荤紪鐮�" @keypress.enter.native="search"></el-input> --> </el-form-item> <el-form-item label="鍝佺墝" prop="brandId"> - <el-select v-model="searchForm.brandId" clearable placeholder="璇烽�夋嫨"> - <el-option - v-for="item in brandList" - :key="item.id" - :label="item.name" - :value="item.id"> - </el-option> - </el-select> + <el-select v-model="searchForm.brandId" clearable placeholder="璇烽�夋嫨"> + <el-option + v-for="item in brandList" + :key="item.id" + :label="item.name" + :value="item.id"> + </el-option> + </el-select> <!-- <el-input v-model="searchForm.brandId" placeholder="璇疯緭鍏ユ墍灞炲搧鐗岀紪鐮�" @keypress.enter.native="search"></el-input> --> </el-form-item> <el-form-item label="鐘舵��" prop="status"> - <el-select v-model="searchForm.status" clearable placeholder="璇烽�夋嫨"> - <el-option - v-for="item in statusList" - :key="item.id" - :label="item.name" - :value="item.id"> - </el-option> - </el-select> + <el-select v-model="searchForm.status" clearable placeholder="璇烽�夋嫨"> + <el-option + v-for="item in statusList" + :key="item.id" + :label="item.name" + :value="item.id"> + </el-option> + </el-select> <!-- <el-input v-model="searchForm.status" placeholder="璇疯緭鍏ョ姸鎬� 0鍚敤 1绂佺敤" @keypress.enter.native="search"></el-input> --> </el-form-item> <section> <el-button type="primary" @click="search">鎼滅储</el-button> - <el-button @click="reset">閲嶇疆</el-button> </section> </el-form> @@ -52,8 +51,12 @@ <template v-slot:table-wrap> <ul class="toolbar" v-permissions="['business:goods:create', 'business:goods:delete']"> <li><el-button type="primary" @click="$refs.operaGoodsWindow.open('鏂板缓鍟嗗搧')" icon="el-icon-plus" v-permissions="['business:goods:create']">鏂板缓</el-button></li> + <el-button type="primary" :loading="isWorking.export" @click="$refs.selectProduct.open('閫夋嫨骞冲彴鍟嗗搧')">閫夋嫨骞冲彴鍟嗗搧</el-button> <el-button type="primary" :loading="isWorking.export" v-permissions="['business:goods:exportExcel']" @click="importFile">瀵煎叆</el-button> <el-button type="primary" :loading="isWorking.export" @click="downloadFile">涓嬭浇妯℃澘</el-button> + + <el-button type="primary" :loading="isWorking.export" @click="bulkOperation(0)">鎵归噺涓婃灦</el-button> + <el-button type="primary" :loading="isWorking.export" @click="bulkOperation(1)">鎵归噺涓嬫灦</el-button> <!-- <li><el-button @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['business:goods:delete']">鍒犻櫎</el-button></li> --> </ul> <el-table @@ -63,7 +66,9 @@ border :header-cell-style="rowStyle" :cell-style="rowStyle" + @selection-change="handleSelectionChange" > + <el-table-column type="selection" width="55"></el-table-column> <el-table-column prop="id" label="鍟嗗搧ID" min-width="100px"></el-table-column> <el-table-column prop="name" label="鍟嗗搧鍚嶇О/鍨嬪彿" min-width="200px"> <template slot-scope="{row}"> @@ -76,27 +81,26 @@ :preview-src-list="[row.prefixUrl + row.imgurl]" fit="cover"></el-image> </div> - {{ row.name }} + {{ row.name }} </div> </template> </el-table-column> <el-table-column prop="brandName" label="鍝佺墝" min-width="100px"></el-table-column> <el-table-column prop="categoryName" label="绫诲埆" min-width="100px"></el-table-column> - <el-table-column prop="attrFirstNames" label="灞炴��1" min-width="100px"></el-table-column> - <el-table-column prop="attrSecodNames" label="灞炴��2" min-width="100px"></el-table-column> - <el-table-column prop="zdPrice" label="鎸囧浠凤紙鍏冿級" min-width="100px"></el-table-column> + <el-table-column prop="baseZdPrice" label="鎸囧浠凤紙鍏冿級" min-width="100px"></el-table-column> + <el-table-column prop="basePrice" label="閲囪喘浠�(鍏�)" min-width="100px"></el-table-column> <el-table-column prop="price" label="鍏ユ墜浠凤紙鍏冿級" min-width="100px"></el-table-column> <el-table-column prop="createDate" label="鍒涘缓鏃堕棿" min-width="100px"></el-table-column> <el-table-column prop="status" label="鐘舵��" min-width="100px"> <template slot-scope="{row}"> - <el-switch - v-model="row.status" - @change="changeStatus(row)" - active-color="#13ce66" - inactive-color="#ff4949" - :active-value="0" - :inactive-value="1"> - </el-switch> + <el-switch + v-model="row.status" + @change="changeStatus(row)" + active-color="#13ce66" + inactive-color="#ff4949" + :active-value="0" + :inactive-value="1"> + </el-switch> </template> </el-table-column> <el-table-column @@ -121,6 +125,8 @@ </template> <!-- 鏂板缓/淇敼 --> <OperaGoodsWindow ref="operaGoodsWindow" @success="handlePageChange"/> + <!-- 閫夋嫨骞冲彴鍟嗗搧 --> + <selectProduct ref="selectProduct" @success="handlePageChange" @result="search"/> </TableLayout> </template> @@ -129,12 +135,13 @@ import TableLayout from '@/layouts/TableLayout' import Pagination from '@/components/common/Pagination' import OperaGoodsWindow from '@/components/business/OperaGoodsWindow' + import selectProduct from '@/components/business/selectProduct' import { brand, category, importExcel } from '@/api/system/common.js' - import { updateDisableById, queryById, exportDoc } from '@/api/business/goods.js' + import { updateDisableById, queryById, exportDoc, batchUpdateDisableById } from '@/api/business/goods.js' export default { name: 'Goods', extends: BaseTable, - components: { TableLayout, Pagination, OperaGoodsWindow }, + components: { TableLayout, Pagination, OperaGoodsWindow, selectProduct }, data () { return { // 鎼滅储 @@ -145,11 +152,12 @@ categoryId: '', brandId: '' }, + ids: '', categoryList: [], brandList: [], statusList: [ - { name: '鍚敤', id: 0 }, - { name: '绂佺敤', id: 1 } + { name: '鍚敤', id: 0 }, + { name: '绂佺敤', id: 1 } ] } }, @@ -165,8 +173,26 @@ this.getcategory() }, methods: { + handleSelectionChange(e) { + let arr = e.map(item => item.id) + this.ids = arr.join(',') + console.log(this.ids) + }, + // 鎵归噺涓婁笅鏋� + bulkOperation(type) { + if (!this.ids) { + this.$message.warning({ message: '鑷冲皯閫夋嫨涓�椤瑰唴瀹�' }) + return + } + batchUpdateDisableById({ + ids: this.ids, + status: type + }).then(res => { + this.$message.success({ message: res }) + this.search() + }) + }, downloadFile() { - // window.open(`${process.env.VUE_APP_API_PREFIX}/business/goods/export`) exportDoc({}) .then(response => { this.download(response) -- Gitblit v1.9.3