tianyi 3 weeks ago
parent
commit
30c9d46496
  1. 287
      package1/myCenter/addType.vue
  2. 2
      package1/myCenter/myMerchant.vue

287
package1/myCenter/addType.vue

@ -10,6 +10,64 @@
</view> </view>
</view> </view>
</view> </view>
<view class="card-list">
<ul>
<li v-for="(item, index) in indexList" :key="index" style="height: 50px;line-height: 50px;padding-left: 20px;border-bottom: 1px solid #eee;overflow: hidden;">
<view class="name">
<text>{{item.categoryName}}</text>
</view>
<button class="bj-btn" @tap.stop="inputDialogToggle('edit', item)">编辑</button>
</li>
</ul>
</view>
<view style="width: 100%;position: fixed;bottom:0;background: #fff;z-index: 99;height: 86px;">
<view class="add-btn" @tap="inputDialogToggle('add')">添加分类</view>
</view>
<!-- 添加分类弹出层 -->
<uni-popup ref="addTypeDialog" background-color="#fff">
<view class="add-popup-content">
<view class="add-popup-title">
<text>新增分类</text>
<uni-icons @tap='close' type="closeempty" color='red' size="16"
style="height:40rpx;line-height: 40rpx;position: absolute !important;bottom:0;right: 30rpx;"></uni-icons>
</view>
<view class="add-popup-container">
<input type="text" v-model="typeText" class="add-input" placeholder="请输入分类名称">
<input type="text" v-model="sortText" class="add-input" placeholder="可设置分类排序">
<view class="add-popup-bottom">
<view class="add-popup-btn" @tap="dialogInputConfirm">确认</view>
</view>
</view>
</view>
</uni-popup>
<!-- 新增编辑分类弹窗 -->
<uni-popup ref="delDialog" type="dialog">
<view class="type-popup"
style="width:100%;margin-bottom: 0;border-radius: 0;height: 650rpx;border-radius: 10px;">
<view style="height: 120rpx;font-size: 36rpx;font-weight: bold;line-height: 120rpx;text-align: center;">
编辑分类
</view>
<view style="height: 80rpx;font-size: 28rpx;line-height: 80rpx;text-align: center;">
请在下方输入框中输入分类名
</view>
<view style="width: 90%;margin: 40rpx auto 0;">
分类名称
<uni-easyinput type="text" v-model="inputVal" placeholder="请输入规格值" />
</view>
<view style="width: 90%;margin: 40rpx auto 0;">
排序<uni-easyinput type="text" v-model="sortTextEdit" placeholder="可设置排序" />
</view>
<view
style="width: 100%;height: 90rpx;line-height: 90rpx;text-align: center;border-radius: 0;color: #fff;display: flex;position: absolute;bottom: 0;">
<view style="flex: 1;background: linear-gradient(90deg, #60F3FF, #088FEB);" @tap="delItem">删除
</view>
<view style="flex: 1;background: linear-gradient(90deg, #FF9797, #FFC1E0);"
@tap="dialogInputConfirm">确认</view>
</view>
</view>
</uni-popup>
<u-modal :show="show" :title="'删除'" :content="'是否确认删除此分类?'" showCancelButton="true" @cancel="show = false"
@confirm="delItemModal"></u-modal>
</view> </view>
</template> </template>
@ -17,7 +75,16 @@
export default { export default {
data() { data() {
return { return {
show: false,
indexList: [],
inputVal: '',
menuButtonInfo: {},
multipleList:[],
sortText:'',
sortTextEdit:'',
typeText:'',
editItem: {},
delItems: {},
} }
}, },
filters: { filters: {
@ -25,11 +92,133 @@
}, },
onShow() { onShow() {
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect() this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
}, },
onLoad(option) { onLoad(option) {
this.getGategoryList()
}, },
methods: { methods: {
//
getGategoryList() {
this.tui.request("/app/productCategory/list", "get",{
shopId:uni.getStorageSync('shopId')
}, false, false).then((res) => {
if (res.code == 200) {
this.indexList = res.result;
} else {
this.tui.toast(res.message)
}
}).catch(() => {});
},
delItem(item, type) {
this.show = true
},
delItemModal() {
this.show = false;
this.tui.request("/app/productCategory/delById", "POST",{
id: this.editItem.id,
}, false, true).then((res) => {
if (res.code == 200) {
this.getGategoryList()
uni.showToast({
title: "删除成功",
icon: 'none'
})
this.$refs.carPopup.close()
this.$refs.delDialog.close()
} else {
uni.showToast({
title: "删除失败",
icon: 'none'
})
}
}).catch(() => {});
},
//
dialogInputConfirm() {
let that = this;
switch (that.typeModel) {
case 'add':
for (let i = 0; i < that.indexList.length; i++) {
if (that.indexList[i].categoryName == that.typeText) {
uni.showToast({
title: "请勿重复添加!",
icon: 'error'
})
return
}
}
if(that.typeText == ''){
that.tui.toast("请输入分类名")
return
}
this.tui.request("/app/productCategory/save", "POST",{
categoryName: that.typeText,
sort: that.sortText,
productAttributeOfAddVos:that.multipleList,
shopId:uni.getStorageSync('shopId')
}, false, true).then((res) => {
if (res.code == 200) {
that.tui.toast("添加成功")
that.$refs.addTypeDialog.close()
that.sortText = ''
that.getGategoryList()
} else {
that.tui.toast("添加失败")
}
}).catch(() => {});
that.typeText = ''
that.inputVal = ''
that.multipleList = []
break;
case 'edit':
this.tui.request("/app/productCategory/edit", "POST",{
categoryName: this.inputVal,
sort: that.sortTextEdit,
id: that.editItem.id,
shopId:uni.getStorageSync('shopId')
}, false, true).then((res) => {
if (res.code == 200) {
that.getGategoryList()
that.sortText = ''
uni.showToast({
title: "修改成功",
icon: 'none'
})
} else {
uni.showToast({
title: "修改失败",
icon: 'none'
})
}
}).catch(() => {});
break;
default:
}
that.$refs.delDialog.close()
this.inputVal = ""
this.$forceUpdate()
},
//
inputDialogToggle(type, item, parent) {
this.typeModel = type;
if (type == 'edit') {
this.inputVal = item.categoryName;
this.editItem = item;
this.sortTextEdit = (this.editItem.sort == null || this.editItem.sort == 'null') ? '' : this.editItem
.sort
this.$refs.delDialog.open('bottom')
} else if (type == 'add') {
this.inputVal = '';
this.isOpenId = item;
this.dialogTit = '输入分类名'
this.$refs.addTypeDialog.open('bottom')
}
},
back() { back() {
uni.navigateBack() uni.navigateBack()
}, },
@ -56,7 +245,7 @@
.title { .title {
background: url('https://jewel-shop.oss-cn-beijing.aliyuncs.com/8bc15960c2dc40268e295d6dd23aecce.png') no-repeat; background: url('https://jewel-shop.oss-cn-beijing.aliyuncs.com/8bc15960c2dc40268e295d6dd23aecce.png') no-repeat;
width: 100%; width: 100%;
height: 54%; height: 20%;
} }
.title-sreach { .title-sreach {
@ -68,7 +257,7 @@
.back-btn { .back-btn {
position: absolute; position: absolute;
bottom: 0; top: 0;
left: 0; left: 0;
} }
@ -79,4 +268,94 @@
flex: 1; flex: 1;
text-align: center; text-align: center;
} }
.card-list {
width: 95%;
border-radius: 10upx;
background: #fff;
height: auto;
margin: -60px auto;
}
.name {
width: 75%;
float: left;
display: flex;
}
.bj-btn {
width: 88rpx;
height: 50rpx;
font-size: 24rpx;
padding: 0;
line-height: 50rpx;
border-radius: 50rpx;
margin-top: 26rpx;
}
.type-popup {
width: 500rpx;
height: auto;
background: #fff;
border-radius: 10px;
position: relative;
margin-bottom: 40rpx;
}
.add-btn {
width: 95%;
height: 50px;
margin: 10px auto 0;
background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1));
font-size: 16px;
font-weight: 700;
text-align: center;
line-height: 50px;
border-radius: 50px;
}
.add-popup-content {
align-items: center;
justify-content: center;
padding: 30rpx;
width: 100%;
height: 400rpx;
background-color: #fff;
}
.add-popup-title {
font-size: 36rpx;
font-weight: bold;
text-align: center;
position: relative;
}
.add-popup-container {
margin-top: 20rpx;
}
.add-popup-bottom {
display: flex;
height: 80rpx;
color: #fff;
line-height: 80rpx;
margin-top: 50rpx;
}
.add-popup-btn {
flex: 1;
text-align: center;
background: rgba(0, 35, 28, 1);
border-radius: 40px;
color: rgba(166, 255, 234, 1);
}
.add-input{
width: 100%;
border: 1px solid #eee;
height: 80rpx;
padding-left: 20rpx;
margin:20rpx 0;
font-size: 25rpx;
line-height: 80rpx;
}
</style> </style>

2
package1/myCenter/myMerchant.vue

@ -323,7 +323,7 @@
this.formData.shopImages = this.formData.zhengzhao + '@@' + this.formData.fanzhao + '@@' + this.formData.yingyezhizhao + '@@' + JSON.stringify(this.formData.qita) this.formData.shopImages = this.formData.zhengzhao + '@@' + this.formData.fanzhao + '@@' + this.formData.yingyezhizhao + '@@' + JSON.stringify(this.formData.qita)
that.tui.request(url, "post", this.formData, false, true).then((res1) => { that.tui.request(url, "post", this.formData, false, true).then((res1) => {
if (res1.code == 200) { if (res1.code == 200) {
uni.setStorageSync('schoolShopId',res1.result.shopId) uni.setStorageSync('schoolShop',res1.result)
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '提交成功,请等待管理员审核', content: '提交成功,请等待管理员审核',

Loading…
Cancel
Save