platform/src/components/business/OperaGoodsWindow.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
platform/src/components/business/selectProduct.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
platform/src/components/business/selectProductItem.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
platform/src/views/business/goods.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
platform/src/components/business/OperaGoodsWindow.vue
@@ -4,8 +4,9 @@ :visible.sync="visible" :confirm-working="isWorking" @confirm="confirm" width="800px" > <el-form :model="form" ref="form" :rules="rules"> <el-form :model="form" ref="form" label-width="120px" :rules="rules"> <div style="font-size: 18px;font-weight: bold;">åºæ¬ä¿¡æ¯</div> <el-form-item label="åååç§°" prop="name"> <el-input v-model="form.name" maxlength="50" placeholder="请è¾å ¥åååç§°ï¼ä¸è¶ è¿50个å" v-trim/> @@ -31,7 +32,7 @@ </el-option> </el-select> </el-form-item> <el-form-item :label="name1" prop="attrFirstIds" v-if="name1"> <!-- <el-form-item :label="name1" prop="attrFirstIds" v-if="name1"> <el-select v-model="form.attrFirstIds" multiple placeholder="è¯·éæ©ï¼æ¯æå¤é"> <el-option v-for="item in form.attrFirstList" @@ -50,7 +51,7 @@ :value="item.id"> </el-option> </el-select> </el-form-item> </el-form-item> --> <el-form-item label="æå¯¼ä»·ï¼å ï¼" prop="zdPrice"> <el-input v-model="form.zdPrice" @input="priceCHANEG(form.zdPrice, 1)" type="number" placeholder="建议å½å ¥æ´æ°ï¼åä½å " v-trim/> </el-form-item> @@ -61,7 +62,7 @@ <el-upload :action="action" :file-list="form.ztList" :data="{ folder: 'projects' }" :data="{ folder: 'goods_img' }" list-type="picture-card" :limit="1" :on-success="fileSuccess" @@ -76,7 +77,7 @@ :action="action" :file-list="form.files" :multiple="true" :data="{ folder: 'projects' }" :data="{ folder: 'goods_img' }" list-type="picture-card" :on-success="fileSuccess1" :on-remove="handleRemove1"> @@ -84,10 +85,12 @@ <div slot="tip" class="el-upload__tip">åªè½ä¸ä¼ å¾çæ ¼å¼ï¼pngæ ¼å¼ï¼å»ºè®®å°ºå¯¸600*600px</div> </el-upload> </el-form-item> <template v-if="form.goodsParamList && form.goodsParamList.length > 0"> <div style="font-size: 18px;font-weight: bold;">忰屿§å¼é ç½® <span style="font-size: 13px; font-weight: 500;">æéé ç½®å½åååç产ååæ°å¼ï¼åä¸ªåæ°å¼ä¸è¶ è¿30个å</span></div> <el-form-item :label="item.name" v-for="(item, index) in form.goodsParamList" :key="index"> <el-input v-model="item.val" maxlength="30" type="text" placeholder="请è¾å ¥" v-trim/> </el-form-item> </template> </el-form> </GlobalWindow> </template> @@ -96,14 +99,14 @@ import BaseOpera from '@/components/base/BaseOpera' import GlobalWindow from '@/components/common/GlobalWindow' import { brand } from '@/api/system/common.js' import { findListForGoodsId, create, updateById } from '@/api/business/goods.js' import { findListForGoodsId, create, updateById, companyCreate, companyUpdateById } from '@/api/business/goods.js' export default { name: 'OperaGoodsWindow', extends: BaseOpera, components: { GlobalWindow }, data () { return { action: process.env.VUE_APP_API_PREFIX + '/public/uploadLocal', action: process.env.VUE_APP_API_PREFIX + '/public/upload', name1: '', name2: '', // è¡¨åæ°æ® @@ -259,7 +262,7 @@ this.form.attrSecodIds = '' } if (!this.form.id) { create(this.form) companyCreate({...this.form, type: 0}) .then(() => { this.visible = false this.$tip.apiSuccess('æ°å»ºæå') @@ -272,7 +275,7 @@ this.isWorking = false }) } else { updateById(this.form) companyUpdateById({...this.form, type: 0}) .then(() => { this.visible = false this.$tip.apiSuccess('ç¼è¾æå') @@ -338,3 +341,10 @@ } </script> <style lang="scss" scoped> ::v-deep .el-form-item__content { .el-input { width: 400px; } } </style> platform/src/components/business/selectProduct.vue
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,119 @@ <template> <GlobalWindow :title="title" :visible.sync="visible" :confirm-working="isWorking" @confirm="confirm"> <el-form :model="form" ref="form" :rules="rules"> <el-form-item label="ååç±»å«" prop="categoryId"> <el-select v-model="form.categoryId" placeholder="è¯·éæ©"> <el-option v-for="item in categoryList" :key="item.id" :label="item.name" :value="item.id"> </el-option> </el-select> </el-form-item> <el-form-item label="ååèå´" prop="type"> <el-radio-group v-model="form.type"> <el-radio :label="0">å ¨é¨</el-radio> <el-radio :label="1">é¨å</el-radio> </el-radio-group> </el-form-item> <el-form-item label="å ä»·ç³»æ°" prop="rate"> <el-input v-model="form.rate" placeholder="å¹³å°éè´ä»·*å ä»·ç³»æ°ï¼ä½ä¸ºåèåºæä»·ï¼å»ºè®®è¾å ¥å¤§äº1çæ°å" v-trim /> </el-form-item> </el-form> <!-- 鿩平å°åå --> <selectProductItem ref="selectProductItem" @result="result" /> </GlobalWindow> </template> <script> import BaseOpera from '@/components/base/BaseOpera' import GlobalWindow from '@/components/common/GlobalWindow' import selectProductItem from '@/components/business/selectProductItem' import { baseCategoryList } from '@/api/business/category.js' import { createPlat } from '@/api/business/goods' export default { name: 'OperaBrandWindow', extends: BaseOpera, components: { GlobalWindow, selectProductItem }, data() { return { categoryList: [], // è¡¨åæ°æ® form: { categoryId: '', type: 0, rate: '' }, // éªè¯è§å rules: { categoryId: [ { required: true, message: 'ååç±»å«ä¸è½ä¸ºç©º', trigger: 'blur' } ], type: [ { required: true, message: 'ååèå´ä¸è½ä¸ºç©º', trigger: 'blur' } ], rate: [ { required: true, message: 'å ä»·ç³»æ°ä¸è½ä¸ºç©º', trigger: 'blur' } ] } } }, created() { this.config({ api: '/business/anchor', 'field.id': 'id' }) }, methods: { result() { // this.$emit('success') this.$emit('result') this.visible = false }, confirm() { this.$refs.form.validate((valid) => { if (!valid) return // æ°å»º if (this.form.type == 0) { this.isWorking = true createPlat({ categoryId: this.form.categoryId, rate: this.form.rate, type: this.form.type }).then(res => { this.visible = false this.$tip.apiSuccess('æä½æå') // this.$emit('success') this.$emit('result') }) .catch(e => { this.$tip.apiFailed(e) }) .finally(() => { this.isWorking = false }) } else { this.$refs.selectProductItem.open('鿩平å°åå', this.form) } }) }, /** * æå¼çªå£ * @title çªå£æ é¢ * @target ç¼è¾ç对象 */ open (title, target) { this.title = title this.visible = true // è·ååç±»å表 baseCategoryList({ type: 1 }) .then(res => { this.categoryList = res }) } } } </script> platform/src/components/business/selectProductItem.vue
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,183 @@ <template> <GlobalWindow :title="title" width="70%" :visible.sync="visible" :confirm-working="isWorking" @confirm="confirm"> <div class="head"> <el-form :inline="true" :model="form" class="demo-form-inline"> <el-form-item label="åååç§°" prop="name"> <el-input v-model="form.name" placeholder="请è¾å ¥åååç§°"></el-input> </el-form-item> <el-form-item label="ç±»å«" prop="categoryId"> <el-select v-model="form.categoryId" disabled placeholder="è¯·éæ©"> <el-option v-for="item in categoryList" :key="item.id" :label="item.name" :value="item.id"> </el-option> </el-select> </el-form-item> <el-form-item> <el-button type="primary" @click="getList">æ¥è¯¢</el-button> </el-form-item> </el-form> </div> <div class="tab"> <el-table :data="tableData" stripe border @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="åååç§°/åå·" show-overflow-tooltip min-width="200px"> <template slot-scope="{row}"> <div style="display: flex; align-items: center;"> <div style="width: 70px; height: 70px; flex-shrink: 0;"> <el-image v-if="row.imgurl" style="width: 70px; height: 70px" :src="row.fullImgUrl" fit="cover"></el-image> </div> {{ row.name }} </div> </template> </el-table-column> <el-table-column prop="brandName" label="åç" show-overflow-tooltip min-width="100px"></el-table-column> <el-table-column prop="categoryName" label="ç±»å«" show-overflow-tooltip min-width="100px"></el-table-column> <el-table-column prop="zdPrice" label="æå¯¼ä»·ï¼å ï¼" show-overflow-tooltip min-width="100px"></el-table-column> <el-table-column prop="price" label="éè´ä»·ï¼å ï¼" show-overflow-tooltip min-width="100px"></el-table-column> <el-table-column label="å ¥æä»·ï¼å ï¼" show-overflow-tooltip min-width="100px"> <template slot-scope="{row}"> <el-input v-model="row.purchasePrice" placeholder="请è¾å ¥"></el-input> </template> </el-table-column> </el-table> <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page" :page-sizes="[10, 20, 30]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total"> </el-pagination> </div> </GlobalWindow> </template> <script> import BaseOpera from '@/components/base/BaseOpera' import GlobalWindow from '@/components/common/GlobalWindow' import { baseCategoryList } from '@/api/business/category.js' import { pageT } from '@/api/business/goods' import { createPlat } from '@/api/business/goods' export default { name: 'OperaBrandWindow', extends: BaseOpera, components: { GlobalWindow }, data() { return { // è¡¨åæ°æ® form: { categoryId: '', type: 0, rate: '', name: '', goodsParamList: [] }, pageSize: 10, page: 1, total: 0, tableData: [], categoryList: [] } }, created() { this.config({ api: '/business/anchor', 'field.id': 'id' }) }, methods: { getList() { pageT({ capacity: this.pageSize, model: { categoryId: this.form.categoryId, name: this.form.name }, page: this.page }).then(res => { res.records.forEach(item => { item.purchasePrice = item.price * this.form.rate }) this.tableData = res.records this.total = res.total }) }, handleCurrentChange(e) { this.page = e this.getList() }, handleSizeChange(e) { this.pageSize = e this.getList() }, handleSelectionChange(e) { let arr = [] e.forEach(item => { arr.push({ goodsId: item.id, price: item.purchasePrice }) }) this.form.goodsParamList = arr console.log(arr) }, confirm() { // è°ç¨æ°å»ºæ¥å£ this.isWorking = true createPlat({ categoryId: this.form.categoryId, goodsParamList: this.form.goodsParamList, rate: this.form.rate, type: this.form.type }).then(res => { this.visible = false this.$tip.apiSuccess('æä½æå') // this.$emit('success') this.$emit('result') }) .catch(e => { this.$tip.apiFailed(e) }) .finally(() => { this.isWorking = false }) }, /** * æå¼çªå£ * @title çªå£æ é¢ * @target ç¼è¾ç对象 */ open(title, target) { this.title = title this.visible = true this.form.categoryId = target.categoryId this.form.rate = Number(target.rate) this.form.type = target.type // è·ååç±»å表 baseCategoryList({}) .then(res => { this.categoryList = res }) this.getList() } } } </script> <style lang="scss" scoped> .head { width: 100%; } </style> platform/src/views/business/goods.vue
@@ -11,70 +11,55 @@ </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 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 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 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> <!-- è¡¨æ ¼åå页 --> <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" v-permissions="['business:goods:exportExcel']" @click="importFile">å¯¼å ¥</el-button> <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 v-loading="isWorking.search" :data="tableData.list" stripe border :header-cell-style="rowStyle" :cell-style="rowStyle" > <el-table v-loading="isWorking.search" :data="tableData.list" stripe 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}"> <div style="display: flex; align-items: center;"> <div style="width: 70px; height: 70px; flex-shrink: 0;"> <el-image v-if="row.imgurl" style="width: 70px; height: 70px" :src="row.prefixUrl + row.imgurl" :preview-src-list="[row.prefixUrl + row.imgurl]" fit="cover"></el-image> <el-image v-if="row.imgurl" style="width: 70px; height: 70px" :src="row.prefixUrl + row.imgurl" :preview-src-list="[row.prefixUrl + row.imgurl]" fit="cover"></el-image> </div> {{ row.name }} </div> @@ -82,45 +67,35 @@ </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 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 v-if="containPermissions(['business:goods:update', 'business:goods:delete'])" label="æä½" min-width="120" fixed="right" > <el-table-column v-if="containPermissions(['business:goods:update', 'business:goods:delete'])" label="æä½" min-width="120" fixed="right"> <template slot-scope="{row}"> <el-button type="text" @click="edit(row.id)" icon="el-icon-edit" v-permissions="['business:goods:update']">ç¼è¾</el-button> <el-button type="text" @click="deleteById(row)" icon="el-icon-delete" v-permissions="['business:goods:delete']">å é¤</el-button> <el-button type="text" @click="edit(row.id)" icon="el-icon-edit" v-permissions="['business:goods:update']">ç¼è¾</el-button> <el-button type="text" @click="deleteById(row)" icon="el-icon-delete" v-permissions="['business:goods:delete']">å é¤</el-button> </template> </el-table-column> </el-table> <input type="file" ref="upload" style="display: none;" @change="uplaodFile" /> <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination" > <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination"> </pagination> </template> <!-- æ°å»º/ä¿®æ¹ --> <OperaGoodsWindow ref="operaGoodsWindow" @success="handlePageChange"/> <!-- 鿩平å°åå --> <selectProduct ref="selectProduct" @success="handlePageChange" @result="search" /> </TableLayout> </template> @@ -129,12 +104,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,6 +121,7 @@ categoryId: '', brandId: '' }, ids: '', categoryList: [], brandList: [], statusList: [ @@ -165,8 +142,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) @@ -257,4 +252,3 @@ } } </script>