Files
tcwm-uniapp-shop/my/store/guige.vue
2024-06-06 11:49:50 +08:00

195 lines
4.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view style="padding-bottom: 70px;">
<view>
<view class="" >
<view class="bg btnbox" v-for="(item,index) in list" :key="index" v-if="list.length>0">
<view class="padding-sm" style="color:#666666;">创建时间 {{item.createTime}}</view>
<view style="width:100%;border-top: 1upx solid #E6E6E6;"></view>
<view class="padding-sm">
<view class="text-lg text-bold" style="color:#333333;">{{item.ruleName}}</view>
<view v-for="(name,index) in item.ruleValue">
<view class="flex align-center padding-top">
<view style="color:#999999;">{{name.value}}:</view>
<view v-for="(ite,index) in name.detail" :key="index">{{ite}}
</view>
</view>
</view>
</view>
<view class="flex justify-end padding-tb">
<view class="btn " @click="bindupdete(item)">删除</view>
<view class="btn1" @click="bindeditor(item)">重新编辑</view>
</view>
</view>
</view>
<view class="addguige text-bold" @click="goEditor()">添加</view>
</view>
<empty v-if="!list.length" style="z-index:0"></empty>
</view>
</template>
<script>
import empty from '@/components/empty.vue'
export default {
components: {
empty
},
data() {
return {
list: [],
shopId:'',
shopName:'',
}
},
onLoad() {
uni.showLoading({
title: '加载中...'
})
this.shopId = this.$queue.getData("shopId")
this.shopName = this.$queue.getData("shopUserName")
this.getlist()
},
onShow() {
this.getlist()
},
methods: {
goEditor() {
uni.navigateTo({
url: '/my/store/editor'
})
},
getlist() {
let data = {
shopId: this.shopId
}
this.$Request.getA("/selfGoodsRule/list", data).then(res => {
uni.hideLoading()
if (res.code == 0) {
this.list = res.data
for (var i = 0; i < this.list.length; i++) {
for (var a = 0; a < this.list[i].ruleValue.length; a++) {
// this.list[i].ruleValue[a].detail = this.list[i].ruleValue[a].detail.split(',')
this.list[i].ruleValue[a].detail = this.list[i].ruleValue[a].detail.replaceAll(',','/')
}
}
}
});
},
//重新编辑
bindeditor(e) {
console.log(e)
uni.setStorageSync('guige', e)
uni.navigateTo({
url: '/my/store/editor?id=' + e.id
})
},
//删除
bindupdete(e) {
uni.showModal({
title: '提示',
content: '确定要删除当前规格吗?',
cancelText: "取消", // 取消按钮的文字
confirmText: "确定", // 确认按钮文字
showCancel: true, // 是否显示取消按钮,默认为 true
confirmColor: '#f55850',
cancelColor: '#39B54A',
success: (res) => {
if (res.confirm) {
let data = {
id: e.id
}
this.$Request.getA("/selfGoodsRule/delete", data).then(res => {
if (res.code == 0) {
uni.showToast({
title: "删除成功",
icon: 'none'
})
this.getlist();
}else{
uni.showToast({
title: res.msg,
icon: 'none'
})
}
});
} else {
}
}
})
console.log(e)
},
},
onReachBottom: function() {
// this.page = this.page + 1;
// this.getlist();
// if (this.totalCount == this.getlist.length) {
// uni.showToast({
// title: '已经到底了~',
// icon: 'none'
// })
// }
},
onPullDownRefresh: function() {
// this.page = 1;
// this.getlist();
},
}
</script>
<style>
page {
background: #F2F2F2;
}
.bg {
background: #FFFFFF;
}
.btnbox {
margin: 20rpx 30rpx;
border-radius: 20rpx;
}
.btn {
border-radius: 25px;
padding: 6rpx 30rpx;
border: 1px solid #686868;
color: #686868;
margin-right: 30rpx;
}
.btn1 {
border-radius: 25px;
padding: 6rpx 30rpx;
background: #FCD202;
/* color: #686868; */
margin-right: 30rpx;
}
.addguige {
width: 90%;
margin: 0 auto;
background: #FCD202;
box-shadow: 0px 10upx 20upx 0px #FFD9B3;
border-radius: 16upx;
text-align: center;
height: 88upx;
line-height: 88upx;
position: fixed;
bottom: 25upx;
left: 0;
right: 0;
z-index: 99;
}
</style>