首次提交

This commit is contained in:
duan
2024-06-06 11:49:50 +08:00
parent de480ef0a3
commit c5ebf34d7e
274 changed files with 58048 additions and 1 deletions

813
my/store/addgood.vue Normal file
View File

@@ -0,0 +1,813 @@
<template>
<view style="padding-bottom: 130rpx;">
<view>
<!-- #ifndef H5 -->
<view style="position: fixed;top: 0;left: 0;right: 0;z-index: 9999;background: #fff;">
<!-- #endif -->
<!-- #ifdef H5 -->
<view style="position: fixed;top: 44px;left: 0;right: 0;z-index: 99;background: #fff;">
<!-- #endif -->
<view class="bg padding-lr padding-tb-sm flex align-center">
<u-search @change="search" v-model="goodsName" placeholder="搜索商品标题 " bg-color="#F7F7F7"
style="width: 100%;" shape="square" :show-action="false"></u-search>
</view>
<view class="flex bg">
<view v-for="(item,index) in tab" :key="index" class="flex-sub boxIndex"
:class="tabIndex == index?'tans':''"
:style="index==1?'text-align:center':(index==2?'text-align:right;margin-right:40rpx':'')"
style="position: relative;padding-left: 40rpx;" @click="bindindex(index)">
{{item.name}}
<view :class="index==0?'tabse':(index==1?'tabse1':'tabse2')" v-show="tabIndex == index">
</view>
</view>
</view>
<scroll-view scroll-x="true" class="flex align-center padding-sm"
style="height: 100rpx;width: 100%;white-space: nowrap">
<view v-for="(item,index) in list" :key="index" class="boxs"
:class="counts == index?'actives':''" @click="bindTabs(index,item)">{{item.classifyName}}
</view>
</scroll-view>
</view>
<!-- #ifdef H5 -->
<view style="margin-top: 155px;" v-if="goodsList.length>0">
<!-- #endif -->
<!-- #ifndef H5 -->
<view style="margin-top: 290upx;padding-bottom: 170px;" v-if="goodsList.length>0">
<!-- #endif -->
<u-checkbox-group class="flex justify-center flex-wrap">
<view class="bg radius" style="width: 686rpx;margin-top: 20rpx;" v-for="(item,index) in goodsList" :key='index'>
<view class="padding-sm" style="position: relative;">
<u-checkbox @change="checkboxChange(item)" v-model="item.checkeds">
</u-checkbox>
创建时间{{item.createTime}}
<span style="position: absolute;right: 20rpx;">
<u-switch v-model="item.checked" active-color="#17cd8a" inactive-color="#eee" size="40"
@change="changeKg(index,item)"></u-switch>
</span>
</view>
<view style="width:100%;border-top: 1upx solid #E6E6E6;"></view>
<view class="flex padding" @click="goDet(item)">
<view>
<image :src="item.goodsCover?item.goodsCover:'../../static/logo.png'" class="radius"
style="width:210upx;height:170upx;"></image>
</view>
<view class="margin-left flex flex-direction justify-between">
<view class="text-lg text-bold">{{item.goodsName}}</view>
<view class="margin-tb-xs u-line-2" style="color:#999999;">
{{item.goodsDescribe}}
</view>
<view style="width: 414rpx;" class="text-lg flex justify-between align-center">
<view class="">
<text class="text-sm"></text>{{item.goodsMoney}}
</view>
<view style="margin-right: 10rpx;">库存{{item.inventory?item.inventory:'0'}}</view>
</view>
</view>
</view>
<view style="width: 686upx;height: 1upx;border: 1upx solid #E6E6E6;margin:0 auto;"></view>
<view class="flex justify-between padding align-center" >
<!-- <view>库存{{item.inventory?item.inventory:'0'}}</view> -->
<view class="flex align-center justify-end" style="width: 100%;">
<view @click="goodsSort(item)" class="btn margin-right-sm">排序</view>
<view @click="goodupdete(item)" class="btn margin-right-sm">删除</view>
<view @click="deitor(item)" class="btn margin-right-sm">库存</view>
<view @click="goUpdate(item)" class="btn">修改</view>
</view>
</view>
</view>
</u-checkbox-group>
</view>
<!-- <view class="addguige text-bold" @click="goAdd()">添加商品</view> -->
<empty v-if="goodsList.length == 0"></empty>
</view>
<view class="selectcz flex align-center">
<u-checkbox @change="checkboxChanges()" style="margin-left: 40rpx;" v-model="checkedz">全选</u-checkbox>
<view class="addguige text-bold addguigezz" @click="selectczan">操作</view>
<view class="addguige text-bold addguigezzs" @click="goAdd()">添加商品</view>
</view>
<!-- 排序 -->
<u-popup v-model="shows3" mode="center" border-radius="14" width="500rpx" height="300rpx"
:closeable="true">
<view>
<view class="padding">
<view>排序</view>
<view style="margin-top: 20rpx;" class="flex justify-center">
<u-number-box :input-width="300" :input-height="60" v-model="paixu" :min="0" placeholder="请填写"></u-number-box>
</view>
</view>
<view class="addguiges" @click="bindclose3()">确定</view>
</view>
</u-popup>
<u-popup v-model="shows" mode="center" border-radius="14" width="500rpx" height="300rpx"
:closeable="closeable">
<view>
<view class="padding">
<view>添加库存</view>
<view>
<u-input v-model="typeperature" placeholder="请填写" type="number" />
</view>
</view>
<view class="addguiges" @click="bindclose()">确定</view>
</view>
</u-popup>
<!-- 批量修改库存 -->
<u-popup v-model="shows2" mode="center" border-radius="14" width="500rpx" height="300rpx"
:closeable="true">
<view>
<view class="padding">
<view>修改库存</view>
<view>
<u-input v-model="typeperature2" placeholder="请填写" type="number" />
</view>
</view>
<view class="addguiges" @click="bindclose2()">确定</view>
</view>
</u-popup>
<!-- 多选操作菜单 -->
<u-action-sheet :list="tabIndex==2?lists1:lists" @click="click" v-model="show"></u-action-sheet>
</view>
</template>
<script>
import empty from '@/components/empty.vue'
export default {
components: {
empty
},
data() {
return {
goodsIds:[],
shows3:false,
paixu:0,
shows2:false,
typeperature2:'',
checkedz:false,
show: false,
lists: [{
text: '批量下架'
}, {
text: '修改库存'
}, {
text: '批量删除'
}],
lists1: [{
text: '批量上架',
}, {
text: '修改库存'
}, {
text: '批量删除'
}],
tab: [{
name: '出售中',
}, {
name: '已售完',
}, {
name: '已下架'
}],
tabIndex: 0,
list: [{
name: '奶茶热饮'
}, {
name: '鲜榨果汁'
}, {
name: '牛奶系列'
}, {
name: '超低折扣'
}],
counts: '',
classifyId: '',
page: 1,
limit: 10,
shopId: '',
goodsName: '',
goodsList: [],
totalCount: 0,
shows: false,
typeperature: '',
goodsId: '',
checked: false,
pageList: [],
closeable: true
}
},
onLoad(option) {
uni.showLoading({
title: '加载中......',
icon: 'loading'
})
// this.shopId = option.shopId
this.shopId = this.$queue.getData("shopId")
this.getClassifyList()
},
onShow() {
this.getGoodsList()
},
methods: {
// 批量库存
bindclose2(index){
if (!this.typeperature2) {
uni.showToast({
title: '请填写规格数量',
icon: 'none',
duration: 1000
})
return
}
if(this.typeperature2<0){
uni.showToast({
title: '库存数量不得小于0',
icon: 'none',
duration: 1000
})
return
}
let data = {
goodsIds: this.goodsIds.join(),
inventory: this.typeperature2
}
let that = this
that.shows2 = false
uni.showModal({
title:'提示',
content:'确认已选中的商品批量修改库存?',
complete:function(ret){
if(ret.confirm){
that.$Request.getA("/admin/goods/updateBatchInventory", data).then(res => {
if (res.code == 0) {
that.shows2 = false
uni.showToast({
title: '修改成功',
icon: 'none'
})
that.typeperature2 = ''
that.checkedz = false
that.goodsIds = []
that.page = 1
that.getGoodsList()
}
});
}
}
})
},
bindclose3(){
let data = {
sort:this.paixu,
goodsId:this.goodsId
}
this.$Request.getA('/admin/goods/updateSort', data).then(res => {
if(res.code==0){
uni.showToast({
title:'修改成功'
})
this.goodsId = ''
this.shows3 = false
this.page = 1
this.getGoodsList();
}else{
uni.showToast({
title:res.msg,
icon:'none'
})
}
})
},
//排序
goodsSort(item){
if(item.sort){
this.paixu = item.sort
}else{
this.paixu = 0
}
this.shows3 = true
this.goodsId = item.goodsId
},
selectczan(){
if(this.goodsIds.length==0){
uni.showToast({
title:'请选择商品后操作',
icon:'none'
})
}else{
this.show = true
}
},
//全选
checkboxChanges(){
this.goodsIds = []
if(this.checkedz==false){//全选把总复选框选中并把goodsid赋给数组
this.goodsList.map(item=>{
item.checkeds = true
this.goodsIds.push(item.goodsId)
})
console.log(this.goodsList)
}else{//全不选
this.goodsList.map(item=>{
item.checkeds = false
})
}
},
//批量操作
caozuos(url,datas,data){
let that = this
uni.showModal({
title:'提示',
content:'确认'+data+'已选中的商品?',
complete:function(ret){
if(ret.confirm){
that.$Request.getA(url, datas).then(res => {
if(res.code==0){
uni.showToast({
title:data+'成功'
})
that.checkedz=false
that.goodsIds = []
that.page = 1
that.getGoodsList();
}else{
uni.showToast({
title:res.msg,
icon:'none'
})
}
})
}
}
})
},
//选择的操作
click(e) {
let data = this.lists[e].text
if(this.tabIndex==2){
if(data == '批量下架'){
data = '批量上架'
}
}
switch (data) {
case '批量下架':
let datas = {
goodsIds:this.goodsIds.join(','),
status:1
}
this.caozuos('/admin/goods/updateBatchStatus',datas,data)
break;
case '修改库存':
this.shows2 = true
break;
case '批量删除':
let datas2 = {
goodsIds:this.goodsIds.join(','),
}
this.caozuos('/admin/goods/deleteBatchIds',datas2,data)
break;
case '批量上架':
let datas1 = {
goodsIds:this.goodsIds.join(','),
status:0
}
this.caozuos('/admin/goods/updateBatchStatus',datas1,data)
break;
default:
break;
}
},
// 选中某个复选框时由checkbox时触发
checkboxChange(e) {
if(this.goodsIds.indexOf(e.goodsId)==-1){//如果没有选中则把goodsid增加到数组中
this.goodsIds.push(e.goodsId)
}else{//如果找到了则把goodsid删除
this.goodsIds.splice(this.goodsIds.indexOf(e.goodsId),1)
}
if(this.goodsIds.length==this.goodsList.length){ //判断是否全部选中
this.checkedz = true
}else{
this.checkedz = false
}
},
//修改商品
goUpdate(item) {
uni.navigateTo({
url: '/my/publish/goods?goodsId=' + item.goodsId
})
},
goAdd() {
uni.navigateTo({
url: '/my/publish/goods'
})
},
//搜索
search() {
this.getGoodsList()
},
bindindex(index) {
console.log(index)
uni.showLoading({
title: '加载中......',
icon: 'loading'
})
this.page = 1
this.tabIndex = index
this.getGoodsList()
},
getGoodsList() {
let data = {
page: this.page,
limit: this.limit,
goodsName: this.goodsName,
// shopId: this.shopId,
classifyId: this.classifyId,
shopId: uni.getStorageSync('shopId'),
status: this.tabIndex == 1 ? 2 : (this.tabIndex == 2 ? 1 : this.tabIndex)
}
this.$Request.getA("/admin/goodsShop/selectGoodsByShopId", data).then(res => {
if (res.code == 0) {
uni.hideLoading()
if (res.data.list.length > 0) {
for (var i in res.data.list) {
if (res.data.list[i].status == 1) {
res.data.list[i].checked = false
} else {
res.data.list[i].checked = true
}
}
console.log('res.data.list', res.data.list)
if (this.page == 1) {
this.goodsList = res.data.list
} else {
this.goodsList = [...this.goodsList, ...res.data.list]
}
this.totalCount = res.data.totalCount
} else {
if (this.page == 1) {
this.goodsList = []
} else {
this.goodsList = this.goodsList
}
}
}
uni.stopPullDownRefresh();
uni.hideLoading()
});
},
//删除商品
goodupdete(e) {
console.log(e)
let that = this
uni.showModal({
title: '提示',
content: '确定要删除当前商品吗?刪除后无法恢复',
cancelText: "取消", // 取消按钮的文字
confirmText: "确定", // 确认按钮文字
showCancel: true, // 是否显示取消按钮,默认为 true
confirmColor: '#f55850',
cancelColor: '#39B54A',
success: (res) => {
if (res.confirm) {
let data = {
shopId: uni.getStorageSync('shopId'),
goodsId: e.goodsId,
}
that.$Request.postA("/admin/goodsShop/deleteGoodsByShopId", data).then(res => {
if (res.code == 0) {
uni.showToast({
title: "删除成功",
icon: 'none'
})
that.page = 1
that.getGoodsList();
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
});
} else {
}
}
})
},
// 商品类型
getClassifyList() {
this.$Request.getA("/admin/goods/selectAllClassify?shopId=" + this.shopId).then(res => {
if (res.code == 0) {
let data = [{
classifyName: '全部',
classifyId: ''
}]
this.list = [...data, ...res.data]
this.classifyId = this.list[0].classifyId
this.getGoodsList()
}
});
},
//库存弹框
bindclose(index) {
if (!this.typeperature) {
uni.showToast({
title: '请填写规格数量',
icon: 'none',
duration: 1000
})
return
}
let data = {
shopId: uni.getStorageSync('shopId'),
goodsId: this.goodsId,
inventory: this.typeperature
}
this.$Request.postJson("/admin/goodsShop/updateGoodsByShopId", data).then(res => {
if (res.code == 0) {
this.shows = false
this.typeperature = ''
uni.showToast({
title: '修改成功',
icon: 'none'
})
this.getGoodsList()
}
});
},
//编辑库存
deitor(e) {
this.shows = true
this.goodsId = e.goodsId
},
add(item) {
let that = this
let data = [{
goodsId: item.goodsId,
shopId: this.shopId
}]
this.$Request.postJsonA("/admin/goodsShop/addGoodsByShopId", data).then(res => {
if (res.code == 0) {
this.page = 1
this.getGoodsList()
uni.showToast({
title: '添加成功',
icon: 'none'
})
this.getGoodsList()
}
});
},
goDet(e) {
uni.navigateTo({
url: '/my/store/goodDetail?goodsId=' + e.goodsId + "&shopId=" + this.shopId + '&type=2'
})
},
bindDetail() {
uni.navigateTo({
url: './goodDetail'
})
},
bindTabs(index, e) {
console.log(e)
uni.showLoading({
title: '加载中......',
icon: 'loading'
})
this.counts = index
this.classifyId = e.classifyId
this.page = 1
this.getGoodsList()
},
bindAddgood() {
uni.navigateTo({
url: './addgood'
})
},
// 上下架商品
changeKg(index, row) {
console.log(row.status)
var datas = {}
datas.goodsIds = row.goodsId
if (row.status == 0) {
datas.status = 1
}
if (row.status == 1) {
datas.status = 0
}
// datas.status = row.status
// this.$Request.postJsonA("/admin/goods/update", datas).then(res => {
this.$Request.getT("/admin/goods/updateBatchStatus", datas).then(res => {
if (res.code == 0) {
this.page = 1
uni.showToast({
title: '操作成功',
icon: 'none'
})
this.getGoodsList()
}
});
}
},
onReachBottom: function() {
this.page = this.page + 1;
this.getGoodsList();
if (this.totalCount == this.goodsList.length) {
uni.showToast({
title: '已经到底了~',
icon: 'none'
})
}
},
onPullDownRefresh: function() {
this.page = 1;
this.getGoodsList();
},
}
</script>
<style lang="scss" scoped>
page {
background: #EDF1F7;
}
.selectcz {
width: 100%;
background-color: #FFFFFF;
position: fixed;
bottom: 0upx;
left: 0;
right: 0;
z-index: 9;
}
.tabse {
width: 50rpx;
height: 10rpx;
background-color: #FCD202;
position: absolute;
bottom: 0;
left: 45%;
transform: translate(-100%, -100%);
}
.tabse1 {
width: 50rpx;
height: 10rpx;
background-color: #FCD202;
position: absolute;
bottom: 0;
left: 70%;
transform: translate(-100%, -100%);
}
.tabse2 {
width: 50rpx;
height: 10rpx;
background-color: #FCD202;
position: absolute;
bottom: 0;
left: 95%;
transform: translate(-100%, -100%);
}
.bg {
background: #FFFFFF;
}
.boxs {
width: 150upx;
height: 55upx;
border: 2upx solid #CCCCCC;
border-radius: 28upx;
text-align: center;
line-height: 55upx;
color: #999999;
margin-right: 30rpx;
display: inline-block;
}
.actives {
width: 150upx;
height: 55upx;
border: 2upx solid #FFCC00;
border-radius: 28upx;
text-align: center;
line-height: 55upx;
color: #000000;
margin-right: 30rpx;
}
.btn {
width: 120upx;
height: 64upx;
border: 2upx solid #999999;
border-radius: 8upx;
text-align: center;
line-height: 64rpx;
color: #000000;
}
.box {
width: 131upx;
height: 45rpx;
background: #FFEAF0;
border-radius: 4upx;
text-align: center;
line-height: 45rpx;
font-size: 24upx;
font-weight: 500;
color: #FE215B;
}
.page-box {
position: relative;
// left: 0;
height: 100vh;
z-index: 0;
top: -20px;
}
.centre {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
margin: auto;
height: 400rpx;
text-align: center;
// padding: 200rpx auto;
font-size: 32rpx;
image {
width: 387rpx;
height: 341rpx;
// margin-bottom: 20rpx;
margin: 0 auto 20rpx;
// border: 1px dotted #000000;
}
.tips {
font-size: 32rpx;
color: #2F3044;
margin-top: 20rpx;
font-weight: 700;
}
.btn {
margin: 80rpx auto;
width: 600rpx;
border-radius: 32rpx;
line-height: 90rpx;
color: #ffffff;
font-size: 34rpx;
background: #5074FF;
}
}
.boxIndex {
height: 78upx;
line-height: 78upx;
}
.tans {
background: #fff;
}
.addguige {
width: 38%;
color: #ffffff;
text-align: center;
height: 88upx;
line-height: 88upx;
}
.addguigezz{
border-radius: 16upx 0 0 0;
background-color: #999999;
box-shadow: 0px 10upx 20upx 0px #999999;
}
.addguigezzs{
border-radius: 0 16upx 0 0;
background: #FCD202;
box-shadow: 0px 10upx 20upx 0px #FCD202;
}
.addguiges {
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; */
}
</style>

311
my/store/editor.vue Normal file
View File

@@ -0,0 +1,311 @@
<template>
<view class="padding">
<view class="padding bg radius">
<view class="">
<view class="text-df text-bold">规格标题</view>
<view>
<u-input v-model="shopName" placeholder="请输入规格标题" />
</view>
</view>
</view>
<view class="bg margin-tb padding-sm radius" v-for="(item,index) in shopList" :key='index'>
<view class="">
<view style="display: flex;width: 100%;">
<view style="width: 70%;" class="text-df text-bold">规格</view>
<view style="width: 30%;text-align: right;" class="text-df text-bold" v-if="index != 0" @tap="delteItem(index)">删除</view>
</view>
<view>
<u-input v-model="item.value" placeholder="请填写" />
</view>
</view>
<view class="">
<view class="text-df text-bold">规格值</view>
<!-- <view>
<u-input v-model="detailName" placeholder="请填写" />
</view> -->
</view>
<view class="flex align-center flex-wrap margin-bottom-sm">
<view v-for="(item1,index1) in item.detail" :key="index1" class="btn flex align-center margin-top"
:class="listIndex1 == index1&&listIndex==index?'active':''" @click="bindqie(index1,item1,index)">
<view>{{item1}}</view>
<view class="margin-left-sm" @tap.stop="bindupdata(index1,item1,index)">x</view>
</view>
<view class="btns margin-top" @click="addtype(1,item1,index)">+添加</view>
</view>
</view>
<u-button class="margin-top addguiges" :custom-style="customStyle" shape="square" :hair-line="false"
@click="addguige()">添加规格
</u-button>
<view class="margin-top">
<u-button @click="submit" class=" addguige" :custom-style="customStyle" shape="square" :hair-line="false">确认
</u-button>
</view>
<!-- 添加规格弹框 -->
<u-popup v-model="show" mode="center" border-radius="14" width="500rpx" height="300rpx">
<view>
<view class="padding">
<view>添加规格类型</view>
<view>
<u-input v-model="typeName" placeholder="请填写" clearable="false" />
</view>
</view>
<view class="addguiges" @click="bindclose(aa)">确定</view>
</view>
</u-popup>
</view>
</template>
<script>
import configdata from '@/common/config.js';
export default {
data() {
return {
shopName: '',
customStyle: {
backgroundColor: '#FFCC00',
color: '#000000',
border: 0
},
shopList: [{
value: '',
detail: [],
}],
listIndex1: 0,
listIndex: 0,
show: false,
typeName: '',
ruleValues: [],
id: '',
guigeLIst: {},
detailName: '',
guigeIndex: 0,
guigezhiIndex: 0,
aa: '',
shopId: '',
}
},
onLoad(option) {
this.id = option.id
this.shopId = this.$queue.getData("shopId")
if (option.id) {
this.guigeLIst = uni.getStorageSync('guige')
this.shopName = this.guigeLIst.ruleName
this.shopList = this.guigeLIst.ruleValue
for (var i = 0; i < this.shopList.length; i++) {
// #ifdef APP
this.shopList[i].detail = this.shopList[i].detail.split(',')
// #endif
// #ifndef APP
this.shopList[i].detail = this.shopList[i].detail.split('/')
// #endif
}
}
},
onShow() {
},
methods: {
delteItem(index){
this.shopList.splice(index, 1)
},
//删除规格
bindupdata(index1, item1, index) {
this.shopList[index].detail.splice(index1, 1)
},
bindqie(index1, item1, index) {
this.listIndex = index
this.listIndex1 = index1
this.shopList[index].detail[index1] = item1
this.typeName = item1
this.aa = index1
this.show = true
},
addtype(index1, item, index) {
this.guigeIndex = index
this.guigezhiIndex = index1
if (index1 == 1) {
this.typeName = ''
this.aa = ''
this.show = true
}
},
bindclose(index) {
if (!this.typeName) {
uni.showToast({
title: '请填写规格',
icon: 'none',
duration: 1000
})
return
}
console.log('aaaaaaa', index)
if (index === '') {
this.show = false
// this.list.push(this.typeName)
this.shopList[this.guigeIndex].detail.push(this.typeName)
} else {
this.show = false
this.shopList[this.guigeIndex].detail[this.aa] = this.typeName
}
},
// 发布
submit() {
if (!this.shopName) {
uni.showToast({
title: '请填写规格标题',
icon: 'none',
duration: 1000
})
return
}
if(this.shopList.length == 0){
uni.showToast({
title: '请选择规格',
icon: 'none',
duration: 1000
})
return
}
var arrLength = this.shopList[this.shopList.length - 1]
if (arrLength.value == '' || arrLength.detail.length == 0) {
uni.showToast({
title: '请填写规格或是规格值',
icon: 'none'
})
return
}
let guigeList = {}
let shopList = JSON.parse(JSON.stringify(this.shopList))
for (var i in shopList) {
shopList[i].detail = shopList[i].detail.toString()
}
console.log(shopList)
guigeList.ruleName = this.shopName
guigeList.ruleValue = shopList
guigeList.shopId = this.shopId
if (this.id) {
guigeList.id = this.id
this.$Request.postJson("/selfGoodsRule/update", guigeList).then(res => {
if (res.code == 0) {
uni.showToast({
title: '修改成功',
icon: 'none'
})
uni.navigateBack()
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
// this.shopList = this.shopList[this.guigeIndex].detail.split(',')
// console.log(this.shopList,2222)
}
})
} else {
this.$Request.postJson("/selfGoodsRule/save", guigeList).then(res => {
if (res.code == 0) {
uni.navigateBack()
}
})
}
},
// 添加规格
addguige() {
var arrLength = this.shopList[this.shopList.length - 1]
if (arrLength.value == '' || arrLength.detail.length == 0) {
uni.showToast({
title: '请填写规格或是规格值',
icon: 'none'
})
} else {
var data = {
value: '',
detail: [],
}
this.shopList.push(data)
console.log(this.shopList, 11111)
}
}
}
}
</script>
<style>
page {
background-color: #F5F5F5;
}
.bg {
background-color: #FFFFFF;
}
.btn {
border: 1upx solid #CCCCCC;
border-radius: 28px;
padding: 15rpx 30rpx;
margin-right: 25rpx;
}
.btns {
border: 1upx dashed #333333;
border-radius: 28px;
padding: 10rpx 30rpx;
margin-right: 25rpx;
}
.active {
/* background: #FCD202; */
/* border: none; */
}
.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; */
}
.addguiges {
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; */
}
</style>

