Ver Fonte

选择商品

pengyh há 1 ano atrás
pai
commit
fc52a1a3d4

+ 22 - 4
src/views/mallManagement/goods/goodsWarehouse/detail.vue

@@ -1,9 +1,9 @@
 <template>
-	<template-page ref="pageRef" :get-list="getList"
+	<template-page v-if="isShowTab" ref="pageRef" :get-list="getList"
 		:table-attributes="tableAttributes" :table-events="tableEvents" :options-evens-group="optionsEvensGroup"
 		:moreParameters="moreParameters" :column-parsing="columnParsing" :operation="operation()":operationColumnWidth="80">
 		<div class="footer">
-			<el-button size="mini" @click="close()">取消</el-button>
+			<el-button size="mini" @click="cancel()">取消</el-button>
 			<el-button size="mini" @click="formConfirm()" type="primary">确定</el-button>
 		</div>
 	</template-page>
@@ -19,6 +19,7 @@
 			TemplatePage
 		},
 		mixins: [operation_mixin],
+		props: ['isSelectShop'],
 		data() {
 			return {
 				// 表格属性
@@ -57,7 +58,17 @@
 				formVisible: false,
 				stepIndex: 1,
 				isEdit: 0,
-				editSpecImageIdx: 0
+				editSpecImageIdx: 0,
+				isShowTab: true
+			}
+		},
+		watch: {
+			isSelectShop(){
+				this.isShowTab = false
+				this.recordSelected = []
+				this.$nextTick(()=>{
+					this.isShowTab = true
+				})
 			}
 		},
 		computed: {
@@ -132,7 +143,10 @@
 				if (this.recordSelected.length == 0) {
 					return this.$message.warning('请至少勾选一条数据!');
 				}
-				this.$emit('selectShop',this.recordSelected[0])
+				this.$emit('selectShop',this.recordSelected[0].goodsLibraryId)
+			},
+			cancel(){
+				this.$emit('selectShop')
 			}
 		}
 	}
@@ -166,4 +180,8 @@
 		box-sizing: border-box;
 		text-align: right;
 	}
+	::v-deep .zj-page-fill{
+		max-height: 360px !important;
+		overflow-y: auto;
+	}
 </style>

+ 3 - 20
src/views/mallManagement/goods/goodsWarehouse/index.vue

@@ -13,7 +13,6 @@
 							<el-radio-button :label="true">已开启</el-radio-button>
 						</el-radio-group>
 						<br><br>
-						<el-button size="mini" @click="isShow = true">选择商品</el-button>
 					</div>
 				</template-page>
 				<div v-if="~['add', 'edit', 'detail'].indexOf(activeKey)">
@@ -73,7 +72,7 @@
 												</el-form-item>
 											</el-col>
 											<el-col :span="24">
-												<el-form-item label="商品描述" prop="describeText" :rules="[{ required: true, message: `请输入商品描述`, trigger: 'blur' }]">
+												<el-form-item label="商品描述" prop="describeText">
 													<el-input type="textarea" :rows="3" v-model="formData.describeText" placeholder="请输入"></el-input>
 													<div class="hui">商品描述将显示在商品详情,让用户更了解商品细节</div>
 												</el-form-item>
@@ -199,10 +198,6 @@
 				</div>
 			</template>
 		</zj-tab-page>
-		<!-- 批量设置模块 -->
-		<el-dialog title="选择商品" :visible.sync="isShow" width="80%" style="" :close-on-click-modal="false" :modal-append-to-body="false">
-		  <detail @selectShop="selectShop"></detail>
-		</el-dialog>
 	</div>
 </template>
 
@@ -210,14 +205,13 @@
 	import TemplatePage from '@/components/template/template-page-1.vue'
 	import import_mixin from '@/components/template/import_mixin.js'
 	import ImageUpload from '@/components/file-upload'
