优化分组商品编辑
This commit is contained in:
3
env/env.development.js
vendored
3
env/env.development.js
vendored
@@ -4,6 +4,5 @@ export default {
|
||||
'JEEPAY_BASE_URL_WSS': 'ws://192.168.1.31:2348' ,// sockets
|
||||
// 'JEEPAY_BASE_URL': 'https://cashier.sxczgkj.com/', // 请求URL(生产环境)
|
||||
// 'JEEPAY_BASE_URL_H5': 'https://cashier.sxczgkj.com/',
|
||||
// 'JEEPAY_BASE_URL_WSS': 'wss://czgeatws.sxczgkj.com/wss' // sockets
|
||||
|
||||
// 'JEEPAY_BASE_URL_WSS': 'wss://czgeatws.sxczgkj.com/wss' // sockets
|
||||
}
|
||||
@@ -166,18 +166,7 @@
|
||||
"enable" : true
|
||||
},
|
||||
"devServer" : {
|
||||
"disableHostCheck" : true,
|
||||
"proxy" : {
|
||||
"/api" : {
|
||||
// 需要被代理的后台地址
|
||||
"target" : "https://tapi.cashier.sxczgkj.cn",
|
||||
"changeOrigin" : true,
|
||||
"secure" : true,
|
||||
"pathRewrite" : {
|
||||
"/api" : ""
|
||||
}
|
||||
}
|
||||
}
|
||||
"disableHostCheck" : true
|
||||
},
|
||||
"sdkConfigs" : {
|
||||
"maps" : {
|
||||
|
||||
@@ -7,106 +7,111 @@
|
||||
<up--image :width="63" :height="63" :radius="3" :src="data.coverImg"></up--image>
|
||||
</view>
|
||||
<view class="w-full info u-p-l-30">
|
||||
<view class=" color-333 u-flex u-row-between">
|
||||
<view class="color-333 u-flex u-row-between">
|
||||
<view class="u-flex">
|
||||
<text class="u-m-r-24">{{data.name}}</text>
|
||||
<text class="u-m-r-24">{{ data.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-10 u-row-right">
|
||||
<view class="u-flex u-m-t-10 u-row-right">
|
||||
<view class="btn-default btn" @tap="del">删除</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class=" u-flex u-p-l-30 u-p-r-30 u-p-t-16 u-p-b-16" @click="goodsClick">
|
||||
<my-radio disabled @click.stop="goodsClick" :modelValue="data.checked"></my-radio>
|
||||
<view class="u-flex u-m-l-32">
|
||||
<text class="">{{data.name}}</text>
|
||||
<view class="goods-wrap">
|
||||
<view class="goods-item u-flex" @click="goodsClick">
|
||||
<my-radio @click="goodsClick" :modelValue="data.checked"></my-radio>
|
||||
<view class="u-flex u-m-l-10">
|
||||
<text class="">{{ data.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const emits = defineEmits(['goodsClick', 'del'])
|
||||
const emits = defineEmits(['goodsClick', 'del']);
|
||||
|
||||
const props = defineProps({
|
||||
isBind: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
index: {
|
||||
type: Number
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
checked:false,
|
||||
}
|
||||
}
|
||||
},
|
||||
showDetail: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
const props = defineProps({
|
||||
isBind: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
index: {
|
||||
type: Number
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
checked: false
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
function goodsClick(){
|
||||
emits('goodsClick',props.index)
|
||||
}
|
||||
|
||||
function del() {
|
||||
emits('del', props.index)
|
||||
},
|
||||
showDetail: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
});
|
||||
|
||||
function goodsClick() {
|
||||
emits('goodsClick', props.index);
|
||||
}
|
||||
|
||||
function del() {
|
||||
emits('del', props.index);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
$imgSize: 126rpx;
|
||||
$imgSize: 126rpx;
|
||||
|
||||
.btn {
|
||||
padding: 6rpx 28rpx;
|
||||
border-radius: 100rpx;
|
||||
border: 2rpx solid transparent;
|
||||
}
|
||||
.btn {
|
||||
padding: 6rpx 28rpx;
|
||||
border-radius: 100rpx;
|
||||
border: 2rpx solid transparent;
|
||||
}
|
||||
|
||||
.btn-default {
|
||||
border-color: #999;
|
||||
color: #999;
|
||||
}
|
||||
.btn-default {
|
||||
border-color: #999;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.img {
|
||||
width: $imgSize;
|
||||
height: $imgSize;
|
||||
}
|
||||
.img {
|
||||
width: $imgSize;
|
||||
height: $imgSize;
|
||||
}
|
||||
|
||||
.goods {
|
||||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||||
background-color: #fff;
|
||||
padding: 32rpx 28rpx 32rpx 28rpx;
|
||||
font-size: 28rpx;
|
||||
.goods {
|
||||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||||
background-color: #fff;
|
||||
padding: 32rpx 28rpx 32rpx 28rpx;
|
||||
font-size: 28rpx;
|
||||
|
||||
.skus {
|
||||
background: #F9F9F9;
|
||||
border-radius: 14rpx 14rpx 14rpx 14rpx;
|
||||
padding: 20rpx;
|
||||
.skus {
|
||||
background: #f9f9f9;
|
||||
border-radius: 14rpx 14rpx 14rpx 14rpx;
|
||||
padding: 20rpx;
|
||||
|
||||
.sku {
|
||||
color: #000;
|
||||
font-weight: 700;
|
||||
padding: 6rpx 40rpx;
|
||||
}
|
||||
.sku {
|
||||
color: #000;
|
||||
font-weight: 700;
|
||||
padding: 6rpx 40rpx;
|
||||
}
|
||||
|
||||
.skds {
|
||||
gap: 10rpx 50rpx;
|
||||
}
|
||||
.skds {
|
||||
gap: 10rpx 50rpx;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
}
|
||||
.goods-wrap {
|
||||
padding: 0 20upx;
|
||||
.goods-item {
|
||||
padding: 20upx 0;
|
||||
border-bottom: 1px solid #ececec;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,19 +1,22 @@
|
||||
<template>
|
||||
<view class="safe-page min-page">
|
||||
<up-sticky>
|
||||
<view class="bg-fff u-p-l-30 u-p-b-24">
|
||||
|
||||
<view class="bg-fff u-p-l-30 u-p-b-24">
|
||||
<view class="input-wrapper">
|
||||
<view class="input-main">
|
||||
<view class="u-flex u-p-r-30 u-font-28" @click="onCategoryShowChange(true)">
|
||||
<text class="u-m-r-10 u-line-1"
|
||||
style="max-width: 100rpx;">{{pageData.categoryName||'全部' }}</text>
|
||||
<text class="u-m-r-10 u-line-1" style="max-width: 100rpx">{{ pageData.categoryName || '全部' }}</text>
|
||||
<up-icon name="arrow-down" size="16"></up-icon>
|
||||
</view>
|
||||
<uni-easyinput clearable class='jeepay-search' :inputBorder="false"
|
||||
:placeholder="pageData.search.placeholder" v-model="pageData.query.name"
|
||||
<uni-easyinput
|
||||
clearable
|
||||
class="jeepay-search"
|
||||
:inputBorder="false"
|
||||
:placeholder="pageData.search.placeholder"
|
||||
v-model="pageData.query.name"
|
||||
@clear="searchFunc"
|
||||
@confirm="searchFunc">
|
||||
@confirm="searchFunc"
|
||||
>
|
||||
<template #prefixIcon>
|
||||
<image src="@/static/iconImg/icon-search.svg" class="input-icon" />
|
||||
</template>
|
||||
@@ -23,393 +26,390 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex states1 u-row-between u-font-28">
|
||||
<view class=" u-flex-1 item u-flex u-row-center tranistion u-text-center color-333"
|
||||
:class="{'active':pageData.stateCurrent==index}" @tap="statesTableClick(index)"
|
||||
v-for="(item,index) in statesTabsList" :key="index">
|
||||
<view class="text">{{item}}</view>
|
||||
<view class="u-flex states1 u-row-between u-font-28">
|
||||
<view
|
||||
class="u-flex-1 item u-flex u-row-center tranistion u-text-center color-333"
|
||||
:class="{ active: pageData.stateCurrent == index }"
|
||||
@tap="statesTableClick(index)"
|
||||
v-for="(item, index) in statesTabsList"
|
||||
:key="index"
|
||||
>
|
||||
<view class="text">{{ item }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</up-sticky>
|
||||
<template v-if="pageData.stateCurrent==0">
|
||||
<view class="goods-list u-p-30">
|
||||
<template v-if="pageData.stateCurrent == 0">
|
||||
<view class="goods-list u-p-30">
|
||||
<template v-if="pageData.bindGoodsList.length">
|
||||
<view class="u-m-b-32" v-for="(item,index) in pageData.bindGoodsList" :key="index">
|
||||
<my-goods isBind :index="index" :data="item" @del="goodsDel"
|
||||
:showDetail="pageData.showGoodsDetail"></my-goods>
|
||||
<view class="u-m-b-32" v-for="(item, index) in pageData.bindGoodsList" :key="index">
|
||||
<my-goods isBind :index="index" :data="item" @del="goodsDel" :showDetail="pageData.showGoodsDetail"></my-goods>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="pageData.hasAjax&&!pageData.bindGoodsList.length">
|
||||
<my-img-empty :tips="isSearch?'未搜索到相关绑定商品':'暂无绑定商品' "></my-img-empty>
|
||||
<template v-if="pageData.hasAjax && !pageData.bindGoodsList.length">
|
||||
<my-img-empty :tips="isSearch ? '未搜索到相关绑定商品' : '暂无绑定商品'"></my-img-empty>
|
||||
</template>
|
||||
<view style="height: 100rpx;"></view>
|
||||
<view style="height: 100rpx"></view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="goods-list u-p-30">
|
||||
<view class="goods-list u-p-30">
|
||||
<view class="bg-fff border-r-18 u-p-t-16 u-p-b-16 box-shadow">
|
||||
<template v-if="pageData.goodsList.length">
|
||||
<view class="" v-for="(item,index) in pageData.goodsList" :key="index">
|
||||
<my-goods @goodsClick="goodsClick" :index="index" :data="item"
|
||||
:showDetail="pageData.showGoodsDetail"></my-goods>
|
||||
<view class="" v-for="(item, index) in pageData.goodsList" :key="index">
|
||||
<my-goods @goodsClick="goodsClick" :index="index" :data="item" :showDetail="pageData.showGoodsDetail"></my-goods>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="pageData.hasAjax&&!pageData.goodsList.length">
|
||||
<template v-if="pageData.hasAjax && !pageData.goodsList.length">
|
||||
<my-img-empty tips="未找到相关商品"></my-img-empty>
|
||||
</template>
|
||||
</view>
|
||||
<view class="fixed-b">
|
||||
<my-button shape="circle" @click="save">确定</my-button>
|
||||
</view>
|
||||
<view style="height: 100rpx;"></view>
|
||||
<view style="height: 100rpx"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<!-- 分类 -->
|
||||
<my-category v-model:isShow="pageData.categoryShow" @confirm="setCategory"></my-category>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import { reactive, ref, watch } from 'vue';
|
||||
import myGoods from './components/goods.vue'
|
||||
import myCategory from './components/category.vue'
|
||||
import { hasPermission } from '@/commons/utils/hasPermission.js';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import { reactive, ref, watch } from 'vue';
|
||||
import myGoods from './components/goods.vue';
|
||||
import myCategory from './components/category.vue';
|
||||
import { hasPermission } from '@/commons/utils/hasPermission.js';
|
||||
|
||||
import { categoryPage } from '@/http/api/cateGory.js'
|
||||
import { getProductPage,getProdGroupDetail,updateProdGroup } from '@/http/api/product.js'
|
||||
|
||||
const pageData = reactive({
|
||||
stateCurrent: 0,
|
||||
search: {
|
||||
value: '',
|
||||
placeholder: '输入搜索的商品'
|
||||
},
|
||||
showGoodsDetail: false,
|
||||
bindGoodsList: [],
|
||||
goodsList: [],
|
||||
query: {
|
||||
page: 1,
|
||||
size: 999,
|
||||
categoryId: '',
|
||||
name: '',
|
||||
id: "",
|
||||
},
|
||||
category: '',
|
||||
categoryList: [], //分类列表
|
||||
categoryShow: false,
|
||||
categoryName: '',
|
||||
hasAjax: false
|
||||
})
|
||||
|
||||
|
||||
|
||||
let isSearch=ref(false)
|
||||
const statesTabsList = ['已添加', '未添加']
|
||||
const control = ref(null)
|
||||
const model = ref(null)
|
||||
const option = reactive({})
|
||||
//分类
|
||||
const category = ref(null)
|
||||
onLoad((opt) => {
|
||||
Object.assign(option, opt)
|
||||
init()
|
||||
})
|
||||
onShow(() => {
|
||||
|
||||
})
|
||||
watch(() => pageData.query.categoryId, (newval) => {
|
||||
if(pageData.stateCurrent==1){
|
||||
getGoodsList()
|
||||
}else{
|
||||
getGroupBindGoods()
|
||||
}
|
||||
})
|
||||
|
||||
watch(() => pageData.stateCurrent, (newval) => {
|
||||
if (newval==1) {
|
||||
getGoodsList()
|
||||
} else {
|
||||
getGroupBindGoods()
|
||||
}
|
||||
})
|
||||
async function init() {
|
||||
await getGroupBindGoods()
|
||||
getGoodsList()
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
async function searchFunc() {
|
||||
isSearch.value=true
|
||||
if (pageData.stateCurrent) {
|
||||
getGoodsList()
|
||||
} else {
|
||||
const res = await getProdGroupDetail(option.id)
|
||||
pageData.bindGoodsList = res.productList.filter(v=>{
|
||||
return v.name.includes(pageData.query.name)&&(pageData.query.categoryId==''?true:v.categoryId==pageData.query.categoryId)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品列表
|
||||
*/
|
||||
function getGoodsList() {
|
||||
getProductPage(pageData.query).then(res => {
|
||||
pageData.hasAjax = true
|
||||
let goodsList = res.records.map(v => {
|
||||
return {
|
||||
...v,
|
||||
checked: false
|
||||
}
|
||||
})
|
||||
pageData.goodsList = goodsList.filter(v => {
|
||||
return !pageData.bindGoodsList.find(bindGoods => bindGoods.id == v.id)
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分组详情
|
||||
*/
|
||||
async function getGroupBindGoods() {
|
||||
let res = await getProdGroupDetail(option.id)
|
||||
pageData.bindGoodsList = res.productList.filter(v=>{
|
||||
return pageData.query.categoryId === '' ? true : (v.categoryId==pageData.query.categoryId)&&(v.name.includes(pageData.query.name))
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 已添加/未添加切换
|
||||
* @param {Object} index
|
||||
*/
|
||||
function statesTableClick(index) {
|
||||
pageData.stateCurrent = index
|
||||
}
|
||||
|
||||
/**
|
||||
* 分类选择
|
||||
* @param {Object} show
|
||||
*/
|
||||
function onCategoryShowChange(show) {
|
||||
pageData.categoryShow = show
|
||||
}
|
||||
|
||||
/**
|
||||
* 分类选择确定
|
||||
* @param {Object} category
|
||||
*/
|
||||
function setCategory(category) {
|
||||
pageData.query.categoryId = category.id
|
||||
pageData.categoryName = category.name
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定商品
|
||||
*/
|
||||
async function save() {
|
||||
const res = await hasPermission('允许修改分组')
|
||||
if (!res) {
|
||||
return
|
||||
}
|
||||
await updateProdGroup({
|
||||
...option,
|
||||
productIds: [...pageData.bindGoodsList.map(v => v.id), ...pageData.goodsList.filter(v => v.checked)
|
||||
.map(v => v.id)
|
||||
]
|
||||
})
|
||||
pageData.stateCurrent = 0
|
||||
}
|
||||
import { categoryPage } from '@/http/api/cateGory.js';
|
||||
import { getProductPage, getProdGroupDetail, updateProdGroup } from '@/http/api/product.js';
|
||||
|
||||
|
||||
/**
|
||||
* 删除商品
|
||||
* @param {Object} index
|
||||
*/
|
||||
async function goodsDel(index) {
|
||||
const res = await hasPermission('允许修改分组')
|
||||
if (!res) {
|
||||
return
|
||||
const pageData = reactive({
|
||||
stateCurrent: 0,
|
||||
search: {
|
||||
value: '',
|
||||
placeholder: '输入搜索的商品'
|
||||
},
|
||||
showGoodsDetail: false,
|
||||
bindGoodsList: [],
|
||||
goodsList: [],
|
||||
query: {
|
||||
page: 1,
|
||||
size: 999,
|
||||
categoryId: '',
|
||||
name: '',
|
||||
id: ''
|
||||
},
|
||||
// 原始已绑定的上商品列表
|
||||
bindOriginGoodsList: [],
|
||||
category: '',
|
||||
categoryList: [], //分类列表
|
||||
categoryShow: false,
|
||||
categoryName: '',
|
||||
hasAjax: false
|
||||
});
|
||||
|
||||
let isSearch = ref(false);
|
||||
const statesTabsList = ['已添加', '未添加'];
|
||||
const control = ref(null);
|
||||
const model = ref(null);
|
||||
const option = reactive({});
|
||||
//分类
|
||||
const category = ref(null);
|
||||
onLoad((opt) => {
|
||||
Object.assign(option, opt);
|
||||
init();
|
||||
});
|
||||
onShow(() => {});
|
||||
watch(
|
||||
() => pageData.query.categoryId,
|
||||
(newval) => {
|
||||
if (pageData.stateCurrent == 1) {
|
||||
getGoodsList();
|
||||
} else {
|
||||
getGroupBindGoods();
|
||||
}
|
||||
const goods = pageData.bindGoodsList[index]
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '是否确认将' + goods.name + '从该分组中移除',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
pageData.bindGoodsList.splice(index, 1)
|
||||
updateProdGroup({
|
||||
...option,
|
||||
productIds: pageData.bindGoodsList.map(v => v.id)
|
||||
})
|
||||
} else if (res.cancel) {}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
watch(
|
||||
() => pageData.stateCurrent,
|
||||
(newval) => {
|
||||
if (newval == 1) {
|
||||
getGoodsList();
|
||||
} else {
|
||||
getGroupBindGoods();
|
||||
}
|
||||
}
|
||||
);
|
||||
async function init() {
|
||||
await getGroupBindGoods();
|
||||
getGoodsList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
async function searchFunc() {
|
||||
isSearch.value = true;
|
||||
if (pageData.stateCurrent) {
|
||||
getGoodsList();
|
||||
} else {
|
||||
const res = await getProdGroupDetail(option.id);
|
||||
pageData.bindGoodsList = res.productList.filter((v) => {
|
||||
return v.name.includes(pageData.query.name) && (pageData.query.categoryId == '' ? true : v.categoryId == pageData.query.categoryId);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function goodsClick(e) {
|
||||
pageData.goodsList[e].checked = !pageData.goodsList[e].checked
|
||||
/**
|
||||
* 获取商品列表
|
||||
*/
|
||||
function getGoodsList() {
|
||||
getProductPage(pageData.query).then((res) => {
|
||||
pageData.hasAjax = true;
|
||||
let goodsList = res.records.map((v) => {
|
||||
return {
|
||||
...v,
|
||||
checked: false
|
||||
};
|
||||
});
|
||||
pageData.goodsList = goodsList.filter((v) => {
|
||||
return !pageData.bindOriginGoodsList.find((bindGoods) => bindGoods.id == v.id);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分组详情
|
||||
*/
|
||||
async function getGroupBindGoods() {
|
||||
let res = await getProdGroupDetail(option.id);
|
||||
pageData.bindOriginGoodsList = res.productList;
|
||||
pageData.bindGoodsList = res.productList.filter((v) => {
|
||||
return pageData.query.categoryId === '' ? true : v.categoryId == pageData.query.categoryId && v.name.includes(pageData.query.name);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 已添加/未添加切换
|
||||
* @param {Object} index
|
||||
*/
|
||||
function statesTableClick(index) {
|
||||
pageData.stateCurrent = index;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分类选择
|
||||
* @param {Object} show
|
||||
*/
|
||||
function onCategoryShowChange(show) {
|
||||
pageData.categoryShow = show;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分类选择确定
|
||||
* @param {Object} category
|
||||
*/
|
||||
function setCategory(category) {
|
||||
pageData.query.categoryId = category.id;
|
||||
pageData.categoryName = category.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定商品
|
||||
*/
|
||||
async function save() {
|
||||
const res = await hasPermission('允许修改分组');
|
||||
if (!res) {
|
||||
return;
|
||||
}
|
||||
await updateProdGroup({
|
||||
...option,
|
||||
productIds: [...pageData.bindOriginGoodsList.map((v) => v.id), ...pageData.goodsList.filter((v) => v.checked).map((v) => v.id)]
|
||||
});
|
||||
pageData.stateCurrent = 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除商品
|
||||
* @param {Object} index
|
||||
*/
|
||||
async function goodsDel(index) {
|
||||
const res = await hasPermission('允许修改分组');
|
||||
if (!res) {
|
||||
return;
|
||||
}
|
||||
const goods = pageData.bindOriginGoodsList[index];
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '是否确认将' + goods.name + '从该分组中移除',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
pageData.bindGoodsList.splice(index, 1);
|
||||
pageData.bindOriginGoodsList.splice(index, 1);
|
||||
updateProdGroup({
|
||||
...option,
|
||||
productIds: pageData.bindOriginGoodsList.map((v) => v.id)
|
||||
});
|
||||
} else if (res.cancel) {
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function goodsClick(e) {
|
||||
pageData.goodsList[e].checked = !pageData.goodsList[e].checked;
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
page {
|
||||
background: #F9F9F9;
|
||||
}
|
||||
page {
|
||||
background: #f9f9f9;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
.stock-btns {
|
||||
padding: 0 100rpx;
|
||||
.stock-btns {
|
||||
padding: 0 100rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.safe-page {
|
||||
background: #f9f9f9;
|
||||
}
|
||||
|
||||
.icon-guige {
|
||||
width: 42rpx;
|
||||
height: 42rpx;
|
||||
}
|
||||
|
||||
.bg-fff {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.myTabs {
|
||||
margin: 0 auto;
|
||||
width: 434rpx;
|
||||
height: 64rpx;
|
||||
}
|
||||
|
||||
.input-wrapper {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-top: 26rpx;
|
||||
background-color: $J-bg-ff;
|
||||
|
||||
.input-main {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.safe-page {
|
||||
background: #F9F9F9;
|
||||
}
|
||||
|
||||
.icon-guige {
|
||||
width: 42rpx;
|
||||
height: 42rpx;
|
||||
}
|
||||
|
||||
.bg-fff {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.myTabs {
|
||||
margin: 0 auto;
|
||||
width: 434rpx;
|
||||
height: 64rpx;
|
||||
}
|
||||
|
||||
.input-wrapper {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-top: 26rpx;
|
||||
background-color: $J-bg-ff;
|
||||
height: 64rpx;
|
||||
|
||||
.input-main {
|
||||
image {
|
||||
padding: 22rpx;
|
||||
width: 26rpx;
|
||||
height: 26rpx;
|
||||
}
|
||||
|
||||
input {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 64rpx;
|
||||
font-size: 27rpx;
|
||||
}
|
||||
|
||||
image {
|
||||
padding: 22rpx;
|
||||
width: 26rpx;
|
||||
height: 26rpx;
|
||||
}
|
||||
::v-deep uni-button {
|
||||
font-size: 28rpx;
|
||||
color: $my-main-color;
|
||||
background: rgba(255, 255, 255, 1);
|
||||
}
|
||||
|
||||
input {
|
||||
flex: 1;
|
||||
font-size: 27rpx;
|
||||
}
|
||||
::v-deep.uni-easyinput {
|
||||
.uni-easyinput__content {
|
||||
background-color: $J-bg-f5 !important;
|
||||
border-radius: $J-b-r12;
|
||||
|
||||
::v-deep uni-button {
|
||||
font-size: 28rpx;
|
||||
color: $my-main-color;
|
||||
background: rgba(255, 255, 255, 1);
|
||||
}
|
||||
.uni-easyinput__content-input {
|
||||
padding-left: 0 !important;
|
||||
|
||||
::v-deep.uni-easyinput {
|
||||
.uni-easyinput__content {
|
||||
background-color: $J-bg-f5 !important;
|
||||
border-radius: $J-b-r12;
|
||||
|
||||
.uni-easyinput__content-input {
|
||||
padding-left: 0 !important;
|
||||
|
||||
.uni-input-input {
|
||||
border-radius: $J-b-r12 !important;
|
||||
overflow: hidden !important;
|
||||
}
|
||||
.uni-input-input {
|
||||
border-radius: $J-b-r12 !important;
|
||||
overflow: hidden !important;
|
||||
}
|
||||
}
|
||||
|
||||
.uni-input-placeholder {
|
||||
font-size: 27rpx;
|
||||
}
|
||||
.uni-input-placeholder {
|
||||
font-size: 27rpx;
|
||||
}
|
||||
|
||||
.uni-icons {
|
||||
color: rgba(230, 230, 230, 1) !important;
|
||||
}
|
||||
.uni-icons {
|
||||
color: rgba(230, 230, 230, 1) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.input-icon {
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
}
|
||||
.input-icon {
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.search-button {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
background-color: transparent !important;
|
||||
color: transparent !important;
|
||||
}
|
||||
.search-button {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
background-color: transparent !important;
|
||||
color: transparent !important;
|
||||
}
|
||||
|
||||
.states1 {
|
||||
margin-top: 24rpx;
|
||||
.states1 {
|
||||
margin-top: 24rpx;
|
||||
|
||||
.item {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
.item {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
|
||||
.text {
|
||||
position: relative;
|
||||
padding-top: 14rpx;
|
||||
padding-bottom: 16rpx;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
display: block;
|
||||
position: absolute;
|
||||
transition: all 0.2s ease-in-out;
|
||||
left: 10rpx;
|
||||
right: 10rpx;
|
||||
bottom: 0;
|
||||
height: 4rpx;
|
||||
background: transparent;
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
}
|
||||
}
|
||||
|
||||
&.active {
|
||||
color: $my-main-color;
|
||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||
|
||||
.text {
|
||||
position: relative;
|
||||
padding-top: 14rpx;
|
||||
padding-bottom: 16rpx;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
display: block;
|
||||
position: absolute;
|
||||
transition: all .2s ease-in-out;
|
||||
left: 10rpx;
|
||||
right: 10rpx;
|
||||
bottom: 0;
|
||||
height: 4rpx;
|
||||
background: transparent;
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
background-color: $my-main-color;
|
||||
}
|
||||
}
|
||||
|
||||
&.active {
|
||||
color: $my-main-color;
|
||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||
|
||||
.text {
|
||||
&::after {
|
||||
background-color: $my-main-color;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.fixed-b {
|
||||
position: fixed;
|
||||
bottom: calc(env(safe-area-inset-bottom) + 16rpx);
|
||||
/* #ifdef H5 */
|
||||
bottom: 50rpx;
|
||||
/* #endif */
|
||||
left: 110rpx;
|
||||
right: 110rpx;
|
||||
}
|
||||
</style>
|
||||
.fixed-b {
|
||||
position: fixed;
|
||||
bottom: calc(env(safe-area-inset-bottom) + 16rpx);
|
||||
/* #ifdef H5 */
|
||||
bottom: 50rpx;
|
||||
/* #endif */
|
||||
left: 110rpx;
|
||||
right: 110rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<view class=" goods">
|
||||
<view class="goods">
|
||||
<view class="u-flex u-font-24 u-col-center u-row-between u-p-b-16 border-bottom">
|
||||
<view class="u-flex u-col-center">
|
||||
<view class="u-font-24">
|
||||
<text>排序</text>
|
||||
<text class="u-m-l-12">{{data.sort}}</text>
|
||||
<text class="u-m-l-12">{{ data.sort }}</text>
|
||||
</view>
|
||||
<view class="u-flex u-m-l-16 " @click="editSort">
|
||||
<view class="u-flex u-m-l-16" @click="editSort">
|
||||
<image src="/pageGoodsGroup/static/image/icon-edit.svg" class="icon-edit" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
@@ -15,20 +15,23 @@
|
||||
<up-switch :activeValue="1" :inactiveValue="0" v-model="data.status" @change="isShowChange" :size="18"></up-switch>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-24 u-p-l-54 ">
|
||||
<view class="u-m-t-24">
|
||||
<view class="u-flex-1 u-flex u-col-top">
|
||||
<view class="color-666 no-wrap">分组名</view>
|
||||
<view class="color-333 u-m-l-60">{{data.name}}</view>
|
||||
<view class="u-flex u-m-l-16 " @click="editName">
|
||||
<view class="color-333 u-m-l-60">{{ data.name }}</view>
|
||||
<view class="u-flex u-m-l-16" @click="editName">
|
||||
<image src="/pageGoodsGroup/static/image/icon-edit.svg" class="icon-edit" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-24">
|
||||
<view class="color-666">售卖时间</view>
|
||||
<view class="color-main u-m-l-32" v-if="data.saleStartTime&&data.saleEndTime">
|
||||
<text>{{data.saleStartTime}}</text>
|
||||
<text>-</text>
|
||||
<text>{{data.saleEndTime}}</text>
|
||||
<view class="color-main u-m-l-32" v-if="data.saleStartTime && data.saleEndTime">
|
||||
<text>{{ data.saleStartTime }}</text>
|
||||
<text> - </text>
|
||||
<text>{{ data.saleEndTime }}</text>
|
||||
</view>
|
||||
<view class="color-main u-m-l-32" v-else>
|
||||
<text>00:00:00 - 23:59:59</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -37,176 +40,169 @@
|
||||
<view class="btn-default btn" @click="del">删除</view>
|
||||
<view class="btn-primary btn u-m-l-38" @click="toEdit">编辑</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, ref, watchEffect } from 'vue';
|
||||
import mySwitch from '@/components/my-components/my-switch.vue'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import { computed, ref, watchEffect } from 'vue';
|
||||
import mySwitch from '@/components/my-components/my-switch.vue';
|
||||
import go from '@/commons/utils/go.js';
|
||||
|
||||
const emits = defineEmits(['changeClick', 'edit', 'editName', 'editSort', 'del', 'isShowChange']);
|
||||
|
||||
const emits = defineEmits(['changeClick','edit', 'editName','editSort', 'del', 'isShowChange'])
|
||||
|
||||
const props = defineProps({
|
||||
index: {
|
||||
type: Number
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
status:true
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
function isShowChange() {
|
||||
emits('isShowChange', {
|
||||
...props.data,
|
||||
})
|
||||
const props = defineProps({
|
||||
index: {
|
||||
type: Number
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
status: true
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let isSellNone = ref(true)
|
||||
isSellNone.value = props.isSellNone
|
||||
function isShowChange() {
|
||||
emits('isShowChange', {
|
||||
...props.data
|
||||
});
|
||||
}
|
||||
|
||||
function isSellNoneChange() {
|
||||
console.log(isSellNone.value);
|
||||
console.log('isSellNoneChange');
|
||||
}
|
||||
let isSellNone = ref(true);
|
||||
isSellNone.value = props.isSellNone;
|
||||
|
||||
let checked = ref(false)
|
||||
function isSellNoneChange() {
|
||||
console.log(isSellNone.value);
|
||||
console.log('isSellNoneChange');
|
||||
}
|
||||
|
||||
let checked = ref(false);
|
||||
|
||||
function changeClick() {
|
||||
emits('changeClick', props.index)
|
||||
}
|
||||
function changeClick() {
|
||||
emits('changeClick', props.index);
|
||||
}
|
||||
|
||||
|
||||
function del() {
|
||||
emits('del', props.index)
|
||||
}
|
||||
function editName() {
|
||||
emits('editName', props.index)
|
||||
}
|
||||
//携带参数type edit跳转到商品添加页面,编辑与添加同一页面,根据type值来判断
|
||||
function editSort() {
|
||||
emits('editSort', props.index)
|
||||
}
|
||||
function toEdit() {
|
||||
emits('edit', props.index)
|
||||
}
|
||||
function del() {
|
||||
emits('del', props.index);
|
||||
}
|
||||
function editName() {
|
||||
emits('editName', props.index);
|
||||
}
|
||||
//携带参数type edit跳转到商品添加页面,编辑与添加同一页面,根据type值来判断
|
||||
function editSort() {
|
||||
emits('editSort', props.index);
|
||||
}
|
||||
function toEdit() {
|
||||
emits('edit', props.index);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
$imgSize: 126rpx;
|
||||
$price-color: #F02C45;
|
||||
$imgSize: 126rpx;
|
||||
$price-color: #f02c45;
|
||||
|
||||
.btn {
|
||||
padding: 6rpx 28rpx;
|
||||
border-radius: 100rpx;
|
||||
font-size: 24rpx;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
.btn {
|
||||
padding: 6rpx 28rpx;
|
||||
border-radius: 100rpx;
|
||||
font-size: 24rpx;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
border-color: $my-main-color;
|
||||
color: $my-main-color;
|
||||
}
|
||||
.btn-primary {
|
||||
border-color: $my-main-color;
|
||||
color: $my-main-color;
|
||||
}
|
||||
|
||||
.btn-default {
|
||||
border-color: #999;
|
||||
color: #999;
|
||||
}
|
||||
.btn-default {
|
||||
border-color: #999;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.price {
|
||||
color: $price-color;
|
||||
}
|
||||
.price {
|
||||
color: $price-color;
|
||||
}
|
||||
|
||||
.h-100 {
|
||||
height: $imgSize;
|
||||
}
|
||||
.h-100 {
|
||||
height: $imgSize;
|
||||
}
|
||||
|
||||
.img {
|
||||
width: $imgSize;
|
||||
height: $imgSize;
|
||||
}
|
||||
.img {
|
||||
width: $imgSize;
|
||||
height: $imgSize;
|
||||
}
|
||||
|
||||
.icon-arrow-right {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
.icon-arrow-right {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
|
||||
.stock {
|
||||
padding-right: 46rpx;
|
||||
position: relative;
|
||||
}
|
||||
.stock {
|
||||
padding-right: 46rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.icon-edit {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
}
|
||||
.icon-edit {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
}
|
||||
|
||||
.stock::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: 10rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
display: block;
|
||||
width: 16rpx;
|
||||
border: 2rpx solid #333333;
|
||||
}
|
||||
.stock::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: 10rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
display: block;
|
||||
width: 16rpx;
|
||||
border: 2rpx solid #333333;
|
||||
}
|
||||
|
||||
.goods {
|
||||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||||
background-color: #fff;
|
||||
padding: 32rpx 28rpx 32rpx 28rpx;
|
||||
font-size: 28rpx;
|
||||
.goods {
|
||||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||||
background-color: #fff;
|
||||
padding: 32rpx 28rpx 32rpx 28rpx;
|
||||
font-size: 28rpx;
|
||||
|
||||
.skus {
|
||||
background: #F9F9F9;
|
||||
border-radius: 14rpx 14rpx 14rpx 14rpx;
|
||||
padding: 28rpx 42rpx;
|
||||
.skus {
|
||||
background: #f9f9f9;
|
||||
border-radius: 14rpx 14rpx 14rpx 14rpx;
|
||||
padding: 28rpx 42rpx;
|
||||
|
||||
.sku {
|
||||
color: #000;
|
||||
font-weight: 700;
|
||||
padding: 6rpx 40rpx;
|
||||
.sku {
|
||||
color: #000;
|
||||
font-weight: 700;
|
||||
padding: 6rpx 40rpx;
|
||||
}
|
||||
|
||||
.skds {
|
||||
gap: 10rpx 50rpx;
|
||||
}
|
||||
|
||||
.skd {
|
||||
padding: 14rpx 40rpx;
|
||||
background: #f0f2f5;
|
||||
border-radius: 4rpx;
|
||||
position: relative;
|
||||
color: #666;
|
||||
overflow: hidden;
|
||||
|
||||
.tag {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
font-size: 12rpx;
|
||||
right: 0;
|
||||
padding: 2rpx 4rpx;
|
||||
border-radius: 0rpx 4rpx 4rpx 4rpx;
|
||||
}
|
||||
|
||||
.skds {
|
||||
gap: 10rpx 50rpx;
|
||||
.tag-primary {
|
||||
background-color: $my-main-color;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.skd {
|
||||
padding: 14rpx 40rpx;
|
||||
background: #F0F2F5;
|
||||
border-radius: 4rpx;
|
||||
position: relative;
|
||||
color: #666;
|
||||
overflow: hidden;
|
||||
|
||||
.tag {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
font-size: 12rpx;
|
||||
right: 0;
|
||||
padding: 2rpx 4rpx;
|
||||
border-radius: 0rpx 4rpx 4rpx 4rpx;
|
||||
}
|
||||
|
||||
.tag-primary {
|
||||
background-color: $my-main-color;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
<template>
|
||||
<view class="safe-page min-page">
|
||||
<view class="goods-list u-p-30">
|
||||
<view class="u-m-b-32" v-for="(item,index) in pageData.list" :key="index">
|
||||
<my-category
|
||||
@del="groupDel"
|
||||
@editName="popupShow($event,'name',true)"
|
||||
@editSort="popupShow($event,'sort',true)"
|
||||
@edit="actionsShow"
|
||||
@isShowChange="isSHowChange" :index="index" :data="item"
|
||||
:showDetail="pageData.showGoodsDetail"></my-category>
|
||||
<view class="u-m-b-32" v-for="(item, index) in pageData.list" :key="index">
|
||||
<my-category
|
||||
@del="groupDel"
|
||||
@editName="popupShow($event, 'name', true)"
|
||||
@editSort="popupShow($event, 'sort', true)"
|
||||
@edit="actionsShow"
|
||||
@isShowChange="isSHowChange"
|
||||
:index="index"
|
||||
:data="item"
|
||||
:showDetail="pageData.showGoodsDetail"
|
||||
></my-category>
|
||||
</view>
|
||||
<view class="u-m-t-44" v-if="pageData.list.length>0">
|
||||
<my-pagination :page="pageData.query.page" :size="pageData.query.size" :totalElements="pageData.totalElements"
|
||||
@change="pageChange"></my-pagination>
|
||||
<view style="height: 200rpx;"></view>
|
||||
<view class="u-m-t-44" v-if="pageData.list.length > 0">
|
||||
<my-pagination :page="pageData.query.page" :size="pageData.query.size" :totalElements="pageData.totalElements" @change="pageChange"></my-pagination>
|
||||
<view style="height: 200rpx"></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="fixed-b">
|
||||
<my-button :height="80" shape="circle" font-weight="700" @tap="toAddGroup">新建分组</my-button>
|
||||
</view>
|
||||
@@ -27,40 +28,41 @@
|
||||
<edit-name @save="updataGroup" :item="popup.selData" v-model:show="popup.name.show"></edit-name>
|
||||
<edit-time @save="updataGroup" :item="popup.selData" v-model:show="popup.time.show"></edit-time>
|
||||
|
||||
<up-action-sheet :round="10" @select="actionSelect" @close="actionsHide" cancelText="取消" :actions="actions.list"
|
||||
:show="actions.show"></up-action-sheet>
|
||||
<up-action-sheet :round="10" @select="actionSelect" @close="actionsHide" cancelText="取消" :actions="actions.list" :show="actions.show"></up-action-sheet>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref } from 'vue';
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import myCategory from './components/category.vue'
|
||||
import editSort from './components/edit-sort.vue';
|
||||
import editName from './components/edit-name.vue';
|
||||
import editTime from './components/edit-time.vue';
|
||||
import { getProdGroupPage, addProdGroup, updateProdGroup, delProdGroup,editProdGroup } from '@/http/api/product.js'
|
||||
|
||||
const pageData = reactive({
|
||||
showGoodsDetail: false,
|
||||
query: {
|
||||
page: 1,
|
||||
size: 10,
|
||||
},
|
||||
totalElements: 0,
|
||||
list: [],
|
||||
selCategory: ''
|
||||
})
|
||||
|
||||
/**
|
||||
* 编辑列表
|
||||
*/
|
||||
const actions = reactive({
|
||||
list: [{
|
||||
import { reactive, ref } from 'vue';
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
import go from '@/commons/utils/go.js';
|
||||
import myCategory from './components/category.vue';
|
||||
import editSort from './components/edit-sort.vue';
|
||||
import editName from './components/edit-name.vue';
|
||||
import editTime from './components/edit-time.vue';
|
||||
import { getProdGroupPage, addProdGroup, updateProdGroup, delProdGroup, editProdGroup } from '@/http/api/product.js';
|
||||
|
||||
const pageData = reactive({
|
||||
showGoodsDetail: false,
|
||||
query: {
|
||||
page: 1,
|
||||
size: 10
|
||||
},
|
||||
totalElements: 0,
|
||||
list: [],
|
||||
selCategory: ''
|
||||
});
|
||||
|
||||
/**
|
||||
* 编辑列表
|
||||
*/
|
||||
const actions = reactive({
|
||||
list: [
|
||||
{
|
||||
name: '排序',
|
||||
color: '#333',
|
||||
fontSize: '16'
|
||||
}, {
|
||||
},
|
||||
{
|
||||
name: '管理商品',
|
||||
color: '#333',
|
||||
fontSize: '16'
|
||||
@@ -70,311 +72,310 @@
|
||||
color: '#333',
|
||||
fontSize: '16'
|
||||
}
|
||||
],
|
||||
show: false,
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
*/
|
||||
const popup = reactive({
|
||||
selIndex: -1,
|
||||
selData: {
|
||||
sort: ''
|
||||
},
|
||||
sort: {
|
||||
show: false
|
||||
},
|
||||
name:{
|
||||
show: false
|
||||
},
|
||||
time:{
|
||||
show: false
|
||||
}
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
getList()
|
||||
})
|
||||
|
||||
/**
|
||||
* 获取分组数据
|
||||
*/
|
||||
async function getList() {
|
||||
const res = await getProdGroupPage(pageData.query)
|
||||
pageData.list = res.records
|
||||
pageData.totalElements = res.totalRow
|
||||
if(res.records.length <= 0&&res.totalPage>1) {
|
||||
pageData.query.page = res.totalPage
|
||||
getList()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑列表显示
|
||||
* @param {Object} e
|
||||
*/
|
||||
function actionsShow(e) {
|
||||
popup.selData = pageData.list[e]
|
||||
popup.selIndex = e
|
||||
actions.show = true
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑列表隐藏
|
||||
*/
|
||||
function actionsHide() {
|
||||
actions.show = false
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑列表选择
|
||||
* @param {Object} e
|
||||
*/
|
||||
function actionSelect(e) {
|
||||
if (e.name == '排序') {
|
||||
return popupShow(popup.selIndex, 'sort', true)
|
||||
}
|
||||
if (e.name == '管理商品') {
|
||||
const {id,status,name,sort}=popup.selData
|
||||
return go.to('PAGES_GOODS_GROUP_EDIT_GOODS', {
|
||||
id,status,name,sort
|
||||
})
|
||||
}
|
||||
if (e.name == '售卖时间') {
|
||||
return popupShow(popup.selIndex, 'time', true)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑打开
|
||||
* @param {Object} e
|
||||
* @param {Object} key
|
||||
* @param {Object} show
|
||||
*/
|
||||
function popupShow(e, key, show) {
|
||||
popup[key].show = show
|
||||
popup.selIndex = e
|
||||
popup.selData = pageData.list[e]
|
||||
}
|
||||
],
|
||||
show: false
|
||||
});
|
||||
|
||||
/**
|
||||
* 编辑确认
|
||||
* @param {Object} e
|
||||
*/
|
||||
async function updataGroup(e) {
|
||||
console.log(e)
|
||||
const res = await editProdGroup(e)
|
||||
popup.sort.show = false;
|
||||
popup.name.show = false;
|
||||
popup.time.show = false;
|
||||
pageData.list[popup.selIndex] = e
|
||||
uni.$utils.showToast('更新成功')
|
||||
getList()
|
||||
/**
|
||||
* 编辑数据
|
||||
*/
|
||||
const popup = reactive({
|
||||
selIndex: -1,
|
||||
selData: {
|
||||
sort: ''
|
||||
},
|
||||
sort: {
|
||||
show: false
|
||||
},
|
||||
name: {
|
||||
show: false
|
||||
},
|
||||
time: {
|
||||
show: false
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态修改
|
||||
* @param {Object} data
|
||||
*/
|
||||
async function isSHowChange(data) {
|
||||
const res = await editProdGroup({
|
||||
...data
|
||||
})
|
||||
uni.$utils.showToast('更新成功')
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
const goodsSortModel = ref(null)
|
||||
const goodsTypeModel = ref(null)
|
||||
let sort = ref(0)
|
||||
const goodsTypeModelData = reactive({
|
||||
selCategory: '',
|
||||
title: '',
|
||||
index: null,
|
||||
useTypes: [{
|
||||
name: '堂食',
|
||||
isOpen: true
|
||||
},
|
||||
{
|
||||
name: '自取',
|
||||
isOpen: true
|
||||
},
|
||||
{
|
||||
name: '外卖',
|
||||
isOpen: true
|
||||
},
|
||||
{
|
||||
name: '快递',
|
||||
isOpen: true
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
/**
|
||||
* 新增分组
|
||||
*/
|
||||
function toAddGroup() {
|
||||
go.to('PAGES_GOODS_GROUP_EDIT', {
|
||||
type: 'add'
|
||||
})
|
||||
}
|
||||
onShow(() => {
|
||||
getList();
|
||||
});
|
||||
|
||||
/**
|
||||
* 删除分组
|
||||
* @param {Object} index
|
||||
*/
|
||||
function groupDel(index) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '请确保此分组下没有任何商品确认删除?',
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
delProdGroup(pageData.list[index].id).then(res => {
|
||||
uni.$utils.showToast('删除成功')
|
||||
setTimeout(()=>{
|
||||
getList()
|
||||
},1500)
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
/**
|
||||
* 获取分组数据
|
||||
*/
|
||||
async function getList() {
|
||||
const res = await getProdGroupPage(pageData.query);
|
||||
pageData.list = res.records;
|
||||
pageData.totalElements = res.totalRow;
|
||||
if (res.records.length <= 0 && res.totalPage > 1) {
|
||||
pageData.query.page = res.totalPage;
|
||||
getList();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑列表显示
|
||||
* @param {Object} e
|
||||
*/
|
||||
function actionsShow(e) {
|
||||
popup.selData = pageData.list[e];
|
||||
popup.selIndex = e;
|
||||
actions.show = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑列表隐藏
|
||||
*/
|
||||
function actionsHide() {
|
||||
actions.show = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑列表选择
|
||||
* @param {Object} e
|
||||
*/
|
||||
function actionSelect(e) {
|
||||
if (e.name == '排序') {
|
||||
return popupShow(popup.selIndex, 'sort', true);
|
||||
}
|
||||
if (e.name == '管理商品') {
|
||||
const { id, status, name, sort } = popup.selData;
|
||||
return go.to('PAGES_GOODS_GROUP_EDIT_GOODS', {
|
||||
id,
|
||||
status,
|
||||
name,
|
||||
sort
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 页数改变事件
|
||||
function pageChange(page) {
|
||||
pageData.query.page = page
|
||||
getList()
|
||||
if (e.name == '售卖时间') {
|
||||
return popupShow(popup.selIndex, 'time', true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑打开
|
||||
* @param {Object} e
|
||||
* @param {Object} key
|
||||
* @param {Object} show
|
||||
*/
|
||||
function popupShow(e, key, show) {
|
||||
popup[key].show = show;
|
||||
popup.selIndex = e;
|
||||
popup.selData = pageData.list[e];
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑确认
|
||||
* @param {Object} e
|
||||
*/
|
||||
async function updataGroup(e) {
|
||||
console.log(e);
|
||||
const res = await editProdGroup(e);
|
||||
popup.sort.show = false;
|
||||
popup.name.show = false;
|
||||
popup.time.show = false;
|
||||
pageData.list[popup.selIndex] = e;
|
||||
uni.$utils.showToast('更新成功');
|
||||
getList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态修改
|
||||
* @param {Object} data
|
||||
*/
|
||||
async function isSHowChange(data) {
|
||||
const res = await editProdGroup({
|
||||
...data
|
||||
});
|
||||
uni.$utils.showToast('更新成功');
|
||||
}
|
||||
|
||||
const goodsSortModel = ref(null);
|
||||
const goodsTypeModel = ref(null);
|
||||
let sort = ref(0);
|
||||
const goodsTypeModelData = reactive({
|
||||
selCategory: '',
|
||||
title: '',
|
||||
index: null,
|
||||
useTypes: [
|
||||
{
|
||||
name: '堂食',
|
||||
isOpen: true
|
||||
},
|
||||
{
|
||||
name: '自取',
|
||||
isOpen: true
|
||||
},
|
||||
{
|
||||
name: '外卖',
|
||||
isOpen: true
|
||||
},
|
||||
{
|
||||
name: '快递',
|
||||
isOpen: true
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
/**
|
||||
* 新增分组
|
||||
*/
|
||||
function toAddGroup() {
|
||||
go.to('PAGES_GOODS_GROUP_EDIT', {
|
||||
type: 'add'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除分组
|
||||
* @param {Object} index
|
||||
*/
|
||||
function groupDel(index) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '请确保此分组下没有任何商品确认删除?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
delProdGroup(pageData.list[index].id).then((res) => {
|
||||
uni.$utils.showToast('删除成功');
|
||||
setTimeout(() => {
|
||||
getList();
|
||||
}, 1500);
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
});
|
||||
}
|
||||
|
||||
// 页数改变事件
|
||||
function pageChange(page) {
|
||||
pageData.query.page = page;
|
||||
getList();
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
page {
|
||||
background: #F9F9F9;
|
||||
}
|
||||
page {
|
||||
background: #f1f1f1;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
.stock-btns {
|
||||
padding: 0 100rpx;
|
||||
.stock-btns {
|
||||
padding: 0 100rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.safe-page {
|
||||
background: #f1f1f1;
|
||||
}
|
||||
|
||||
.icon-guige {
|
||||
width: 42rpx;
|
||||
height: 42rpx;
|
||||
}
|
||||
|
||||
.bg-fff {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.myTabs {
|
||||
margin: 0 auto;
|
||||
width: 434rpx;
|
||||
height: 64rpx;
|
||||
}
|
||||
|
||||
.input-wrapper {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-top: 26rpx;
|
||||
background-color: $J-bg-ff;
|
||||
|
||||
.input-main {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.safe-page {
|
||||
background: #F9F9F9;
|
||||
}
|
||||
|
||||
.icon-guige {
|
||||
width: 42rpx;
|
||||
height: 42rpx;
|
||||
}
|
||||
|
||||
.bg-fff {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.myTabs {
|
||||
margin: 0 auto;
|
||||
width: 434rpx;
|
||||
height: 64rpx;
|
||||
}
|
||||
|
||||
.input-wrapper {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-top: 26rpx;
|
||||
background-color: $J-bg-ff;
|
||||
height: 64rpx;
|
||||
|
||||
.input-main {
|
||||
image {
|
||||
padding: 22rpx;
|
||||
width: 26rpx;
|
||||
height: 26rpx;
|
||||
}
|
||||
|
||||
input {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 64rpx;
|
||||
font-size: 27rpx;
|
||||
}
|
||||
|
||||
image {
|
||||
padding: 22rpx;
|
||||
width: 26rpx;
|
||||
height: 26rpx;
|
||||
}
|
||||
::v-deep uni-button {
|
||||
font-size: 28rpx;
|
||||
color: $my-main-color;
|
||||
background: rgba(255, 255, 255, 1);
|
||||
}
|
||||
|
||||
input {
|
||||
flex: 1;
|
||||
font-size: 27rpx;
|
||||
}
|
||||
::v-deep.uni-easyinput {
|
||||
.uni-easyinput__content {
|
||||
background-color: $J-bg-f5 !important;
|
||||
border-radius: $J-b-r12;
|
||||
|
||||
::v-deep uni-button {
|
||||
font-size: 28rpx;
|
||||
color: $my-main-color;
|
||||
background: rgba(255, 255, 255, 1);
|
||||
}
|
||||
.uni-easyinput__content-input {
|
||||
padding-left: 0 !important;
|
||||
|
||||
::v-deep.uni-easyinput {
|
||||
.uni-easyinput__content {
|
||||
background-color: $J-bg-f5 !important;
|
||||
border-radius: $J-b-r12;
|
||||
|
||||
.uni-easyinput__content-input {
|
||||
padding-left: 0 !important;
|
||||
|
||||
.uni-input-input {
|
||||
border-radius: $J-b-r12 !important;
|
||||
overflow: hidden !important;
|
||||
}
|
||||
.uni-input-input {
|
||||
border-radius: $J-b-r12 !important;
|
||||
overflow: hidden !important;
|
||||
}
|
||||
}
|
||||
|
||||
.uni-input-placeholder {
|
||||
font-size: 27rpx;
|
||||
}
|
||||
.uni-input-placeholder {
|
||||
font-size: 27rpx;
|
||||
}
|
||||
|
||||
.uni-icons {
|
||||
color: rgba(230, 230, 230, 1) !important;
|
||||
}
|
||||
.uni-icons {
|
||||
color: rgba(230, 230, 230, 1) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.input-icon {
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
.input-icon {
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.search-button {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
background-color: transparent !important;
|
||||
color: transparent !important;
|
||||
}
|
||||
|
||||
.states1 {
|
||||
margin-top: 78rpx;
|
||||
|
||||
.item {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
margin-right: 70rpx;
|
||||
background: #f4f4f4;
|
||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||
}
|
||||
|
||||
.search-button {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
background-color: transparent !important;
|
||||
color: transparent !important;
|
||||
.item.active {
|
||||
background: #e6f0ff;
|
||||
color: $my-main-color;
|
||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.states1 {
|
||||
margin-top: 78rpx;
|
||||
|
||||
.item {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
margin-right: 70rpx;
|
||||
background: #F4F4F4;
|
||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||
}
|
||||
|
||||
.item.active {
|
||||
background: #E6F0FF;
|
||||
color: $my-main-color;
|
||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.fixed-b {
|
||||
position: fixed;
|
||||
left: 110rpx;
|
||||
right: 110rpx;
|
||||
bottom: 110rpx;
|
||||
}
|
||||
</style>
|
||||
.fixed-b {
|
||||
position: fixed;
|
||||
left: 110rpx;
|
||||
right: 110rpx;
|
||||
bottom: 110rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
"style": {
|
||||
"navigationBarTitleText": "首页(自定义导航)",
|
||||
"navigationStyle": "custom",
|
||||
"enablePullDownRefresh": true
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarTextStyle": "white"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -219,7 +220,7 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"root": "pageWorkControl",
|
||||
"pages": [{
|
||||
@@ -265,7 +266,7 @@
|
||||
}
|
||||
}]
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"root": "pageRecharge",
|
||||
"pages": [{
|
||||
|
||||
@@ -1,82 +1,79 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
<view class="mask" @tap="hideGoods" v-if="switchGoods"></view>
|
||||
<view class="car border-top u-flex u-row-between u-col-bottom u-relative">
|
||||
<view class="u-absolute goods bg-fff">
|
||||
<view
|
||||
class="u-p-t-32 color-666 border-bottom bg-fff u-absolute total u-p-r-28 u-p-b-32 u-p-l-28 u-flex u-row-between">
|
||||
<view>已添加{{goodsNumber.toFixed(0)}}件商品</view>
|
||||
<view class="u-p-t-32 color-666 border-bottom bg-fff u-absolute total u-p-r-28 u-p-b-32 u-p-l-28 u-flex u-row-between">
|
||||
<view>已添加{{ goodsNumber.toFixed(0) }}件商品</view>
|
||||
<view class="color-666">
|
||||
<uni-icons color="#666" type="trash"></uni-icons>
|
||||
<text class="u-m-l-10" @tap="setModalShow('clear',true,'cart','是否清空全部已添加的商品')">清空购物车</text>
|
||||
<text class="u-m-l-10" @tap="setModalShow('clear', true, 'cart', '是否清空全部已添加的商品')">清空购物车</text>
|
||||
</view>
|
||||
</view>
|
||||
<scroll-view scroll-y="true" class="tranistion" :style="{height:switchGoods?'50vh':0 }">
|
||||
<scroll-view scroll-y="true" class="tranistion" :style="{ height: switchGoods ? '50vh' : 0 }">
|
||||
<!-- 占位 -->
|
||||
<view class="u-p-t-32 color-666 border-bottom u-p-r-28 u-p-b-32 u-p-l-28 u-flex u-row-between"
|
||||
style="opacity: 0;">
|
||||
<view>已添加{{goodsNumber.toFixed(0)}}件商品</view>
|
||||
<view class="u-p-t-32 color-666 border-bottom u-p-r-28 u-p-b-32 u-p-l-28 u-flex u-row-between" style="opacity: 0">
|
||||
<view>已添加{{ goodsNumber.toFixed(0) }}件商品</view>
|
||||
<view class="color-666">
|
||||
<uni-icons color="#666" type="trash"></uni-icons>
|
||||
<text class="u-m-l-10">清空</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 占位 -->
|
||||
<view class="color-333 item border-top u-flex u-row-center u-row-between"
|
||||
v-for="(item,index) in data" :key="index">
|
||||
<view class="color-333 item border-top u-flex u-row-center u-row-between" v-for="(item, index) in data" :key="index">
|
||||
<view>
|
||||
<view class="up-line-1" >{{item.name}}</view>
|
||||
<view class="u-m-t-10 u-font-24 color-666 up-line-1">{{item.specInfo||''}}</view>
|
||||
<view class="up-line-1">{{ item.name }}</view>
|
||||
<view class="u-m-t-10 u-font-24 color-666 up-line-1">{{ item.specInfo || '' }}</view>
|
||||
</view>
|
||||
<view class="u-flex" style="flex-shrink: 0;">
|
||||
<view class="font-bold red u-m-r-32">¥{{formatPrice(item.lowPrice*item.number) }}</view>
|
||||
<view class="u-flex" @tap="updateNumber(false,index,item)">
|
||||
<view class="u-flex" style="flex-shrink: 0">
|
||||
<view class="font-bold red u-m-r-32">¥{{ formatPrice(item.lowPrice * item.number) }}</view>
|
||||
<view class="u-flex" @tap="updateNumber(false, index, item)">
|
||||
<image src="/pagesCreateOrder/static/images/icon-reduce-black.svg" class="icon" mode="" />
|
||||
</view>
|
||||
<view class="u-m-l-30 u-m-r-30 color-333">
|
||||
{{item.number.toFixed(2)}}
|
||||
{{ item.number.toFixed(2) }}
|
||||
</view>
|
||||
<view class="u-flex" @tap="updateNumber(true,index,item)" >
|
||||
<image src="/pagesCreateOrder/static/images/icon-add-black.svg" class="icon " :class="{'grayscale': item.type == 'package'&&item.groupType == 1}" mode="" />
|
||||
<view class="u-flex" @tap="updateNumber(true, index, item)">
|
||||
<image
|
||||
src="/pagesCreateOrder/static/images/icon-add-black.svg"
|
||||
class="icon"
|
||||
:class="{ grayscale: item.type == 'package' && item.groupType == 1 }"
|
||||
mode=""
|
||||
/>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view style="margin: 50rpx auto 110rpx auto;" v-if="!data.length">
|
||||
<view style="margin: 50rpx auto 110rpx auto" v-if="!data.length">
|
||||
<my-empty text="暂未有添加商品"></my-empty>
|
||||
</view>
|
||||
|
||||
<!-- 历史订单 -->
|
||||
|
||||
<view v-if="historyOrder.length > 0"
|
||||
class="u-p-t-32 u-p-b-32 u-p-r-28 u-p-l-28 u-m-t-40 bg-fff u-flex u-row-between">
|
||||
<view class="color-333" style="font-weight: bold;">历史订单</view>
|
||||
<view v-if="historyOrder.length > 0" class="u-p-t-32 u-p-b-32 u-p-r-28 u-p-l-28 u-m-t-40 bg-fff u-flex u-row-between">
|
||||
<view class="color-333" style="font-weight: bold">历史订单</view>
|
||||
<view class="color-666">
|
||||
<uni-icons color="#666" type="trash"></uni-icons>
|
||||
<text class="u-m-l-10" @tap="setModalShow('clear',true,'allHistoryOrder','清空历史订单')">清空历史订单</text>
|
||||
<text class="u-m-l-10" @tap="setModalShow('clear', true, 'allHistoryOrder', '清空历史订单')">清空历史订单</text>
|
||||
</view>
|
||||
</view>
|
||||
<view v-for="(item,index) in historyOrder" :key="index">
|
||||
<view v-if="historyOrder.length > 0"
|
||||
class="u-p-t-32 border-top bg-fff u-p-r-28 u-p-b-32 u-p-l-28 u-flex u-row-between">
|
||||
<view class="color-333" style="font-size: 30rpx;">第{{item.placeNum}}次下单</view>
|
||||
<view v-for="(item, index) in historyOrder" :key="index">
|
||||
<view v-if="historyOrder.length > 0" class="u-p-t-32 border-top bg-fff u-p-r-28 u-p-b-32 u-p-l-28 u-flex u-row-between">
|
||||
<view class="color-333" style="font-size: 30rpx">第{{ item.placeNum }}次下单</view>
|
||||
<view class="color-666">
|
||||
<uni-icons color="#666" type="trash"></uni-icons>
|
||||
<text class="u-m-l-10" @tap="setModalShow('clear',true,item.placeNum,'清空第'+item.placeNum+'次下单历史订单')">清空</text>
|
||||
<text class="u-m-l-10" @tap="setModalShow('clear', true, item.placeNum, '清空第' + item.placeNum + '次下单历史订单')">清空</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="color-333 item border-top u-flex u-row-center u-row-between"
|
||||
v-for="(v,i) in item.info" :key="i">
|
||||
<view style="display: flex;align-items: center;">
|
||||
<view class="up-line-1" style="margin-right: 10rpx;">{{v.productName}}</view>
|
||||
<uni-tag v-if="v.returnNum>0" :text="'退菜X'+v.returnNum"
|
||||
custom-style="background-color: #EB4F4F; border-color: #EB4F4F; color: #fff;">
|
||||
</uni-tag>
|
||||
<view class="color-333 item border-top u-flex u-row-center u-row-between" v-for="(v, i) in item.info" :key="i">
|
||||
<view style="display: flex; align-items: center">
|
||||
<view class="up-line-1" style="margin-right: 10rpx">{{ v.productName }}</view>
|
||||
<uni-tag
|
||||
v-if="v.returnNum > 0"
|
||||
:text="'退菜X' + v.returnNum"
|
||||
custom-style="background-color: #EB4F4F; border-color: #EB4F4F; color: #fff;"
|
||||
></uni-tag>
|
||||
</view>
|
||||
<view class="u-flex" style="flex-shrink: 0;">
|
||||
<view class="font-bold red u-m-r-32">¥{{formatPrice(v.price*(v.num - v.returnNum)) }}</view>
|
||||
<view class="u-m-l-30 u-m-r-30 color-333"> X{{v.num.toFixed(2)}} </view>
|
||||
<view class="u-flex" style="flex-shrink: 0">
|
||||
<view class="font-bold red u-m-r-32">¥{{ formatPrice(v.price * (v.num - v.returnNum)) }}</view>
|
||||
<view class="u-m-l-30 u-m-r-30 color-333">X{{ v.num.toFixed(2) }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -84,299 +81,311 @@
|
||||
</view>
|
||||
<view class="icon-car-box" @tap="toggleGoods">
|
||||
<image src="/pagesCreateOrder/static/images/icon-car.svg" class="icon-car" />
|
||||
<view class="dot" v-if="goodsNumber>0">{{goodsNumber}}</view>
|
||||
<view class="dot" v-if="goodsNumber > 0">{{ goodsNumber }}</view>
|
||||
</view>
|
||||
<view class="price font-bold u-flex">
|
||||
<view>¥</view>
|
||||
<view>{{allPrice}}</view>
|
||||
<view>{{ allPrice }}</view>
|
||||
</view>
|
||||
<my-button shape="circle" height="80" width="220" @tap="toConfimOrder">
|
||||
<text class="u-font-32 font-bold">{{table.type=='add'?'确认加菜':'去下单'}} </text>
|
||||
<text class="u-font-32 font-bold">{{ table.type == 'add' ? '确认加菜' : '去下单' }}</text>
|
||||
</my-button>
|
||||
|
||||
|
||||
</view>
|
||||
<up-modal title="提示" :content="modal.title" :show="modal.clear" showCancelButton closeOnClickOverlay
|
||||
@confirm="confirmModelConfirm" @cancel="setModalShow('clear',false)" @close="setModalShow('clear',false)"
|
||||
width="300px"></up-modal>
|
||||
<up-modal
|
||||
title="提示"
|
||||
:content="modal.title"
|
||||
:show="modal.clear"
|
||||
showCancelButton
|
||||
closeOnClickOverlay
|
||||
@confirm="confirmModelConfirm"
|
||||
@cancel="setModalShow('clear', false)"
|
||||
@close="setModalShow('clear', false)"
|
||||
width="300px"
|
||||
></up-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, reactive, ref, watch } from 'vue';
|
||||
import myButton from '@/components/my-components/my-button.vue'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import infoBox from '@/commons/utils/infoBox.js';
|
||||
import { formatPrice } from '@/commons/utils/format.js';
|
||||
import { computed, reactive, ref, watch } from 'vue';
|
||||
import myButton from '@/components/my-components/my-button.vue';
|
||||
import go from '@/commons/utils/go.js';
|
||||
import infoBox from '@/commons/utils/infoBox.js';
|
||||
import { formatPrice } from '@/commons/utils/format.js';
|
||||
import { $trturnPayAfter } from '../util.js'
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
},
|
||||
historyOrder: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
},
|
||||
isCreateOrderToDetail: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
orderInfo: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
id: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
table: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
tableId: ''
|
||||
}
|
||||
}
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
}
|
||||
})
|
||||
let allHistoryOrder = ref([]);
|
||||
const allPrice = computed(() => {
|
||||
let cartPrice = props.data.reduce((prve, cur) => {
|
||||
let price = Math.floor((cur.lowPrice * cur.number)*100)/100
|
||||
return prve + price
|
||||
}, 0)
|
||||
let historyOrderPrice = allHistoryOrder.value.reduce((prve, cur) => {
|
||||
let price = Math.floor((cur.price * (cur.num-cur.returnNum))*100)/100
|
||||
return prve + price
|
||||
}, 0)
|
||||
|
||||
return (cartPrice + historyOrderPrice).toFixed(2)
|
||||
})
|
||||
|
||||
const goodsNumber = computed(() => {
|
||||
let result = 0
|
||||
let cart = props.data.reduce((prve, cur) => {
|
||||
return prve + cur.number
|
||||
}, 0)
|
||||
|
||||
let historyOrderNum = allHistoryOrder.value.reduce((prve, cur) => {
|
||||
return prve + cur.num
|
||||
}, 0)
|
||||
result = cart + historyOrderNum
|
||||
result = result > 0 ? result.toFixed(2) : 0
|
||||
return result >= 99 ? 99 : parseFloat(result)
|
||||
})
|
||||
watch(() => props.historyOrder, (newval) => {
|
||||
},
|
||||
historyOrder: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
isCreateOrderToDetail: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
orderInfo: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
id: ''
|
||||
};
|
||||
}
|
||||
},
|
||||
table: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
tableId: ''
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
let allHistoryOrder = ref([]);
|
||||
const allPrice = computed(() => {
|
||||
let cartPrice = props.data.reduce((prve, cur) => {
|
||||
let price = Math.floor(cur.lowPrice * cur.number * 100) / 100;
|
||||
return prve + price;
|
||||
}, 0);
|
||||
let historyOrderPrice = allHistoryOrder.value.reduce((prve, cur) => {
|
||||
let price = Math.floor(cur.price * (cur.num - cur.returnNum) * 100) / 100;
|
||||
return prve + price;
|
||||
}, 0);
|
||||
|
||||
return (cartPrice + historyOrderPrice).toFixed(2);
|
||||
});
|
||||
|
||||
const goodsNumber = computed(() => {
|
||||
let result = 0;
|
||||
let cart = props.data.reduce((prve, cur) => {
|
||||
return prve + cur.number;
|
||||
}, 0);
|
||||
|
||||
// let historyOrderNum = allHistoryOrder.value.reduce((prve, cur) => {
|
||||
// return prve + cur.num;
|
||||
// }, 0);
|
||||
result = cart;
|
||||
result = result > 0 ? result.toFixed(2) : 0;
|
||||
return result >= 99 ? 99 : parseFloat(result);
|
||||
});
|
||||
watch(
|
||||
() => props.historyOrder,
|
||||
(newval) => {
|
||||
allHistoryOrder.value = [];
|
||||
newval.forEach(item=>{
|
||||
allHistoryOrder.value = [...allHistoryOrder.value,...item.info]
|
||||
})
|
||||
})
|
||||
const modal = reactive({
|
||||
key: '',
|
||||
title: '',
|
||||
type: '',
|
||||
clear: false
|
||||
})
|
||||
newval.forEach((item) => {
|
||||
allHistoryOrder.value = [...allHistoryOrder.value, ...item.info];
|
||||
});
|
||||
}
|
||||
);
|
||||
const modal = reactive({
|
||||
key: '',
|
||||
title: '',
|
||||
type: '',
|
||||
clear: false
|
||||
});
|
||||
|
||||
function confirmModelConfirm() {
|
||||
if (modal.key == 'clear') {
|
||||
clear()
|
||||
}
|
||||
function confirmModelConfirm() {
|
||||
if (modal.key == 'clear') {
|
||||
clear();
|
||||
}
|
||||
}
|
||||
|
||||
function setModalShow(key = 'show', show = true, type = '', title = '') {
|
||||
// if (key == 'clear' && show && props.data.length <= 0) {
|
||||
// return infoBox.showToast('购物车是空的!')
|
||||
// }
|
||||
if (title) {
|
||||
modal.title = title;
|
||||
}
|
||||
if (type) {
|
||||
modal.type = type;
|
||||
}
|
||||
modal.key = key;
|
||||
modal[key] = show;
|
||||
console.log(modal);
|
||||
}
|
||||
|
||||
const edmits = defineEmits(['clear', 'updateNumber']);
|
||||
|
||||
// mask
|
||||
let switchGoods = ref(false);
|
||||
|
||||
function hideGoods() {
|
||||
switchGoods.value = false;
|
||||
}
|
||||
|
||||
function showGoods() {
|
||||
switchGoods.value = true;
|
||||
}
|
||||
|
||||
function toggleGoods() {
|
||||
switchGoods.value = !switchGoods.value;
|
||||
}
|
||||
|
||||
function toConfimOrder() {
|
||||
if (props.data.length <= 0 && allHistoryOrder.value.length <= 0) {
|
||||
return infoBox.showToast('还没有选择商品');
|
||||
}
|
||||
const { name, status, type } = props.table;
|
||||
if (props.data.length <= 0 && allHistoryOrder.value.length > 0) {
|
||||
go.to('PAGES_ORDER_PAY', {
|
||||
orderId: props.orderInfo.id
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
function setModalShow(key = 'show',show = true, type = '' , title = '') {
|
||||
// if (key == 'clear' && show && props.data.length <= 0) {
|
||||
// return infoBox.showToast('购物车是空的!')
|
||||
// }
|
||||
if( title ){ modal.title = title }
|
||||
if( type ){ modal.type = type }
|
||||
modal.key = key
|
||||
modal[key] = show
|
||||
console.log(modal);
|
||||
}
|
||||
|
||||
const edmits = defineEmits(['clear', 'updateNumber'])
|
||||
|
||||
// mask
|
||||
let switchGoods = ref(false)
|
||||
|
||||
function hideGoods() {
|
||||
switchGoods.value = false
|
||||
}
|
||||
|
||||
function showGoods() {
|
||||
switchGoods.value = true
|
||||
}
|
||||
|
||||
function toggleGoods() {
|
||||
switchGoods.value = !switchGoods.value
|
||||
}
|
||||
|
||||
function toConfimOrder() {
|
||||
if ( props.data.length <= 0 && allHistoryOrder.value.length <= 0 ) {
|
||||
return infoBox.showToast('还没有选择商品')
|
||||
}
|
||||
const { name, status, type } = props.table
|
||||
if ( props.data.length <= 0 && allHistoryOrder.value.length > 0 ) {
|
||||
go.to('PAGES_ORDER_PAY', {
|
||||
orderId: props.orderInfo.id,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
if (props.table.id == '' && props.table.tableCode == '') {
|
||||
go.to('PAGES_CONFIRM_ORDER', {
|
||||
isCreateOrderToDetail: props.isCreateOrderToDetail ? 1 : 0
|
||||
})
|
||||
return
|
||||
}
|
||||
if (props.table.id == '' && props.table.tableCode == '') {
|
||||
go.to('PAGES_CONFIRM_ORDER', {
|
||||
type: type,
|
||||
tableId: props.table.id,
|
||||
tableCode: props.table.tableCode,
|
||||
name:name,
|
||||
status:status,
|
||||
isCreateOrderToDetail: props.isCreateOrderToDetail ? 1 : 0
|
||||
})
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
let shopInfo = uni.getStorageSync('shopInfo');
|
||||
console.log($trturnPayAfter(shopInfo));
|
||||
|
||||
go.to('PAGES_CONFIRM_ORDER', {
|
||||
type: type,
|
||||
tableId: props.table.id,
|
||||
tableCode: props.table.tableCode,
|
||||
name: name,
|
||||
status: status,
|
||||
isCreateOrderToDetail: props.isCreateOrderToDetail ? 1 : 0
|
||||
});
|
||||
}
|
||||
|
||||
function updateNumber(isAdd, index, goods) {
|
||||
const step = isAdd ? 1 : -1
|
||||
const newval = goods.number + step
|
||||
if(goods.type == 'package'&&goods.groupType == 1&&isAdd){
|
||||
return
|
||||
}
|
||||
const par = {
|
||||
num: newval,
|
||||
index: index,
|
||||
goods: goods
|
||||
}
|
||||
edmits('updateNumber', par)
|
||||
function updateNumber(isAdd, index, goods) {
|
||||
const step = isAdd ? 1 : -1;
|
||||
const newval = goods.number + step;
|
||||
if (goods.type == 'package' && goods.groupType == 1 && isAdd) {
|
||||
return;
|
||||
}
|
||||
const par = {
|
||||
num: newval,
|
||||
index: index,
|
||||
goods: goods
|
||||
};
|
||||
edmits('updateNumber', par);
|
||||
}
|
||||
|
||||
function clear() {
|
||||
if ( modal.type == 'cart') {
|
||||
hideGoods()
|
||||
}
|
||||
setModalShow('clear', false)
|
||||
edmits('clear',modal.type)
|
||||
function clear() {
|
||||
if (modal.type == 'cart') {
|
||||
hideGoods();
|
||||
}
|
||||
|
||||
setModalShow('clear', false);
|
||||
edmits('clear', modal.type);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
$car-size: 96rpx;
|
||||
$car-top: -16rpx;
|
||||
$car-size: 96rpx;
|
||||
$car-top: -16rpx;
|
||||
|
||||
@mixin fixedAll {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
@mixin fixedAll {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.total {
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
.grayscale {
|
||||
filter: opacity(60%);
|
||||
}
|
||||
.mask {
|
||||
@include fixedAll;
|
||||
background: rgba(51, 51, 51, 0.5);
|
||||
}
|
||||
|
||||
.goods {
|
||||
position: absolute;
|
||||
bottom: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
transition: all 0.2s ease-in-out;
|
||||
overflow: hidden;
|
||||
|
||||
.item {
|
||||
padding: 32rpx 28rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.total {
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
.border-bottom {
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx
|
||||
}
|
||||
.grayscale{
|
||||
filter: opacity(60%)
|
||||
}
|
||||
.mask {
|
||||
@include fixedAll;
|
||||
background: rgba(51, 51, 51, 0.5);
|
||||
}
|
||||
.border-top {
|
||||
border-top: 1px solid #e5e5e5;
|
||||
}
|
||||
|
||||
.red {
|
||||
color: #eb4f4f;
|
||||
}
|
||||
|
||||
.car {
|
||||
padding: 0 28rpx;
|
||||
position: relative;
|
||||
background-color: #fff;
|
||||
padding-top: 10rpx;
|
||||
padding-bottom: calc(40rpx + env(safe-area-inset-bottom));
|
||||
/* #ifdef H5 */
|
||||
padding-bottom: 68rpx;
|
||||
|
||||
.goods {
|
||||
/* #endif */
|
||||
.icon-car-box {
|
||||
position: absolute;
|
||||
bottom: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
transition: all .2s ease-in-out;
|
||||
overflow: hidden;
|
||||
left: 28rpx;
|
||||
top: $car-top;
|
||||
display: flex;
|
||||
width: $car-size;
|
||||
height: $car-size;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 2;
|
||||
|
||||
.item {
|
||||
padding: 32rpx 28rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.border-bottom {
|
||||
border-bottom: 1px solid #E5E5E5;
|
||||
}
|
||||
|
||||
.border-top {
|
||||
border-top: 1px solid #E5E5E5;
|
||||
}
|
||||
|
||||
.red {
|
||||
color: #EB4F4F;
|
||||
}
|
||||
|
||||
.car {
|
||||
padding: 0 28rpx;
|
||||
position: relative;
|
||||
background-color: #fff;
|
||||
padding-top: 10rpx;
|
||||
padding-bottom: calc(40rpx + env(safe-area-inset-bottom));
|
||||
/* #ifdef H5 */
|
||||
padding-bottom: 68rpx;
|
||||
|
||||
/* #endif */
|
||||
.icon-car-box {
|
||||
.dot {
|
||||
position: absolute;
|
||||
left: 28rpx;
|
||||
top: $car-top;
|
||||
right: 0;
|
||||
top: 0;
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
background: #eb4f4f;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
width: $car-size;
|
||||
height: $car-size;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 2;
|
||||
|
||||
.dot {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
background: #EB4F4F;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 20rpx;
|
||||
font-weight: bold;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
.price {
|
||||
color: #EB4F4F;
|
||||
margin-left: calc(38rpx + $car-size);
|
||||
transform: translateY(calc($car-top / 2));
|
||||
}
|
||||
|
||||
.icon-car {
|
||||
width: $car-size;
|
||||
height: $car-size;
|
||||
font-size: 20rpx;
|
||||
font-weight: bold;
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
.price {
|
||||
color: #eb4f4f;
|
||||
margin-left: calc(38rpx + $car-size);
|
||||
transform: translateY(calc($car-top / 2));
|
||||
}
|
||||
|
||||
.icon-car {
|
||||
width: $car-size;
|
||||
height: $car-size;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,8 @@ export default defineConfig({
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'https://tapi.cashier.sxczgkj.cn/api', // 目标服务器地址
|
||||
target: 'https://cashier.sxczgkj.com', // 目标服务器地址
|
||||
// target: 'http://192.168.1.31/\', // 目标服务器地址
|
||||
changeOrigin: true, // 是否更改请求源
|
||||
rewrite: path => path.replace(/^\/api/, '')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user