232
my/store/fenlei.vue Normal file
View File

@@ -0,0 +1,232 @@
<template>
<view>
<view v-for="(item,index) in list" :key="index" class="flex padding justify-between">
<view class="flex align-center">
<view class="text-bold text-xl">{{index+1}}.</view>
<view class="margin-left-xs">{{item.classifyName}}</view>
</view>
<view class="flex align-center">
<view class="btn margin-right-sm" @click="addtype(2,item)">修改</view>
<view class="btn" @click="bindupdata(item)">删除</view>
</view>
</view>
<empty v-if="list.length == 0" content="暂无数据"></empty>
<view class="addguige text-bold" @click="addtype(1)">添加</view>
<!-- 添加规格弹框 -->
<u-popup v-model="show" mode="center" border-radius="14" width="500rpx" height="400rpx">
<view>
<view class="padding" style="margin-bottom: 20rpx;">
<view>商品分类</view>
<view class="flex align-center" style="margin-top: 15rpx;">
<label style="margin-right: 10rpx;">分类名称</label><u-input v-model="typeName" placeholder="请填写分类名称" clearable="false" />
</view>
<view class="flex align-center" style="margin-top: 15rpx;">
<label style="margin-right: 10rpx;">分类排序</label><u-number-box v-model="sort" placeholder="请填写分类排序"></u-number-box>
</view>
</view>
<view class="addguiges" @click="bindAdd()">确定</view>
</view>
</u-popup>
</view>
</template>
<script>
import empty from '@/components/empty.vue'
export default {
components: {
empty
},
data() {
return {
list: [{
id: 1,
name: '清爽夏日',
}, {
id: 2,
name: '牛奶系列',
}, {
id: 3,
name: '鲜榨果汁',
}],
show: false,
typeName: '',
sort:0,
classifyId: '',
shopId: '',
shopName: '',
}
},
onLoad() {
uni.showLoading({
title: '数据加载中...',
mask: false
})
this.shopId = this.$queue.getData("shopId")
this.shopName = this.$queue.getData("shopUserName")
this.getlist()
},
methods: {
addtype(index, item) {
console.log(index, item)
if (index == 1) {
this.show = true
this.typeName = ''
this.classifyId = ''
this.sort = 0
} else if (index == 2) {
this.show = true
this.typeName = item.classifyName
this.classifyId = item.classifyId
if(item.sort){
this.sort = item.sort
}else{
this.sort = 0
}
}
},
//添加商品类型
bindAdd() {
if (!this.typeName) {
uni.showToast({
title: '请填写商品类型',
icon: 'none',
duration: 1000
})
return
}
console.log(this.classifyId)
if (this.classifyId) {
let data = {
classifyId: this.classifyId,
classifyName: this.typeName,
shopId: this.shopId,
shopName: this.shopName,
sort:this.sort,
}
this.$Request.postJson("/admin/goods/updateClassify", data).then(res => {
if (res.code == 0) {
// this.list = res.data
this.show = false
this.typeName = ''
this.classifyId = ''
this.sort = 0
this.getlist()
}
})
} else {
let data = {
classifyName: this.typeName,
shopId: this.shopId,
shopName: this.shopName,
sort:this.sort
}
this.$Request.postJson("/admin/goods/insertClassify", data).then(res => {
if (res.code == 0) {
// this.list = res.data
this.show = false
this.typeName = ''
this.classifyId = ''
this.sort = 0
this.getlist()
}
})
}
},
//获取分类列表
getlist() {
let data = {
shopId: this.shopId
}
this.$Request.getA("/admin/goods/selectAllClassify", data).then(res => {
uni.hideLoading()
if (res.code == 0) {
this.list = res.data
}
})
},
//删除商品类型
bindupdata(e) {
console.log(e)
uni.showModal({
title: '提示',
content: '确定要删除当前类型吗?',
cancelText: "取消", // 取消按钮的文字
confirmText: "确定", // 确认按钮文字
showCancel: true, // 是否显示取消按钮,默认为 true
confirmColor: '#f55850',
cancelColor: '#39B54A',
success: (res) => {
if (res.confirm) {
let data = {
classifyId: e.classifyId
}
this.$Request.getA("/admin/goods/deleteClassify", data).then(res => {
if (res.code == 0) {
uni.showToast({
title: "删除成功",
icon: 'none'
})
this.getlist();
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
});
}
}
})
}
}
}
</script>
<style>
page {
background: #FFFFFF;
}
.btn {
border: 2upx solid #999999;
border-radius: 24px;
color: #333333;
padding: 5rpx 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;
}
.addguiges {
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; */
}
</style>

473
my/store/goodDetail.vue Normal file
View File

@@ -0,0 +1,473 @@
<template>
<view>
<!-- <view class="detail-banner ">
<swiper class="swiper" :autoplay="true" interval="2000" duration="500" :circular="true" style="width: 100%;height: 410rpx;">
<swiper-item v-for="(item,index) in dataCentre.goodsPicture" :key='index' >
<image :src="item" mode="scaleToFill" style="width: 100%;"></image>
</swiper-item>
</swiper>
</view> -->
<view class="flex padding bg-white">
<image :src="dataCentre.goodsCover" style="width:200rpx;height:200rpx;border-radius: 10rpx;"></image>
<view class="flex flex-direction justify-between margin-left">
<view class="text-black text-bold text-lg">{{dataCentre.goodsName}}</view>
<view class="flex">
<view v-if="dataCentre.goodsLabel1.length>0" class="btn margin-right-xs"
v-for="(item,index) in dataCentre.goodsLabel1" :key='index'>{{item}}</view>
</view>
<view v-if="type==1">库存{{dataCentre.inventory?dataCentre.inventory:0}}</view>
<view class="text-lg text-red"><text class="text-sm">¥</text>{{dataCentre.goodsMoney}}</view>
</view>
</view>
<!-- <view class="detail">
<view class="detail_text">{{dataCentre.goodsName}}</view>
<view class="detail_biao" v-if="dataCentre.goodsLabel.length">
<view class="detail_biao_sty" v-for="(ite, ind) in dataCentre.goodsLabel" :key='ind'>{{ite}}</view>
</view>
<view class="margin-top" v-for="(item,index) in attrList" :key="index" >
<view class="text-bold text-black">{{item.value}}</view>
<view class="flex margin-tb-sm flex-wrap">
<view v-for="(ite, ind) in item.detail" :key="ind" @click="skuSel(ite,index,ind)"
class="margin-bottom-sm">
<view class="btn" :class="item.goodsId == index && item.attrId == ind?'active': ''">
{{ite.name}}
</view>
</view>
</view>
</view>
</view> -->
<view class="padding bg-white">
<text class="text-bold text-black text-lg ">商品介绍</text>
<u-parse class='margin-top' :html="dataCentre.goodsDescribe"></u-parse>
</view>
<view class="padding margin-top-sm bg-white">
<view class="text-bold text-black text-lg ">其他信息</view>
<view class="flex justify-between align-center margin-tb-sm">
<view style="font-size:30upx;color:#999999;">商品售价</view>
<view class="text-black">{{dataCentre.goodsMoney?dataCentre.goodsMoney:'暂无'}}</view>
</view>
<view class="flex justify-between align-center margin-tb-sm">
<view style="font-size:30upx;color:#999999;">打包费</view>
<view class="text-black">{{dataCentre.packMoney?dataCentre.packMoney:'0'}}</view>
</view>
<view class="flex justify-between align-center margin-tb-sm">
<view style="font-size:30upx;color:#999999;">标签</view>
<view class="text-black">{{dataCentre.goodsLabel?dataCentre.goodsLabel:'暂无'}}</view>
</view>
<view class="flex justify-between align-center margin-tb-sm">
<view style="font-size:30upx;color:#999999;">创建时间</view>
<view class="text-black">{{dataCentre.createTime}}</view>
</view>
</view>
<view class="padding margin-top-sm bg-white" v-if="type==1">
<view class="text-bold text-black text-lg ">其他设置</view>
<view class="flex justify-between align-center margin-tb-sm">
<view>商品状态</view>
<u-switch @change="change" active-color="#FFCC00" v-model="checked"></u-switch>
</view>
<view class="flex justify-between align-center margin-tb-sm">
<view>库存编辑</view>
<input type="number" placeholder="请输入修改库存数" style="text-align: right;" v-model="inventory" />
</view>
</view>
<!-- <view class="bg padding">
<view class="flex justify-between ">
<view style="font-size:40upx;"><text class="text-sm"></text>12.00</view>
<view style="color:#999999;" class="text-sm">库存236</view>
</view>
<view class="text-lg text-bold padding-tb-xs">草莓沫沫酸奶奶昔</view>
<view class="flex">
<view class="btn">人气爆款</view>
<view class="btn">福利必点系列</view>
</view>
<view class="text-sm padding-tb-sm">规格</view>
<view class="flex">
<view class="box" v-for="(item,index) in list" :key="index" @click="bindge(index)"
:class="count == index?'boxs':''">{{item.name}}</view>
</view>
<view class="text-sm padding-tb-sm">甜度</view>
<view class="flex">
<view class="box" v-for="(item,index) in lists" :key="index" @click="bindtd(index)"
:class="counts == index?'boxs':''">{{item.name}}</view>
</view>
</view>
<view class="margin-top-sm padding-lr bg">
<view class="text-sm padding-top-sm">规格</view>
<view class="text-sm padding-tb-sm">蜂蜜黄油辣辣海苔2款口味可选精选优质新鲜马铃薯使用低
温真空油炸VF技术锁鲜香甜不腻咖哧酥脆净含量50</view>
</view> -->
<!-- <view class="bg padding margin-top-sm">
<view class="flex justify-between padding-tb-sm">
<view>打包费</view>
<view>5</view>
</view>
<view class="flex justify-between padding-tb-sm">
<view>折扣价</view>
<view>9.9</view>
</view>
</view> -->
<view v-if="type==1" class="addgood" @click="save()">保存</view>
<view v-if="type==2" class="addgood" @click="goAdd(dataCentre.goodsId)">修改商品</view>
<view v-if="type==1" class="addgood" @click="del()">删除</view>
</view>
</template>
<script>
export default {
data() {
return {
list: [{
name: '标准'
}],
count: 0,
lists: [{
name: '无糖'
}, {
name: '少糖'
}, {
name: '半糖'
}],
counts: 0,
goodsId: '',
good: {},
dataCentre: {},
checked: false,
shopId: '',
inventory: '',
type: 1,
status: 1,
attrList: [],
skuList: [],
}
},
onLoad(option) {
uni.showLoading({
title: '加载中......',
icon: 'loading'
})
console.log(option)
this.goodsId = option.goodsId
this.shopId = uni.getStorageSync('shopId')
this.type = option.type
this.getGoodDet()
},
onShow() {
this.getGoodDet()
},
methods: {
goAdd(goodsId) {
uni.navigateTo({
url: '/my/publish/goods?goodsId='+goodsId
})
},
change(e) {
console.log()
let that = this
let data = {
shopId: that.shopId,
goodsId: that.goodsId,
status: e ? 0 : 1
}
that.$Request.postA("/admin/goodsShop/soldOutOrPutaway", data).then(res => {
if (res.code == 0) {
// that.getGoodsList()
uni.showToast({
title: e ? '上架成功' : '下架成功',
icon: 'none'
})
uni.setStorageSync('updata', true)
setTimeout(function() {
let pages = getCurrentPages(); // 当前页面
let beforePage = pages[pages.length - 2]; // 上一页
uni.navigateBack();
}, 1000)
}
});
},
getGoodDet() {
if (this.type == 1) {
let data = {
goodsId: this.goodsId,
shopId: this.shopId
}
this.$Request.getA("/admin/goodsShop/selectGoodsByShopIdAndGoodsId", data).then(res => {
if (res.code == 0) {
uni.hideLoading()
this.dataCentre = res.data
this.attrList.forEach(res => {
let data = {
name: ''
}
// this.checkStateList.push(data);
let detail = [];
res.detail.split(',').forEach(d => {
let data = {
name: '',
state: ''
}
data.name = d;
detail.push(data);
});
res.detail = detail;
})
console.log(this.attrList)
}
});
} else {
let data = {
goodsId: this.goodsId
}
this.$Request.getA("/admin/goods/selectGoodsById", data).then(res => {
if (res.code == 0) {
uni.hideLoading()
this.dataCentre = res.data
this.attrList.forEach(res => {
let data = {
name: ''
}
// this.checkStateList.push(data);
let detail = [];
res.detail.split(',').forEach(d => {
let data = {
name: '',
state: ''
}
data.name = d;
detail.push(data);
});
res.detail = detail;
})
console.log(this.attrList)
}
});
}
},
// 修改库存
save() {
let data = {
goodsId: this.goodsId,
shopId: this.shopId,
inventory: this.inventory
}
this.$Request.postJsonA("/admin/goodsShop/updateGoodsByShopId", data).then(res => {
if (res.code == 0) {
uni.showToast({
title: '保存成功',
icon: 'none'
})
uni.setStorageSync('updata', true)
setTimeout(function() {
uni.navigateBack({
delta: 1
})
}, 1000)
}
});
},
// 添加
add(e) {
let data = [{
goodsId: this.goodsId,
shopId: this.shopId
}]
this.$Request.postJsonA("/admin/goodsShop/addGoodsByShopId", data).then(res => {
if (res.code == 0) {
// this.page = 1
// this.getGoodsList()
uni.showToast({
title: '添加成功',
icon: 'none'
})
uni.setStorageSync('updata', true)
setTimeout(function() {
uni.navigateBack({
delta: 2
})
}, 1000)
}
});
},
// 删除
del(e) {
let that = this
uni.showModal({
title: '提示',
content: '确认删除商品吗',
success: function(res) {
if (res.confirm) {
console.log('用户点击确定');
let data = {
shopId: that.shopId,
goodsId: this.goodsId,
}
that.$Request.postA("/admin/goodsShop/deleteGoodsByShopId", data).then(res => {
if (res.code == 0) {
// that.getGoodsList()
uni.showToast({
title: '删除成功',
icon: 'none'
})
setTimeout(function() {
let pages = getCurrentPages(); // 当前页面
let beforePage = pages[pages.length - 2]; // 上一页
uni.navigateBack({
success: function() {
beforePage
.onLoad(); // 执行上一页的onLoad方法
}
});
}, 1000)
}
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
}
}
</script>
<style>
page {
background: #EDF1F7;
}
.bg {
background: #FFFFFF;
}
.btn {
background: rgba(216, 2, 4, 0.2);
opacity: 0.6;
border-radius: 4upx;
color: #D80204;
padding: 8rpx 13rpx;
font-size: 23rpx;
margin-right: 16rpx;
}
.box {
border: 2upx solid #CCCCCC;
/* opacity: 0.6; */
border-radius: 8upx;
color: #999999;
font-size: 30upx;
padding: 13rpx 44rpx;
margin-right: 35rpx;
}
.boxs {
background: rgba(252, 210, 2, 0.2);
border: 2upx solid #FCD202;
/* opacity: 0.6; */
border-radius: 8upx;
color: #333333 !important;
font-size: 30upx;
padding: 13rpx 44rpx;
}
.addgood {
width: 685upx;
height: 88upx;
background: #FFCC00;
border-radius: 8upx;
text-align: center;
line-height: 88rpx;
margin: 40rpx auto;
/* position: fixed;
bottom: 35rpx;
left: 0;
right: 0; */
font-size: 32rpx;
font-weight: bold;
color: #FFFFFF;
}
.detail-banner {
width: 100%;
height: 410rpx;
}
.detail-banner image {
width: 100%;
height: 410rpx;
}
.detail {
width: 100%;
padding: 3%;
overflow: hidden;
/* position: relative; */
/* top: -20rpx; */
background-color: #FFFFFF;
border-radius: 32rpx 0 0 0;
}
.detail_text {
font-size: 36rpx;
font-weight: 800;
color: #333333;
}
.detail_biao {
display: flex;
padding: 2% 0;
}
.detail_biao_sty {
/* padding: 1% 1.5%; */
padding: 10rpx 20rpx;
background: rgba(216, 2, 4, 0.2);
opacity: 0.6;
color: #D80204;
border-radius: 8rpx;
font-size: 24rpx;
margin-right: 2%;
}
.detail_text2 {
font-size: 24rpx;
font-family: PingFang SC;
color: #333333;
margin-top: 1%;
}
.detail_biao2 {
display: flex;
padding: 1% 0;
font-size: 30rpx;
}
.detail_biao2_sty {
padding: 1% 2.5%;
/* width: 13%; */
text-align: center;
background: rgba(252, 210, 2, 0.2);
border: 2rpx solid #FCD202;
opacity: 0.6;
border-radius: 8rpx;
margin-right: 2%;
}
.detail_biao2_sty2 {
padding: 1% 2.5%;
/* width: 13%; */
text-align: center;
border: 2rpx solid #999999;
opacity: 0.6;
color: #999999;
border-radius: 8rpx;
margin-right: 3%;
}
</style>

194
my/store/guige.vue Normal file
View File

@@ -0,0 +1,194 @@
<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>

147
my/store/hdInfo.vue Normal file
View File

@@ -0,0 +1,147 @@
<template>
<view>
<!-- swiper -->
<view class="sw">
<swiper :indicator-dots="false" style="width: 100%;height: 100%;" :autoplay="true" :interval="3000"
:duration="300">
<swiper-item v-for="(item,index) in imgs">
<image :src="item" style="width: 100%;height: 100%;" mode="aspectFill"></image>
</swiper-item>
</swiper>
</view>
<!-- 活动标题 -->
<view class="title flex justify-center align-center">
<view class="title-box flex align-center">
{{info.activityTitle}}
</view>
</view>
<!-- 活动内容 -->
<view class="info flex justify-center">
<view class="info-box" v-html="content">
</view>
</view>
<!-- 加入按钮 -->
<view class="submit flex justify-center align-center">
<view class="submit-box flex justify-center align-center" @click="joinHd()">
加入活动
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
activityId: '',
info: {},
content: '',
imgs: [],
};
},
onLoad(option) {
console.log()
this.activityId = option.activityId
this.getInfo()
},
methods: {
//加入活动
joinHd() {
let data = {
activityId: this.activityId,
shopId: uni.getStorageSync('shopId')
}
this.$Request.get("/app/activityManage/shopJoinActivity", data).then(res => {
if (res.code == 0) {
uni.showModal({
title: '提示',
content: '确定加入该活动?',
complete(ret) {
if (ret.confirm) {
uni.showToast({
title: '加入成功'
})
setTimeout(() => {
uni.navigateBack()
}, 1000)
}
}
})
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
});
},
//活动详情
getInfo() {
let data = {
activityId: this.activityId
}
this.$Request.get("/app/activityManage/getActivityInfo", data).then(res => {
if (res.code == 0) {
this.content = res.data.activityContent.replace(new RegExp("img", "g"),
'img style="width:100%;height:auto;"')
this.info = res.data
this.imgs = res.data.activityImage.split(',')
}
});
},
}
}
</script>
<style lang="scss">
page {
background-color: #ffffff;
}
.sw {
width: 100%;
height: 300rpx;
}
.title {
width: 100%;
height: 100rpx;
background-color: #ffffff;
.title-box {
width: 686rpx;
height: 100%;
font-size: 32rpx;
font-weight: bold;
}
}
.info {
width: 100%;
height: auto;
.info-box {
width: 686rpx;
height: 100%;
}
}
.submit {
width: 100%;
height: 160rpx;
position: fixed;
bottom: 0;
background-color: #ffffff;
.submit-box {
width: 686rpx;
height: 88rpx;
background-color: #FCD202;
border-radius: 40rpx;
}
}
</style>

227
my/store/huodong.vue Normal file
View File

@@ -0,0 +1,227 @@
<template>
<view>
<!-- swiper -->
<view class="myswiper flex justify-center align-center" v-if="myhd.length!=0">
<swiper :indicator-dots="false" style="width: 100%;height: 100%;" :autoplay="true" :interval="3000" :duration="300">
<swiper-item v-for="(item,index) in myhd" :key="index">
<view class="swiper-item">
<image :src="item" style="width: 100%;height: 340rpx;" mode="aspectFill"></image>
</view>
</swiper-item>
</swiper>
</view>
<!-- 活动列表 -->
<view :style="myhd.length==0?'margin-top: 20rpx;':'margin-top: -40rpx;'" class="list flex justify-center flex-wrap">
<view class="list-box flex justify-center" v-if="item.no != '是'" v-for="(item,index) in huodongList" :key="index" @click="item.se!='是'?gotoinfo(item.activityId):''">
<view class="list-box-c flex justify-between align-center">
<view class="list-box-c-l flex align-center">
<image :src="item.activityImage.split(',')[0]" style="width: 100rpx;height: 100rpx;" mode="aspectFill"></image>
<view class="list-box-c-l-txt">
{{item.activityTitle}}
</view>
</view>
<view class="list-box-c-r" v-if="item.se!='是'" @click.stop="joinHd(item.activityId)">
加入
</view>
<view class="list-box-c-r" v-else>
已加入
</view>
</view>
</view>
<u-loadmore :status="status" v-if="huodongList.length>0" :icon-type="iconType" :load-text="loadText" />
</view>
<view class="flex justify-center flex-wrap" v-if="huodongList.length==0">
<image src="../../static/images/img/empty.png" style="width: 387rpx;height: 341rpx;margin-top: 100rpx;" mode=""></image>
<view class="" style="width: 100%;text-align: center;margin-top: 20rpx;">
暂无数据
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
myhd:[],
page: 1,
limit: 10,
huodongList: [],
total: 1,
status: 'loadmore',
iconType: 'flower',
activityId:'',
loadText: {
loadmore: '上拉加载更多',
loading: '努力加载中',
nomore: '实在没有了'
}
};
},
onLoad() {
//我参与的活动
this.getMyHuoDong()
//活动列表
this.getHuoDongList();
},
onShow() {
//我参与的活动
this.getMyHuoDong()
//活动列表
this.getHuoDongList();
},
//加载更多
onReachBottom() {
if(this.page < this.total){
this.page += 1
this.status = 'loading'
this.getHuoDongList()
}
},
//下拉刷新
onPullDownRefresh() {
this.page = 1
this.getHuoDongList()
this.getMyHuoDong()
},
methods: {
//加入活动
joinHd(activityId) {
let that = this
let data = {
activityId: activityId,
shopId: uni.getStorageSync('shopId')
}
this.$Request.get("/app/activityManage/shopJoinActivity", data).then(res => {
if (res.code == 0) {
uni.showModal({
title: '提示',
content: '加入该活动将自动退出当前活动,确定加入该活动?',
complete(ret) {
if (ret.confirm) {
uni.showToast({
title: '加入成功'
})
//我参与的活动
that.getMyHuoDong()
//活动列表
that.getHuoDongList();
}
}
})
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
});
},
gotoinfo(activityId){
uni.navigateTo({
url:'./hdInfo?activityId='+activityId
})
},
// 我参与的活动
getMyHuoDong() {
let data = {
shopId:uni.getStorageSync('shopId')
}
this.$Request.get("/app/goods/getShopActivity", data).then(res => {
if (res.code == 0) {
this.activityId = res.data.activityId
this.myhd = res.data.activityImage.split(',')
}
});
},
getHuoDongList() {
let data = {
page: this.page,
limit: this.limit
}
this.$Request.getT("/app/activityManage/getActivityList", data).then(res => {
uni.stopPullDownRefresh()
if (res.code == 0) {
res.data.records.map(item=>{
if(item.activityId==14){
item.no = '是'
}
if(item.activityId==this.activityId){
item.se = '是'
}else{
item.se = '否'
}
})
this.total = res.data.pages
if (this.page == 1) {
this.huodongList = res.data.records
} else {
this.huodongList = [...this.huodongList, ...res.data.records]
}
if(this.page == this.total){
this.status = 'nomore'
}else{
this.status = 'loadmore'
}
}
});
},
}
}
</script>
<style lang="scss">
.myswiper {
width: 100%;
height: 340rpx;
z-index: 0;
}
.list {
width: 100%;
height: 160rpx;
.list-box {
width: 686rpx;
height: 100%;
border-radius: 24rpx;
background-color: #ffffff;
margin-bottom: 20rpx;
z-index: 999;
.list-box-c {
width: 646rpx;
height: 100%;
}
.list-box-c-l {
image {
width: 100rpx;
height: 100rpx;
border-radius: 16rpx;
}
.list-box-c-l-txt {
width: 50vw;
height: 100rpx;
margin-left: 20rpx;
font-size: 26rpx;
overflow: hidden;
line-height: 100rpx;
}
}
.list-box-c-r {
// border: 1rpx solid #FCD202;
background: #FCD202;
padding: 10rpx 30rpx 10rpx 30rpx;
// color: #ffffff;
font-size: 26rpx;
border-radius: 24rpx;
}
}
}
</style>

596
my/store/index.vue Normal file
View File

@@ -0,0 +1,596 @@
<template>
<view class="padding">
<view class="text-white padding bg radius">
<u-form :model="shop" label-position="top">
<u-form-item label="店铺名称 ">
<text class="text-sm" @click="gokefu()"
style="color: red;position: absolute;top: 20rpx;left:135rpx;">*请联系客服修改</text>
<u-input v-model="shop.shopName" placeholder="请输入店铺名称" :disabled="true" />
</u-form-item>
<u-form-item label="开店时间">
<!-- #ifdef MP-WEIXIN -->
<u-input v-model="shop.businessHours" placeholder="请填写" :disabled="true"
@click="startShow = true" />
<!-- #endif -->
<!-- #ifndef MP-WEIXIN -->
<view style="width: 100%;">
<picker mode="time" :value="shop.businessHours" placeholder="请填写" start="00:00" end="23:59"
@change="bindTimeChange">
<view class="uni-input">{{shop.businessHours?shop.businessHours:'请填写'}}</view>
</picker>
</view>
<!-- #endif -->
</u-form-item>
<u-form-item label="闭店时间">
<!-- #ifdef MP-WEIXIN -->
<u-input v-model="shop.lockHours" :disabled="true" placeholder="请填写" @click="endShow = true" />
<!-- #endif -->
<!-- #ifndef MP-WEIXIN -->
<view style="width: 100%;">
<picker mode="time" :value="shop.lockHours" placeholder="请填写" start="00:00" end="23:59"
@change="bindTimeChanges">
<view class="uni-input">{{shop.lockHours?shop.lockHours:'请填写'}}</view>
</picker>
</view>
<!-- #endif -->
</u-form-item>
<u-form-item label="店铺地址">
<text class="text-sm" @click="gokefu()"
style="color: red;position: absolute;top: 20rpx;left:135rpx;">*请联系客服修改</text>
<!-- @click="bindOpen()" -->
<u-input v-model="shop.detailedAddress" :disabled="true" placeholder="请填写" />
</u-form-item>
<u-form-item label="店铺公告">
<textarea v-model="shop.shopNotice" rows="3" placeholder="请填写" maxlength="50" />
</u-form-item>
<u-form-item label="配送费(元)">
<text class="text-sm" @click="gokefu()"
style="color: red;position: absolute;top: 20rpx;left:155rpx;">*请联系客服修改</text>
<u-input v-model="shop.errandMoney" placeholder="请输入配送费" :disabled="true" />
</u-form-item>
<u-form-item label="最低起送金额(元)">
<u-input v-model="shop.minimumDelivery" placeholder="请输入最低起送金额" />
</u-form-item>
<u-form-item label="减免配送费最小订单金额(元)">
<u-input v-model="shop.exemptMinMoney" placeholder="请输入减免配送费最小订单金额" />
</u-form-item>
<u-form-item label="最大配送距离(千米)">
<text class="text-sm" @click="gokefu()"
style="color: red;position: absolute;top: 20rpx;left:285rpx;">*请联系客服修改</text>
<u-input v-model="distributionDistance" placeholder="请输入最大配送距离(单位:km)" :disabled="true" />
</u-form-item>
<u-form-item label="是否上线">
<u-radio-group v-model="shop.putawayFlag">
<u-radio name=0>上班啦</u-radio>
<u-radio name=1>打烊啦</u-radio>
</u-radio-group>
</u-form-item>
<u-form-item label="是否开启平台配送">
<u-radio-group v-model="shop.autoSendOrder">
<u-radio name=0>开启</u-radio>
<u-radio name=1>关闭</u-radio>
</u-radio-group>
</u-form-item>
<u-form-item label="是否开启自动接单">
<u-radio-group v-model="shop.autoAcceptOrder">
<u-radio name=0>开启</u-radio>
<u-radio name=1>关闭</u-radio>
</u-radio-group>
</u-form-item>
</u-form>
</view>
<view class="text-white padding bg radius margin-tb">
<u-form :model="shop" label-position="top">
<u-form-item label="打印机">
<text class="text-sm"
style="color: red;position: absolute;top: 25rpx;left: 105rpx;">*一个打印机只能绑定一个商家</text>
<u-radio-group v-model="shop.facility">
<!-- <u-radio name=0>上线</u-radio> -->
<u-radio name=1>飞鹅</u-radio>
</u-radio-group>
</u-form-item>
<u-form-item label="设备sn编码">
<u-input v-model="shop.snCode" placeholder="请输入设备sn编码" />
</u-form-item>
<u-form-item label="设备key秘钥">
<u-input v-model="shop.value" placeholder="请输入设备key秘钥" />
</u-form-item>
</u-form>
</view>
<view class="text-white padding bg radius margin-tb">
<view>
<view class="text-lg margin-top-sm text-black">店铺logo</view>
<view class="flex" style="overflow: hidden;flex-wrap: wrap;">
<view v-if="shop.shopCover.length">
<view class="margin-top flex margin-right-sm flex-wrap">
<view class="flex"
style="width: 200rpx;height: 200rpx;margin-right: 2rpx;position: relative;">
<image :src="shop.shopCover" style="width: 100%;height: 100%;"></image>
<view style="z-index: 9;position: absolute;top: -15rpx;right: -15rpx;"
@click="removeImgs()">
<u-icon name="close-circle-fill" color="#2979ff" size="50rpx"></u-icon>
</view>
</view>
</view>
</view>
<view class="margin-top" @click="addImage()" v-if="shop.shopCover.length<=0">
<view style="width: 200rpx;height: 200rpx;background: #f4f5f6;"
class="flex justify-center align-center">
<view>
<view class="text-center">
<image src="../static/addimg.png" style="width: 65rpx;height: 55rpx;">
</image>
</view>
<view class="text-center text-black">添加图片</view>
</view>
</view>
</view>
</view>
</view>
<view>
<view class="text-lg margin-top-sm text-black">店铺活动广告图可多张</view>
<view class="flex" style="overflow: hidden;flex-wrap: wrap;">
<view v-if="shopBanner.length">
<view class="margin-top flex margin-right-sm flex-wrap">
<view class="flex"
style="width: 200rpx;height: 200rpx;margin-right: 2rpx;position: relative;"
v-for="(image,index) in shopBanner" :key="index">
<image :src="image" style="width: 100%;height: 100%;"></image>
<view style="z-index: 9;position: absolute;top: -15rpx;right: -15rpx;"
@click="removeImg(index)">
<u-icon name="close-circle-fill" color="#2979ff" size="50rpx"></u-icon>
</view>
</view>
</view>
</view>
<view class="margin-top" @click="addImages(2)" v-if="shopBanner.length<6">
<view style="width: 200rpx;height: 200rpx;background: #f4f5f6;"
class="flex justify-center align-center">
<view>
<view class="text-center">
<image src="../static/addimg.png" style="width: 65rpx;height: 55rpx;">
</image>
</view>
<view class="text-center text-black">添加图片</view>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 时间筛选 -->
<u-picker v-model="startShow" mode="time" :params="params" @confirm="getStarttime()"></u-picker>
<u-picker v-model="endShow" mode="time" :params="paramss" @confirm="getEndtime()"></u-picker>
<u-button @click="submit" class="margin-top" :custom-style="customStyle" shape="square" :hair-line="false">提交
</u-button>
</view>
</template>
<script>
import configdata from '@/common/config.js';
export default {
data() {
return {
shop: {
shopName: '',
businessHours: '',
lockHours: '',
detailedAddress: '',
shopNotice: '',
putawayFlag: 1,
latitude: '',
longitude: '',
shopCover: '',
//详情图
shopBanner: [],
shopId: uni.getStorageSync('shopId'),
errandMoney: '',
minimumDelivery: '',
exemptMinMoney: '',
distributionDistance: '',
autoSendOrder: 1,
autoAcceptOrder: 1,
facility: 1,
snCode: '',
value: ''
},
// facility:1,
startShow: false,
endShow: false,
customStyle: {
backgroundColor: '#FFCC00',
color: '#000000',
border: 0
},
status: 1,
customStyle1: {
color: '#000000',
position: "fixed",
bottom: "15rpx",
left: "0rpx",
right: "0rpx",
margin: "0rpx 50rpx",
backgroundColor: '#FFCC00',
},
selarr: [],
show: false,
//详情图
shopBanner: [],
params: {
year: false,
month: false,
day: false,
hour: true,
minute: true,
second: false
},
paramss: {
year: false,
month: false,
day: false,
hour: true,
minute: true,
second: false
},
shopId: '',
page: 1,
limit: 100,
list: [{
name: '上线',
disabled: false
},
{
name: '下线',
disabled: false
}
],
distributionDistance: ''
}
},
onLoad(option) {
uni.showLoading({
title: '加载中......',
icon: 'loading'
})
// console.log(option, '店铺id')
this.shopId = option.shopId
this.getShopList()
},
onShow() {
},
methods: {
gokefu() {
uni.navigateTo({
url: '/pages/my/chat'
})
},
bindTimeChange: function(e) {
console.log(e)
this.shop.businessHours = e.target.value
},
bindTimeChanges: function(e) {
console.log(e)
this.shop.lockHours = e.target.value
},
//上线 下线
radioChange(e) {
// console.log(e)
},
// 店铺信息
getShopList() {
let data = {
shopId: this.$queue.getData('shopId')
}
this.$Request.getA("/app/shop/selectShopMessage", data).then(res => {
if (res.code == 0) {
uni.hideLoading()
this.shop.shopName = res.data.shopName
this.shop.detailedAddress = res.data.detailedAddress
this.shop.businessHours = res.data.businessHours
this.shop.lockHours = res.data.lockHours
this.shop.shopCover = res.data.shopCover
this.shop.shopNotice = res.data.shopNotice
this.shop.putawayFlag = res.data.putawayFlag ? res.data.putawayFlag : 0
this.shop.errandMoney = res.data.errandMoney
this.shop.minimumDelivery = res.data.minimumDelivery
this.shop.exemptMinMoney = res.data.exemptMinMoney
if (res.data.shopBanner) {
this.shop.shopBanner = res.data.shopBanner.split(',')
this.shopBanner = res.data.shopBanner.split(',')
}
this.shop.distributionDistance = res.data.distributionDistance
this.distributionDistance = res.data.distributionDistance / 1000
this.shop.autoSendOrder = res.data.autoSendOrder ? res.data.autoSendOrder : 0;
this.shop.autoAcceptOrder = res.data.autoAcceptOrder ? res.data.autoAcceptOrder : 0;
this.shop.snCode = res.data.snCode //设备sn编码
this.shop.value = res.data.value //设备key秘钥
// this.shop.facility = res.data.facility // 设备类型
}
});
},
getStarttime(e) {
console.log(e, '1111111111')
this.shop.businessHours = e.hour + ':' + e.minute
},
getEndtime(e) {
console.log(e)
this.shop.lockHours = e.hour + ':' + e.minute
},
// 详情图删除
removeImg(index) {
this.shopBanner.splice(index, 1)
},
// 店铺logo删除
removeImgs() {
this.shop.shopCover = ''
},
bindOpen(e) {
console.log(e)
let that = this
uni.chooseLocation({
success: function(res) {
console.log('位置名称:' + res.name);
console.log('详细地址:' + res.address);
console.log('纬度:' + res.latitude);
console.log('经度:' + res.longitude);
that.shop.detailedAddress = res.address
that.shop.shopLat = res.latitude
that.shop.shopLng = res.longitude
}
});
},
// 图片上传
addImages(e) {
let that = this
uni.chooseImage({
count: 6,
sourceType: ['album', 'camera'],
success: res => {
for (let i = 0; i < res.tempFilePaths.length; i++) {
that.$queue.showLoading("上传中...");
uni.uploadFile({ // 上传接口
url: that.config("APIHOST1") + '/alioss/upload', //真实的接口地址
filePath: res.tempFilePaths[i],
name: 'file',
success: (uploadFileRes) => {
if (that.shopBanner.length < 6) {
that.shopBanner.push(JSON.parse(uploadFileRes.data).data)
}
console.log(that.shopBanner)
uni.hideLoading();
}
});
}
}
})
},
// 图片上传
addImage() {
let that = this
uni.chooseImage({
count: 1,
sourceType: ['album', 'camera'],
success: res => {
for (let i = 0; i < res.tempFilePaths.length; i++) {
that.$queue.showLoading("上传中...");
uni.uploadFile({ // 上传接口
url: that.config("APIHOST1") + '/alioss/upload', //真实的接口地址
// url: 'https://jiazheng.xianmxkj.com/sqx_fast/alioss/upload',
filePath: res.tempFilePaths[i],
name: 'file',
success: (uploadFileRes) => {
that.shop.shopCover = JSON.parse(uploadFileRes.data).data
uni.hideLoading();
}
});
}
}
})
},
config: function(name) {
var info = null;
if (name) {
var name2 = name.split("."); //字符分割
if (name2.length > 1) {
info = configdata[name2[0]][name2[1]] || null;
} else {
info = configdata[name] || null;
}
if (info == null) {
let web_config = cache.get("web_config");
if (web_config) {
if (name2.length > 1) {
info = web_config[name2[0]][name2[1]] || null;
} else {
info = web_config[name] || null;
}
}
}
}
return info;
},
// 发布
submit() {
console.log(this.distributionDistance)
this.shop.shopBanner = this.shopBanner
this.shop.shopBanner = this.shop.shopBanner.toString();
this.shop.distributionDistance = this.distributionDistance * 1000
// this.shop.distributionDistance = this.shop.distributionDistance * 1000
// if (!this.shop.shopName) {
// uni.showToast({
// title: '请填写店铺名称',
// icon: 'none',
// duration: 1000
// })
// return
// }
if (!this.shop.businessHours) {
uni.showToast({
title: '请填写开店时间',
icon: 'none',
duration: 1000
})
return
}
if (!this.shop.lockHours) {
uni.showToast({
title: '请填写闭店时间',
icon: 'none',
duration: 1000
})
return
}
// if (!this.shop.detailedAddress) {
// uni.showToast({
// title: '请填写店铺地址',
// icon: 'none',
// duration: 1000
// })
// return
// }
if (!this.shop.shopNotice) {
uni.showToast({
title: '请填写店铺公告',
icon: 'none',
duration: 1000
})
return
}
// if (!this.shop.snCode) {
// uni.showToast({
// title: '请填写设备sn编码',
// icon: 'none',
// duration: 1000
// })
// return
// }
// if (!this.shop.value) {
// uni.showToast({
// title: '请填写设备key秘钥',
// icon: 'none',
// duration: 1000
// })
// return
// }
if (!this.shop.shopCover) {
uni.showToast({
title: '请上传店铺logo',
icon: 'none',
duration: 1000
})
return
}
if (!this.shop.shopBanner) {
uni.showToast({
title: '请上传店铺轮播图',
icon: 'none',
duration: 1000
})
return
}
// console.log('this.shop.putawayFlag',this.shop.putawayFlag)
// return
if (this.shop.putawayFlag == 0) {
// if (!this.shop.errandMoney) {
// uni.showToast({
// title: '请填写配送费',
// icon: 'none',
// duration: 1000
// })
// return
// }
if (!this.shop.minimumDelivery) {
this.shop.minimumDelivery = 0;
// uni.showToast({
// title: '请填写最低起送金额',
// icon: 'none',
// duration: 1000
// })
// return
}
if (!this.shop.exemptMinMoney) {
this.shop.exemptMinMoney = 0;
// uni.showToast({
// title: '请填写减免配送费最小订单金额',
// icon: 'none',
// duration: 1000
// })
// return
}
console.log(this.shop.distributionDistance)
// if (!this.shop.distributionDistance) {
// uni.showToast({
// title: '请填写最大配送距离',
// icon: 'none',
// duration: 1000
// })
// return
// }
}
console.log(this.shop)
// uni.setStorageSync('shopId', this.shop.shopId)
this.$Request.postJsonA("/app/shop/updateShopMessage", this.shop).then(res => {
if (res.code == 0) {
uni.showToast({
title: '修改成功',
icon: 'none'
})
setTimeout(function() {
uni.navigateBack()
// uni.navigateTo({
// url: '/my/publish/index'
// })
}, 1000)
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
});
},
}
}
</script>
<style>
page {
background-color: #F5F5F5;
}
.bg {
background-color: #FFFFFF;
}
.tabBox {
border: 1rpx solid #999999;
padding: 15rpx 20rpx;
border-radius: 15rpx;
font-size: 28rpx;
}
.btnnum {
color: #005DFF;
border: 1rpx solid #005DFF;
}
</style>

369
my/store/pingjia.vue Normal file
View File

@@ -0,0 +1,369 @@
<template>
<view>
<view class="flex margin-lr padding-tb-sm u-border-bottom" v-if="shopDet.shopScore">
<view class="flex padding-right">
<view class="text-sl" style="color: #FD6416;">{{shopDet.shopScore}}</view>
<view class="flex flex-direction justify-around margin-left-sm">
<view>商家评分</view>
<view class="flex">
<u-icon v-for="ite in shopDet.shopScore1" :key='ite' color="#FCD202" name="star-fill"></u-icon>
</view>
</view>
</view>
<view class="flex-sub flex justify-around u-border-left padding-left">
<view class="flex flex-direction justify-around text-center">
<view>好评</view>
<view>{{EvaluateData.goodReputation}}</view>
</view>
<view class="flex flex-direction justify-around text-center">
<view>中评</view>
<view>{{EvaluateData.mediumReview}}</view>
</view>
<view class="flex flex-direction justify-around text-center">
<view>差评</view>
<view>{{EvaluateData.negativeComment}}</view>
</view>
</view>
</view>
<view class="padding-tb-sm margin-lr">
<u-button hover-class='none' @click="sel(0)" type="primary" shape="circle" size="mini" :plain="false"
:custom-style="count==0?customStyle:customStyle1">全部评论</u-button>
<u-button hover-class='none' @click="sel(1)" type="primary" shape="circle" size="mini" :plain="false"
:custom-style="count==1?customStyle:customStyle1">
好评({{EvaluateData.goodReputation}})</u-button>
<u-button hover-class='none' @click="sel(2)" type="primary" shape="circle" size="mini" :plain="false"
:custom-style="count==2?customStyle:customStyle1">
中评({{EvaluateData.mediumReview}})</u-button>
<u-button hover-class='none' @click="sel(3)" type="primary" shape="circle" size="mini" :plain="false"
:custom-style="count==3?customStyle:customStyle1">
差评({{EvaluateData.negativeComment}})</u-button>
</view>
<view class="padding-tb-sm margin-lr u-border-bottom" v-for="(item, index) in EvaluateList" :key='index'>
<view class="flex justify-between align-center">
<view class="flex align-center">
<u-avatar :src="item.avatar" size="65"></u-avatar>
<view class=" margin-left-sm" style="line-height: 46upx;">{{item.userName?item.userName:'匿名'}}
</view>
<view class="flex margin-left-sm">
<u-icon v-for="ite in item.score" :key='ite' color="#FCD202" name="star-fill">
</u-icon>
</view>
</view>
<view>{{item.createTime}}</view>
</view>
<view style="display: flex;">
<view class="margin-top-sm" :style="!item.shopReplyMessage ? 'width: 90%;' : ''">{{item.evaluateMessage}}</view>
<view class="flex padding-top-sm margin-right" @tap="goShow(index)" v-if="!item.shopReplyMessage">
<image src="../../static/images/order/pinglun.png" style="width: 20px;height: 20px;"></image>
</view>
</view>
<view class="margin-top-sm" v-if="item.shopReplyMessage">
<view class="flex align-center">
<view class=" flex align-center text-df" style="color: #999999;">
<view class="text-df">商家回复:</view>{{item.shopReplyMessage}}
</view>
</view>
<!-- <view class="text-lg padding-left margin-left-xl">{{dataDet.shopReplyMessage}}</view> -->
</view>
<view class="flex" style="width: 100%;margin-top: 20rpx;flex-wrap: wrap;" v-if="item.pictures">
<image @click="lookImgs(ind,item.pictures)" :src="ite" v-for="(ite,ind) in item.pictures" :key="ind" style="width: 200rpx;height: 200rpx;margin-right: 10rpx;margin-bottom: 10rpx;" mode=""></image>
</view>
</view>
<empty v-if="EvaluateList.length<=0"></empty>
<!-- 评论弹框 -->
<u-popup v-model="show" mode="bottom" border-radius="14" :closeable="closeable">
<view>
<view class="margin padding-tb">
<u-input v-model="pinglun" type="textarea" height="200" placeholder="请填写回复的内容" maxlengt="200"
:clearable="false" style="background:#F5F5F5;" />
</view>
<view class="btn" @click="bindEvaluate()">提交</view>
</view>
</u-popup>
</view>
</template>
<script>
import empty from '../../components/empty.vue'
export default {
components:{
empty
},
data() {
return {
pinglun: '',
count: 0,
show: false,
customStyle: {
color: '#333333',
background: '#FCD202',
marginRight: '20rpx',
border: 0
},
customStyle1: {
color: '#333333',
background: '#F2F2F2',
marginRight: '20rpx',
border: 0
},
cashDeposit: [],
EvaluateData: {},
EvaluateList: [],
grade: '',
page: 1,
size: 10,
isShow: false,
oneData: [],
titleData: [],
shopDet: {}
}
},
onShow() {
this.getshanghuinfo();
this.getList()
},
onReachBottom: function() {
this.page = this.page + 1;
this.getList()
},
methods: {
//预览图片
lookImgs(index,imgs){
uni.previewImage({
current:index,
urls:imgs
})
},
goShow(index){
this.orderNumber = this.EvaluateList[index].orderNumber;
this.show = true;
},
getshanghuinfo() {
let data = {
shopId: uni.getStorageSync('shopId')
}
this.$Request.get("/app/shop/selectShopMessage", data).then(res => {
if (res.code == 0) {
this.shopDet = res.data;
this.shopDet.shopScore = parseFloat(this.shopDet.shopScore).toFixed(1)
this.shopDet.shopScore1 = Math.floor(this.shopDet.shopScore)
}
});
},
//评论
bindEvaluate() {
let data = {
shopReplyMessage: this.pinglun,
orderNumber: this.orderNumber
}
this.$Request.postT("/admin/order/shopReplyEvaluate", data).then(res => {
uni.hideLoading()
if (res.code == 0) {
this.show = false
this.page = 1
this.getList()
}
});
},
sel(e) {
this.grade = e
this.count = e
this.page = 1
this.getList()
},
open(data) {
console.log(data);
this.oneData = data;
this.titleData = data.goods
this.isShow = true;
},
close() {
this.isShow = false;
},
// 获取评价列表
getList() {
let data = {
shopId: uni.getStorageSync('shopId'),
page: this.page,
limit: this.size,
grade: this.grade
}
this.$Request.get("/app/goods/selectEvaluateByShopId", data).then(res => {
if (res.code == 0 && res.data) {
this.EvaluateData = res.data
res.data.pageUtils.list.map(item=>{
if(item.pictures){
item.pictures = item.pictures.split(',')
}else{
item.pictures = []
}
})
if (this.page == 1) {
this.EvaluateList = res.data.pageUtils.list
} else {
this.EvaluateList = [...this.EvaluateList, ...res.data.pageUtils.list]
}
}
});
}
}
}
</script>
<style lang="scss">
page {
background-color: #FFFFFF;
}
.box1 {
position: absolute;
background: #000000;
width: 750rpx;
height: 100vh;
opacity: 0.4;
}
.moudes {
width: 650rpx;
position: absolute;
background: #FFFFFF;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
height: 700rpx;
border-radius: 10rpx;
.bt {
font-size: 30rpx;
font-weight: bold;
}
.pjImg {
width: 200rpx;
height: 200rpx;
}
.navBox {
.avtiter {
width: 80rpx;
height: 80rpx;
border-radius: 40rpx;
margin-right: 15rpx
}
padding-left: 30rpx;
padding-top: 30rpx;
display: flex;
align-items: center;
.userName {
font-size: 28rpx;
font-weight: bold;
}
}
}
.nrTxt {
display: inline-block;
width: 500rpx;
}
.navList {
text-align: center;
margin-top: 30rpx;
padding-left: 30rpx;
padding-right: 30rpx;
display: flex;
justify-content: center;
.xq {
font-size: 30rpx;
font-weight: bolder;
text-align: center;
}
}
.contentTxt {
view {
margin-bottom: 30rpx;
display: flex;
align-items: center;
}
.title {
font-size: 30rpx;
font-weight: bold;
color: #000000;
margin-right: 15rpx;
}
.imgRsc {
width: 100rpx;
height: 100rpx;
border-radius: 10rpx;
}
}
.list_1 {
position: absolute;
}
.btn {
width: 690upx;
height: 88upx;
margin: 30upx auto;
background: #FCD202;
box-shadow: 0px 10upx 20upx 0upx #FFD9B3;
border-radius: 16upx;
display: flex;
align-items: center;
justify-content: center;
color: #000000;
}
.one {
background: #FFFFFF;
margin-top: 20rpx;
display: flex;
justify-content: space-between;
padding: 20rpx;
.imgSrc {
width: 100rpx;
height: 100rpx;
vertical-align: middle;
margin-right: 20rpx;
border-radius: 10rpx;
}
.name {
margin-top: 10rpx;
margin-bottom: 20rpx;
font-size: 24rpx;
color: #000000;
}
.timer {
font-size: 20rpx;
color: #b3b3c4;
}
.contentTxt {
font-size: 24rpx;
color: #000000;
}
}
</style>