-	import detail from './detail'
 	import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
 	import { listPageV2, pageExport, save, del, getDetail, batch, sync } from "@/api/goodsWarehouse";
 	import operation_mixin from '@/components/template/operation_mixin.js'
 	import quillEditor from '@/components/v-quill-editor'
 	export default {
 		components: {
-			TemplatePage,ImageUpload,quillEditor,detail
+			TemplatePage,ImageUpload,quillEditor
 		},
 		mixins: [import_mixin, operation_mixin],
 		data() {
@@ -256,9 +250,7 @@
 				formType: 'add',
 				formVisible: false,
 				stepIndex: 1,
-				isEdit: 0,
-				editSpecImageIdx: 0,
-				isShow: false
+				isEdit: 0
 			}
 		},
 		computed: {
@@ -328,15 +320,6 @@
 			changeType(){
 				this.$refs.pageRef.refreshList()
 			},
-			selectShop(data){
-				this.isShow = false
-				console.log(data)
-			},
-			// 编辑规格图 - 点击图片
-			editSpecImage(index) {
-			  this.editSpecImageIdx = index;
-			  document.querySelector('.editSpecimage-uploader input').click();
-			},
 			// 表格列解析渲染数据更改
 			columnParsing(item, defaultData) {
 				if (item.jname === 'imgUrl') {

+ 71 - 6
src/views/mallManagement/goods/goods_add/index.vue

@@ -78,7 +78,10 @@
           </el-col>
           <el-col :span="24">
             <el-form-item label="商品名称:" prop="goodsName">
-              <el-input v-model="step1Form.goodsName" placeholder="请输入商品名称" maxlength="200" show-word-limit></el-input>
+              <div style="display: flex">
+				  <el-input v-model="step1Form.goodsName" placeholder="请输入商品名称" maxlength="200" show-word-limit></el-input>
+				  <el-button v-if="type == 'add'" size="mini" @click="isSelectShop = true" type="primary">从商品库选择</el-button>
+			  </div>
             </el-form-item>
           </el-col>
           <el-col :span="24">
@@ -391,7 +394,10 @@
         </el-popconfirm>
       </div>
     </div>
-
+	<!-- 选择商品 -->
+	<el-dialog title="选择商品" :visible.sync="isSelectShop" width="90%" style="max-height: 95vh;overflow-y: auto;" :close-on-click-modal="false" :modal-append-to-body="false">
+	  <selectShopDetail @selectShop="selectShop" :isSelectShop="isSelectShop"></selectShopDetail>
+	</el-dialog>
   </div>
 </template>
 
@@ -404,6 +410,8 @@ import 'quill/dist/quill.core.css'
 import 'quill/dist/quill.snow.css'
 import 'quill/dist/quill.bubble.css'
 import { EventBus } from '@/utils/eventBus'
+import selectShopDetail from '../goodsWarehouse/detail'
+import { getDetail } from "@/api/goodsWarehouse";
 // 工具栏配置
 const toolbarOptions = [
   ['bold', 'italic', 'underline', 'strike'],
@@ -424,7 +432,7 @@ const toolbarOptions = [
 
 export default {
   components: {
-    quillEditor
+    quillEditor,selectShopDetail
   },
   filters: {
     unitFilter(val) {
@@ -548,7 +556,8 @@ export default {
       tagList: [], // 标签列表
 
       showImageListUpload2: false,
-
+	  type: 'add',
+	  isSelectShop: false //选择商品库
     }
   },
 
@@ -561,7 +570,8 @@ export default {
   },
 
   async created() {
-    const { id } = this.$route.query;
+    const { id,type } = this.$route.query;
+	this.type = type
     this.isEdit = id ? true : false;
     this.editId = id;
 
@@ -580,7 +590,62 @@ export default {
 
   },
   methods: {
-
+	//选择商品库商品
+	selectShop(goodsLibraryId){
+		this.isSelectShop = false
+		if(goodsLibraryId){
+			getDetail({
+				goodsLibraryId
+			}).then(res => {
+				let imgs = []
+				let goodsLibrarySpecList = []
+				res.data.imgs.split(",").forEach(item=>{
+					imgs.push({
+						url: item
+					})
+				})
+				res.data.goodsLibrarySpecList.forEach(item=>{
+					goodsLibrarySpecList.push({
+						goodsCode: '', // 物料编号
+						mainId: '', // 大类id
+						mainName: '', // 大类名称
+						smallId: '', // 小类id
+						smallName: '', // 小类名称
+						specValue: item.specValue, // 商品名称
+						specsName: '', // 规格名称
+						unit: '', // 单位
+						price: item.price, // 销售价格
+						orgPrice: item.orgPrice, // 划线价格
+						costAmount: item.costPrice, // 成本价格
+						shareAmount: item.shareAmount, // 分销金额
+						innerShareAmount: item.innerShareAmount, // 内部分销金额
+						stockNum: '', // 上架库存
+						stockQty: '', // 当前库存
+						imgUrl: item.imgUrl, // 图片
+					})
+				})
+				this.step1Form = {
+				  isTrade: 'NO', // 是否以旧换新
+				  tradeRemark: '', // 以旧换新描述
+				  brand: {}, // 品牌
+				  orderSmallType: '', // 工单类型
+				  isVr: false, // 是否虚拟商品
+				  classify: '', // 商品分类
+				  attrs: [], // 商品属性
+				  tags: [], // 商品标签
+				  goodsName: res.data.goodsName, // 商品名称
+				  goodsDes: res.data.describeText, // 商品描述
+				  imgUrl: res.data.imgUrl, // 商品主图
+				  videoUrl: res.data.vedio, // 商品视频
+				  images: res.data.imgs?imgs:[], // 轮播图
+				}
+				this.specList = goodsLibrarySpecList
+				this.step3Form.detailContent = res.data.content
+			})
+			
+		}
+	},
+	
     // 获取商品分类列表
     async getClassifyList() {
       return new Promise((resolve, reject) => {

+ 2 - 2
src/views/mallManagement/goods/goods_index/index.vue

@@ -480,13 +480,13 @@ export default {
       if(type == 'add') {
         this.$router.push({
           name: 'goods_add',
-          query: {}
+          query: {type}
         })
       }else {
         this.$router.push({
           name: 'goods_add',
           query: {
-            id
+            id,type
           }
         })
       }