Przeglądaj źródła

小菊修改名称

shish 3 lat temu
rodzic
commit
703d25e752

+ 55 - 4
ghsApp/src/admin/item/xjSelect.vue

@@ -47,7 +47,10 @@
 										<image :src="xjItem.cover"></image>
 										<image :src="xjItem.cover"></image>
 									</view>
 									</view>
 									<view class="cmd-info_bx">
 									<view class="cmd-info_bx">
-										<view class="tit">{{ xjItem.name || "" }}</view>
+										<view class="tit">
+										{{ xjItem.name || "" }}
+										<text @click="changeNameFn(xjItem)" style="color:#3385ff;margin-left:32upx;font-size:30upx;">修改</text>
+										</view>
 										<view class="kc"></view>
 										<view class="kc"></view>
 										<view class="num-open_bx">
 										<view class="num-open_bx">
 											<view class="open-bx warn" @tap.stop.prevent>
 											<view class="open-bx warn" @tap.stop.prevent>
@@ -71,6 +74,18 @@
 			<button class="admin-button-com big blue" style="margin-left:50upx;" @click="saveAllItemNum()">保存修改</button>
 			<button class="admin-button-com big blue" style="margin-left:50upx;" @click="saveAllItemNum()">保存修改</button>
 		</view>
 		</view>
 
 
+		<modal-module :show="changeShow" @click="confirmChange" :maskClosable="true" title="修改名称" padding="30rpx 30rpx" >
+		<template v-slot:content>
+			<div class="app-modal-input-wrap">
+			<div class="inp-list-line">
+				<div class="line-input">
+				<input type="text" style="width:61%;text-align:center;" :focus="changeFocus" v-model="xjName" class="inp-input" />
+				</div>
+			</div>
+			</div>
+		</template>
+		</modal-module>
+
 	</view>
 	</view>
 </template>
 </template>
 <script>
 <script>
@@ -79,7 +94,8 @@ import AppWrapperEmpty from "@/components/app-wrapper-empty"
 import {getProductDetail } from "@/api/product";
 import {getProductDetail } from "@/api/product";
 import { changeVariety } from "@/api/item"
 import { changeVariety } from "@/api/item"
 import { mapGetters } from "vuex"
 import { mapGetters } from "vuex"
-import { getFilterXj,ReplaceXj,clearAll,batchAdd,saveAllNum } from "@/api/product/xj"
+import ModalModule from "@/components/plugin/modal"
+import { getFilterXj,ReplaceXj,clearAll,batchAdd,saveAllNum,changeXjName } from "@/api/product/xj"
 //图片上传插件来源:https://ext.dcloud.net.cn/plugin?id=2922 已改造,不能再升级 shish 20211228
 //图片上传插件来源:https://ext.dcloud.net.cn/plugin?id=2922 已改造,不能再升级 shish 20211228
 import htzImageUpload from './components/htz-image-upload/htz-image-upload.vue'
 import htzImageUpload from './components/htz-image-upload/htz-image-upload.vue'
 export default {
 export default {
@@ -87,7 +103,8 @@ export default {
 	components: {
 	components: {
 		AppWrapperEmpty,
 		AppWrapperEmpty,
 		htzImageUpload,
 		htzImageUpload,
-		TuiListCell
+		TuiListCell,
+		ModalModule
 	},
 	},
 	mixins: [],
 	mixins: [],
 	data() {
 	data() {
@@ -99,7 +116,10 @@ export default {
 			uploadXjImg:[],
 			uploadXjImg:[],
 			xjImgData:[],
 			xjImgData:[],
 			headers:{token:''},
 			headers:{token:''},
-			variety:0
+			variety:0,
+			xjName:'',
+			xjId:0,
+			changeShow:false
 		};
 		};
 	},
 	},
 	computed:{
 	computed:{
@@ -126,6 +146,37 @@ export default {
 
 
 	},
 	},
 	methods: {
 	methods: {
+		confirmChange(val) {
+			let that=this;
+			if (val.index == 0) {
+				that.changeShow = false
+				that.changeFocus = false
+				return
+			}
+			if(this.$util.isEmpty(this.xjName)){
+				this.$msg('请填写名称')
+				return false
+			}
+			changeXjName({name:this.xjName,id:this.xjId}).then(res=>{
+				that.changeShow = false
+				that.changeFocus = false
+				if(res.code == 1){
+					that.$msg(res.msg)
+					that.initXj()
+				}
+			})
+    	},
+		changeNameFn(item){
+			this.xjName = item.name
+			this.xjId = item.id
+			this.changeShow = true
+			setTimeout(x => {
+				this.$nextTick(() => this.setFocus())
+			}, 200)
+		},
+		setFocus() {
+			this.changeFocus = true
+		},
 		varietyChangeFn(e){
 		varietyChangeFn(e){
 			let that = this
 			let that = this
 			this.variety = e.detail.value ? 1 : 0
 			this.variety = e.detail.value ? 1 : 0

+ 4 - 0
ghsApp/src/api/product/xj.js

@@ -1,5 +1,9 @@
 import https from "@/plugins/luch-request_0.0.7/request";
 import https from "@/plugins/luch-request_0.0.7/request";
 
 
+export const changeXjName = data => {
+	return https.get("/xj/change-xj-name", data);
+};
+
 export const saveAllNum = data => {
 export const saveAllNum = data => {
 	return https.post("/xj/save-all-num", data);
 	return https.post("/xj/save-all-num", data);
 };
 };