Merge branch 'test' of https://e.coding.net/g-cphe0354/cashier_front/cashier_admin_app into gh
This commit is contained in:
commit
530ce34194
|
|
@ -0,0 +1,45 @@
|
|||
import {
|
||||
reactive, ref
|
||||
} from 'vue';
|
||||
function isSameType(a, b) {
|
||||
return a instanceof b === true || b instanceof a === true;
|
||||
}
|
||||
class LIST{
|
||||
constructor(data) {
|
||||
this.data=reactive({
|
||||
page:0,
|
||||
totalPage:0,
|
||||
total:0,
|
||||
list:[],
|
||||
hasAjax:false,
|
||||
status:'',//loading fail success
|
||||
query:{
|
||||
|
||||
}
|
||||
})
|
||||
Object.assign(this.data, data)
|
||||
}
|
||||
add(item){
|
||||
this.data.list.push(item)
|
||||
}
|
||||
del(index){
|
||||
this.data.list.splice(index,1)
|
||||
}
|
||||
update(index,item){
|
||||
this.data.list[index]=item
|
||||
}
|
||||
get(index){
|
||||
return this.data.list[index]
|
||||
}
|
||||
getVal(key){
|
||||
return this.data[key]
|
||||
}
|
||||
setVal(key,val){
|
||||
this.data[key]=val
|
||||
if(key=='page'){
|
||||
this.data['page']=val
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default LIST
|
||||
|
|
@ -329,7 +329,9 @@ text {
|
|||
flex-direction: column;
|
||||
background: #F9F9F9;
|
||||
}
|
||||
|
||||
.box-shadow{
|
||||
box-shadow: 0 0 5px #eee;
|
||||
}
|
||||
.safe-bottom{
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
/* #ifdef H5 */
|
||||
|
|
|
|||
|
|
@ -79,7 +79,27 @@ const model = {
|
|||
return appCache.shopId
|
||||
}
|
||||
},
|
||||
// 获取和放置useType就餐类型
|
||||
useType: (val, isDelete = false) => {
|
||||
if (isDelete) {
|
||||
appCache.useType = ""
|
||||
return uni.removeStorageSync('useType')
|
||||
}
|
||||
|
||||
if (val) {
|
||||
// 有值,为放置
|
||||
appCache.useType = val
|
||||
uni.setStorageSync('useType', val)
|
||||
} else {
|
||||
// 否则为获取
|
||||
|
||||
if (!appCache.useType) {
|
||||
//缓存取不到,获取应用本地信息
|
||||
appCache.useType = uni.getStorageSync('useType')
|
||||
}
|
||||
return appCache.useType
|
||||
}
|
||||
},
|
||||
// 已经登录的用户记录
|
||||
loggedInUser: (addUserName = null, removeUserName = null) => {
|
||||
let key = "loggedInUserList"
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ import { computed } from 'vue';
|
|||
margin: auto;
|
||||
}
|
||||
.shadow{
|
||||
box-shadow: 0 0 10px #999;
|
||||
box-shadow: 0 0 10px #aaa;
|
||||
}
|
||||
.btn {
|
||||
font-size: 28rpx;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
<template>
|
||||
<view class="my-radio u-font-28 u-flex color-333" @tap.stop="changeVal" >
|
||||
<view class="circle u-flex u-row-center" :style="computedStyle()" :class="{active:modelValue,square:shape==='square'}">
|
||||
<view class="my-radio u-font-28 u-flex color-333" @tap.stop="changeVal">
|
||||
<view class="circle u-flex u-row-center" :style="computedStyle()"
|
||||
:class="{active:modelValue,square:shape==='square'}">
|
||||
<uni-icons type="checkmarkempty" v-if="modelValue" :size="size-4" color="#fff"></uni-icons>
|
||||
</view>
|
||||
<view class="u-m-l-12">
|
||||
{{text}}
|
||||
<slot>{{text}}</slot>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
|
@ -14,11 +15,11 @@
|
|||
} from 'vue'
|
||||
import color from '@/commons/color.js'
|
||||
const props = defineProps({
|
||||
disabled:{
|
||||
disabled: {
|
||||
type: [Boolean],
|
||||
default: false
|
||||
},
|
||||
borderColor:{
|
||||
borderColor: {
|
||||
type: String,
|
||||
default: '#bbb',
|
||||
},
|
||||
|
|
@ -29,10 +30,10 @@
|
|||
},
|
||||
// v-modal
|
||||
modelValue: {
|
||||
type: [Number,Boolean],
|
||||
type: [Number, Boolean],
|
||||
default: false,
|
||||
},
|
||||
shape:{
|
||||
shape: {
|
||||
//circle square
|
||||
type: String,
|
||||
default: 'circle',
|
||||
|
|
@ -52,18 +53,19 @@
|
|||
`
|
||||
}
|
||||
const emits = defineEmits(['update:modelValue', 'change'])
|
||||
|
||||
function changeVal() {
|
||||
if(props.disabled){
|
||||
if (props.disabled) {
|
||||
return
|
||||
}
|
||||
emits('click')
|
||||
let currentVal=props.modelValue
|
||||
let type=typeof currentVal
|
||||
if(type==='number'){
|
||||
currentVal=currentVal===0?1:0
|
||||
let currentVal = props.modelValue
|
||||
let type = typeof currentVal
|
||||
if (type === 'number') {
|
||||
currentVal = currentVal === 0 ? 1 : 0
|
||||
}
|
||||
if(type==='boolean'){
|
||||
currentVal=!currentVal
|
||||
if (type === 'boolean') {
|
||||
currentVal = !currentVal
|
||||
}
|
||||
emits('update:modelValue', currentVal)
|
||||
emits('change', currentVal)
|
||||
|
|
@ -75,7 +77,7 @@
|
|||
|
||||
.circle {
|
||||
background: #FFFFFF;
|
||||
|
||||
|
||||
&.active {
|
||||
background-color: $my-main-color;
|
||||
border-color: $my-main-color;
|
||||
|
|
@ -84,7 +86,8 @@
|
|||
border: 1px solid #707070;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
&.square{
|
||||
|
||||
&.square {
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<view class="left-line" :class="{hide:index==list.length-1}"></view>
|
||||
</view>
|
||||
<view class="u-p-l-12 ">
|
||||
<view class="u-font-20">{{item[titleKey]||''}}</view>
|
||||
<view class="u-font-20">{{formatTitle(item[titleKey]||'') }}</view>
|
||||
<view class="u-font-24 u-m-t-2">{{item[contentKey]||''}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -14,6 +14,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import dayjs from 'dayjs';
|
||||
const props = defineProps({
|
||||
active: {
|
||||
type: [String, Number],
|
||||
|
|
@ -32,6 +33,10 @@
|
|||
default: 'content'
|
||||
}
|
||||
})
|
||||
|
||||
function formatTitle(time){
|
||||
return dayjs(time).format('YYYY-M-D HH:MM:ss')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
|
|
@ -1,69 +1,103 @@
|
|||
<template>
|
||||
<up-upload :fileList="images" @afterRead="afterRead" @delete="deletePic" :multiple="multiple"
|
||||
:width="width" :height="height"
|
||||
:maxCount="10"></up-upload>
|
||||
<up-upload :fileList="images" @afterRead="afterRead" @delete="deletePic" :multiple="multiple" :width="width"
|
||||
:height="height" :maxCount="maxCount"></up-upload>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {$uploadFile} from '@/http/yskApi/file.js'
|
||||
import {
|
||||
ref, watch
|
||||
$uploadFile
|
||||
} from '@/http/yskApi/file.js'
|
||||
import {
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
|
||||
const props=defineProps({
|
||||
modelValue:{
|
||||
type:Array,
|
||||
default:()=>[]
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
width:{
|
||||
type:[String,Number],
|
||||
default:60
|
||||
width: {
|
||||
type: [String, Number],
|
||||
default: 60
|
||||
},
|
||||
height:{
|
||||
type:[String,Number],
|
||||
default:60
|
||||
height: {
|
||||
type: [String, Number],
|
||||
default: 60
|
||||
},
|
||||
multiple:{
|
||||
type:Boolean,
|
||||
default:true
|
||||
maxCount: {
|
||||
type: [Number],
|
||||
default: 10
|
||||
},
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
const emits=defineEmits(['update:modelValue'])
|
||||
|
||||
|
||||
const emits = defineEmits(['update:modelValue'])
|
||||
const images = ref(props.modelValue)
|
||||
function afterRead(e){
|
||||
for(let i in e.file){
|
||||
const file=e.file[i].file
|
||||
|
||||
function afterRead(e) {
|
||||
console.log(e);
|
||||
if (Array.isArray(e)) {
|
||||
for (let i in e.file) {
|
||||
const file = e.file[i].file
|
||||
$uploadFile(file).then(res => {
|
||||
console.log(res);
|
||||
images.value.push({
|
||||
url: e.file[i].url,
|
||||
serveUrl: res.data[0]
|
||||
})
|
||||
}).catch(res => {
|
||||
console.log(res);
|
||||
if (res.errMsg) {
|
||||
images.value.splice(i, 1)
|
||||
uni.showToast({
|
||||
title: '图片大小超出限制',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}else{
|
||||
const i=0
|
||||
const file = e.file.file
|
||||
$uploadFile(file).then(res => {
|
||||
console.log(res);
|
||||
images.value.push({
|
||||
url: e.file[i].url,
|
||||
url: e.file.url,
|
||||
serveUrl: res.data[0]
|
||||
})
|
||||
}).catch(res=>{
|
||||
}).catch(res => {
|
||||
console.log(res);
|
||||
if(res.errMsg){
|
||||
images.value.splice(i,1)
|
||||
if (res.errMsg) {
|
||||
images.value.splice(i, 1)
|
||||
uni.showToast({
|
||||
title:'图片大小超出限制',
|
||||
icon:'error'
|
||||
title: '图片大小超出限制',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
function deletePic(e){
|
||||
const {index}=e
|
||||
images.value.splice(index,1)
|
||||
|
||||
function deletePic(e) {
|
||||
const {
|
||||
index
|
||||
} = e
|
||||
images.value.splice(index, 1)
|
||||
}
|
||||
|
||||
watch(()=>images.value,(newval)=>{
|
||||
emits('update:modelValue',newval)
|
||||
|
||||
watch(() => images.value, (newval) => {
|
||||
emits('update:modelValue', newval)
|
||||
})
|
||||
watch(()=>props.modelValue,(newval)=>{
|
||||
images.value=newval
|
||||
watch(() => props.modelValue, (newval) => {
|
||||
images.value = newval
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ export function gettbConsInfo(params) {
|
|||
// params
|
||||
// });
|
||||
return request({
|
||||
url: "/api/viewConInfoFlow",
|
||||
url: "/api/tbConsInfo",
|
||||
method: "get",
|
||||
params: {
|
||||
...params,
|
||||
|
|
|
|||
|
|
@ -133,4 +133,8 @@ export function $tbProskuConV2(data) {
|
|||
export function $updateProductData(data) {
|
||||
return http.req('/api/stock/updateProductData', data, 'POST')
|
||||
}
|
||||
/* 商品报损 */
|
||||
export function $frmLoss(data) {
|
||||
return http.req('/api/tbProductStockDetail/frmLoss', {...data,shopId:uni.getStorageSync('shopId')}, 'POST')
|
||||
}
|
||||
// v2 api end
|
||||
|
|
@ -15,7 +15,12 @@ import {
|
|||
} from '@/commons/utils/encryptUtil.js'
|
||||
import infoBox from "@/commons/utils/infoBox.js"
|
||||
import go from '@/commons/utils/go.js';
|
||||
// 测试服
|
||||
let baseUrl = 'https://admintestpapi.sxczgkj.cn'
|
||||
// 王伟本地测
|
||||
// let baseUrl = '/ww'
|
||||
// let baseUrl = 'http://192.168.1.15:8000'
|
||||
|
||||
// 多少 ms 以内, 不提示loading
|
||||
const loadingShowTime = 200
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import http from './http.js'
|
||||
const request=http.request
|
||||
const request = http.request
|
||||
|
||||
/**
|
||||
* 查询订单
|
||||
|
|
@ -7,14 +7,14 @@ const request=http.request
|
|||
* @returns
|
||||
*/
|
||||
export function tbOrderInfoData(data) {
|
||||
return request({
|
||||
url: "/api/tbOrderInfo/date",
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
...data
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: "/api/tbOrderInfo/date",
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -23,15 +23,15 @@ export function tbOrderInfoData(data) {
|
|||
* @returns
|
||||
*/
|
||||
export function tbOrderInfoDownload(data) {
|
||||
return request({
|
||||
url: "/api/tbOrderInfo/download",
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
...data
|
||||
},
|
||||
responseType: "blob"
|
||||
});
|
||||
return request({
|
||||
url: "/api/tbOrderInfo/download",
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
...data
|
||||
},
|
||||
responseType: "blob"
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -40,10 +40,10 @@ export function tbOrderInfoDownload(data) {
|
|||
* @returns
|
||||
*/
|
||||
export function tbOrderInfoDetail(id) {
|
||||
return request({
|
||||
url: `/api/tbOrderInfo/${id}`,
|
||||
method: "get"
|
||||
});
|
||||
return request({
|
||||
url: `/api/tbOrderInfo/${id}`,
|
||||
method: "get"
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -52,15 +52,15 @@ export function tbOrderInfoDetail(id) {
|
|||
* @returns
|
||||
*/
|
||||
export function payCount(createdAt) {
|
||||
console.log(createdAt);
|
||||
return request({
|
||||
url: `/api/tbOrderInfo/payCount`,
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
createdAt: createdAt
|
||||
}
|
||||
});
|
||||
console.log(createdAt);
|
||||
return request({
|
||||
url: `/api/tbOrderInfo/payCount`,
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
createdAt: createdAt
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -69,14 +69,14 @@ export function payCount(createdAt) {
|
|||
* @returns
|
||||
*/
|
||||
export function tbGroupOrderInfo(params) {
|
||||
return request({
|
||||
url: `/api/tbGroupOrderInfo`,
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
...params
|
||||
}
|
||||
});
|
||||
return request({
|
||||
url: `/api/tbGroupOrderInfo`,
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
...params
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -85,9 +85,24 @@ export function tbGroupOrderInfo(params) {
|
|||
* @returns
|
||||
*/
|
||||
export function returnGpOrder(data) {
|
||||
return request({
|
||||
url: `/api/tbGroupOrderInfo/returnGpOrder`,
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
return request({
|
||||
url: `/api/tbGroupOrderInfo/returnGpOrder`,
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 店铺订单支付获取链接
|
||||
*/
|
||||
export function $getOrderPayUrl(data) {
|
||||
return request({
|
||||
url: `/api/shopPayApi/getOrderPayUrl`,
|
||||
method: "get",
|
||||
data: {
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -223,7 +223,16 @@
|
|||
"pathRewrite" : {
|
||||
"/ysk" : ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"/ww" : {
|
||||
// 需要被代理的后台地址
|
||||
"target" : "http://192.168.1.15:8000",
|
||||
"changeOrigin" : true,
|
||||
"secure" : false,
|
||||
"pathRewrite" : {
|
||||
"/ww" : ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
<template>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
<template>
|
||||
<up-picker :show="show" keyName="name" @confirm="confirm" :columns="category.list" @close="close" @cancel="close" :closeOnClickOverlay="true"></up-picker>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref, warn, watch, watchEffect,
|
||||
onMounted,reactive
|
||||
} from 'vue';
|
||||
import {$tbShopCategory} from '@/http/yskApi/goods.js'
|
||||
const emite=defineEmits(['change','update:isShow','confirm'])
|
||||
const props = defineProps({
|
||||
showAllText:{
|
||||
type:Boolean,
|
||||
default:true
|
||||
},
|
||||
width: {
|
||||
type: [Number, String],
|
||||
default: 264
|
||||
},
|
||||
height: {
|
||||
type: [Number, String],
|
||||
default: 420
|
||||
},
|
||||
right: {
|
||||
type: [Number, String],
|
||||
default: 30
|
||||
},
|
||||
bottom: {
|
||||
type: [Number, String],
|
||||
default: 0
|
||||
},
|
||||
isShow:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
})
|
||||
|
||||
let show = ref(props.isShow)
|
||||
|
||||
watch(()=>show.value,(newval)=>{
|
||||
emite('change',newval)
|
||||
emite('update:isShow',newval)
|
||||
})
|
||||
watch(()=>props.isShow,(newval)=>{
|
||||
console.log(newval);
|
||||
show.value=newval
|
||||
})
|
||||
|
||||
function confirm(e){
|
||||
console.log(e.value[0]);
|
||||
show.value = false
|
||||
emite('confirm',e.value[0])
|
||||
}
|
||||
function close() {
|
||||
console.log('close');
|
||||
show.value = false
|
||||
}
|
||||
|
||||
|
||||
const category=reactive({
|
||||
list:[],
|
||||
})
|
||||
onMounted(()=>{
|
||||
$tbShopCategory({
|
||||
page:0,size:200
|
||||
}).then(res=>{
|
||||
res.content.unshift({
|
||||
name:'全部',
|
||||
id:'',
|
||||
childrenList:[]
|
||||
})
|
||||
category.list=[res.content.reduce((prve, cur) => {
|
||||
prve.push(...[{
|
||||
...cur,
|
||||
name: '' + cur.name,
|
||||
childrenList:undefined
|
||||
}, ...cur.childrenList.map(v => {
|
||||
return {
|
||||
...v,
|
||||
name: '' + v.name
|
||||
}
|
||||
})])
|
||||
return prve
|
||||
}, [])]
|
||||
console.log(category.list);
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.category {
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(0, 0, 0, 0.16);
|
||||
border-radius: 14rpx 14rpx 14rpx 14rpx;
|
||||
position: fixed;
|
||||
font-size: 24rpx;
|
||||
color: #333;
|
||||
.list{
|
||||
box-sizing: border-box;
|
||||
.item{
|
||||
padding: 24rpx 24rpx 24rpx 48rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,166 @@
|
|||
<template>
|
||||
<view class="control" :style="getComputedStyle()">
|
||||
<view class="u-flex control1" v-if="showControl1">
|
||||
<view class="btn" @click="changeShowControl1">批量管理</view>
|
||||
<view class="btn" @tap="go.to('PAGES_PRODUCT_ADD')">商品添加</view>
|
||||
<!-- <view class="color-999 btn u-flex u-row-center" @click="emitToggleCategory">
|
||||
<text class="u-m-r-10">{{categoryName||'选择分类'}}</text>
|
||||
<view class="arrow-down" :class="{'up':categoryShow}">
|
||||
<uni-icons type="right" size="16" color="#999"></uni-icons>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="u-flex control2 u-row-between" v-else>
|
||||
<view class="u-flex u-flex-1 btn " @click="changeIsSelectAll">
|
||||
<view class="u-m-l-28">
|
||||
<my-radio v-model="isSelectAll" >
|
||||
<view class="color-fff">全选</view>
|
||||
</my-radio>
|
||||
</view>
|
||||
<!-- <label class="radio u-m-l-28" >
|
||||
<radio class="scale7" @tap.stop="changeIsSelectAll" :color="ColorMain" value="" :checked="isSelectAll" />
|
||||
<text>全选</text>
|
||||
</label> -->
|
||||
</view>
|
||||
<view class=" btn u-flex-1 my-bg-main" @click="changeShowControl1">取消</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {$tbShopCategory} from '@/http/yskApi/goods.js'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import {ColorMain} from '@/commons/color.js'
|
||||
import {
|
||||
onMounted,
|
||||
reactive,
|
||||
ref
|
||||
} from 'vue';
|
||||
const props = defineProps({
|
||||
bottom: {
|
||||
type: [Number, String],
|
||||
default: 30
|
||||
},
|
||||
categoryName:{
|
||||
type:String,
|
||||
default:''
|
||||
},
|
||||
categoryShow:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
let showControl1 = ref(true)
|
||||
const emits = defineEmits(['toggleCategory','controlChange','allCheckedChange','offShelf','categoryChange'])
|
||||
|
||||
function emitToggleCategory() {
|
||||
emits('toggleCategory')
|
||||
}
|
||||
|
||||
function changeShowControl1() {
|
||||
showControl1.value = !showControl1.value
|
||||
if(!showControl1.value){
|
||||
isSelectAll.value=false
|
||||
}
|
||||
emits('controlChange',!showControl1.value)
|
||||
}
|
||||
|
||||
let isSelectAll = ref(false)
|
||||
|
||||
function changeIsSelectAll() {
|
||||
console.log('changeIsSelectAll');
|
||||
isSelectAll.value = !isSelectAll.value
|
||||
emits('allCheckedChange',isSelectAll.value)
|
||||
}
|
||||
|
||||
function getComputedStyle() {
|
||||
return {
|
||||
bottom: props.bottom + 'rpx'
|
||||
}
|
||||
}
|
||||
//设置是否全选
|
||||
function setisSelectAll(checked){
|
||||
isSelectAll.value =checked
|
||||
}
|
||||
defineExpose({
|
||||
setisSelectAll
|
||||
})
|
||||
|
||||
//下架
|
||||
function offShelf(){
|
||||
emits('offShelf')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.scale7 {
|
||||
transform: scale(0.7);
|
||||
}
|
||||
|
||||
.borde-r {
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
display: block;
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 20rpx;
|
||||
bottom: 20rpx;
|
||||
width: 2px;
|
||||
background-color: #fff;
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.control {
|
||||
position: fixed;
|
||||
left: 110rpx;
|
||||
right: 110rpx;
|
||||
z-index: 100;
|
||||
background: #3E3A3A;
|
||||
border-radius: 100rpx;
|
||||
overflow: hidden;
|
||||
.btn{
|
||||
color: #fff;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.control1 {
|
||||
.arrow-down {
|
||||
transform: rotate(90deg);
|
||||
transition: all .2s ease-in-out;
|
||||
&.up{
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.control1 .btn:not(:last-child)::after {
|
||||
display: block;
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 20rpx;
|
||||
bottom: 20rpx;
|
||||
width: 2px;
|
||||
background-color: #fff;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.control1 .btn {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.control1 .btn,
|
||||
.control2 .btn{
|
||||
position: relative;
|
||||
line-height: 76rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.control2 {
|
||||
overflow: hidden;
|
||||
// padding: 0 28rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,286 @@
|
|||
<template>
|
||||
<view>
|
||||
<template v-if="isBind">
|
||||
<view class="goods">
|
||||
|
||||
<view class="u-flex u-row-between">
|
||||
<view class="u-flex">
|
||||
<view class="color-333">
|
||||
<text class="">排序</text>
|
||||
<text class="u-m-l-20">{{data.sort}}</text>
|
||||
</view>
|
||||
<view class="color-333 u-m-l-42 u-flex">
|
||||
<text class="stock u-m-l-4">库存:{{data.stockNumber}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="u-m-t-32 u-flex u-col-top u-relative">
|
||||
<view v-if="props.showChecked">
|
||||
<label class="radio">
|
||||
<radio :color="ColorMain" style="transform: scale(0.7);" @click="radioClick"
|
||||
:checked="props.data.checked" /><text></text>
|
||||
</label>
|
||||
</view>
|
||||
<view class="img">
|
||||
<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="u-flex">
|
||||
<text class="u-m-r-24">{{data.name}}</text>
|
||||
</view>
|
||||
<view class="u-font-32">
|
||||
<text v-if="data.typeEnum=='单规格'">¥</text>
|
||||
<text>{{data.lowPrice}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<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>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
watch,
|
||||
watchEffect
|
||||
} from 'vue';
|
||||
import {
|
||||
$goodsIsHot,
|
||||
$tbProskuConV2,
|
||||
$updateProductData
|
||||
} from '@/http/yskApi/goods.js'
|
||||
import mySwitch from '@/components/my-components/my-switch.vue'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import {
|
||||
ColorMain
|
||||
} from '@/commons/color.js'
|
||||
const emits = defineEmits(['goodsClick', 'changeClick', 'xiajia', 'del', 'changePrice', 'baosun', 'guigeClick',
|
||||
'editStock'
|
||||
])
|
||||
const props = defineProps({
|
||||
isBind: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
index: {
|
||||
type: Number
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
checked:false,
|
||||
}
|
||||
}
|
||||
},
|
||||
showChecked: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
showDetail: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
|
||||
function goodsClick(){
|
||||
emits('goodsClick',props.index)
|
||||
}
|
||||
|
||||
async function upDateGoods(par) {
|
||||
const res = await $updateProductData([{
|
||||
id: props.data.id,
|
||||
isSku: 0,
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
...par
|
||||
}])
|
||||
uni.showToast({
|
||||
title: '修改成功',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function radioClick() {
|
||||
console.log(props.index);
|
||||
emits('radioClick', props.index)
|
||||
}
|
||||
|
||||
function changeClick() {
|
||||
emits('changeClick', props.index)
|
||||
}
|
||||
|
||||
function xiajia() {
|
||||
emits('xiajia', props.index)
|
||||
}
|
||||
|
||||
function del() {
|
||||
emits('del', props.index)
|
||||
}
|
||||
|
||||
function changePrice() {
|
||||
emits('changePrice', props.index)
|
||||
}
|
||||
|
||||
function baosun() {
|
||||
emits('baosun', props.index)
|
||||
}
|
||||
|
||||
function guigeClick(guigeIndex) {
|
||||
emits('guigeClick', props.index, guigeIndex)
|
||||
}
|
||||
|
||||
function editStock() {
|
||||
emits('editStock', props.index)
|
||||
}
|
||||
//携带参数type edit跳转到商品添加页面,编辑与添加同一页面,根据type值来判断
|
||||
function toEdit() {
|
||||
go.to('PAGES_PRODUCT_ADD', {
|
||||
type: 'edit',
|
||||
productId: props.data.id
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
$imgSize: 126rpx;
|
||||
$price-color: #F02C45;
|
||||
|
||||
.btn {
|
||||
padding: 6rpx 28rpx;
|
||||
border-radius: 100rpx;
|
||||
border: 2rpx solid transparent;
|
||||
}
|
||||
|
||||
.gap-10 {
|
||||
gap: 10rpx;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
border-color: $my-main-color;
|
||||
color: $my-main-color;
|
||||
}
|
||||
|
||||
.btn-default {
|
||||
border-color: #999;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.price {
|
||||
color: $price-color;
|
||||
}
|
||||
|
||||
.h-100 {
|
||||
height: $imgSize;
|
||||
}
|
||||
|
||||
.img {
|
||||
width: $imgSize;
|
||||
height: $imgSize;
|
||||
}
|
||||
|
||||
.info-p-l {
|
||||
padding-left: 71px;
|
||||
}
|
||||
|
||||
.icon-arrow-right {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
|
||||
.stock {
|
||||
// padding-right: 46rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.stock::after {
|
||||
// content: '';
|
||||
// position: absolute;
|
||||
// right: 10rpx;
|
||||
// top: 50%;
|
||||
// transform: translateY(-50%);
|
||||
// display: block;
|
||||
// width: 16rpx;
|
||||
// border: 2rpx solid #333333;
|
||||
}
|
||||
|
||||
.color-red {
|
||||
color: #F0465B;
|
||||
}
|
||||
|
||||
.goods {
|
||||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||||
background-color: #fff;
|
||||
padding: 24rpx 28rpx 16rpx 28rpx;
|
||||
font-size: 28rpx;
|
||||
|
||||
.skus {
|
||||
background: #F9F9F9;
|
||||
border-radius: 14rpx 14rpx 14rpx 14rpx;
|
||||
padding: 20rpx;
|
||||
|
||||
.sku {
|
||||
color: #000;
|
||||
font-weight: 700;
|
||||
padding: 6rpx 40rpx;
|
||||
}
|
||||
|
||||
.skds {
|
||||
gap: 10rpx 50rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.skd {
|
||||
padding: 14rpx 40rpx 14rpx 20rpx;
|
||||
background: #F0F2F5;
|
||||
border-radius: 4rpx;
|
||||
position: relative;
|
||||
color: #666;
|
||||
overflow: hidden;
|
||||
margin-bottom: 10rpx;
|
||||
font-size: 24rpx;
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.tag-gray {
|
||||
background-color: rgb(144, 147, 153);
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,552 @@
|
|||
<template>
|
||||
<view class="safe-page">
|
||||
<up-sticky>
|
||||
<view class="bg-fff u-p-l-30 u-p-r-30 u-p-b-30">
|
||||
<!-- <view class="myTabs ">
|
||||
<myTabs :list="tabsList" @change="tabsChange"></myTabs>
|
||||
</view> -->
|
||||
<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>
|
||||
<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"
|
||||
@confirm="searchFunc">
|
||||
<template #prefixIcon>
|
||||
<image src="@/static/iconImg/icon-search.svg" class="input-icon" />
|
||||
</template>
|
||||
</uni-easyinput>
|
||||
<button type="text" @click="searchFunc()">搜索</button>
|
||||
</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>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</up-sticky>
|
||||
<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 @radioClick="goodsRadioClick" :index="index"
|
||||
:data="item" @del="goodsDel" :showChecked="showChecked"
|
||||
:showDetail="pageData.showGoodsDetail"></my-goods>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="pageData.hasAjax&&!pageData.bindGoodsList.length">
|
||||
<my-img-empty tips="暂无绑定商品"></my-img-empty>
|
||||
</template>
|
||||
<view style="height: 100rpx;"></view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<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"
|
||||
@radioClick="goodsRadioClick" :index="index" :data="item" @del="goodsDel"
|
||||
:showChecked="showChecked" :showDetail="pageData.showGoodsDetail"></my-goods>
|
||||
</view>
|
||||
</template>
|
||||
<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>
|
||||
<!-- <my-pagination :totalElements="pageData.totalElements" :size="pageData.query.size"
|
||||
@change="pageChange"></my-pagination> -->
|
||||
|
||||
|
||||
<!-- <my-control></my-control> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
<!-- 分类 -->
|
||||
<my-category v-model:isShow="pageData.categoryShow" @confirm="setCategory"></my-category>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
onLoad,
|
||||
onReady,
|
||||
onShow,
|
||||
onPageScroll,
|
||||
onPullDownRefresh
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import go from '@/commons/utils/go.js';
|
||||
import myGoods from './components/goods.vue'
|
||||
import myCategory from './components/category.vue'
|
||||
import infoBox from "@/commons/utils/infoBox.js"
|
||||
import myControl from './components/control.vue'
|
||||
import {
|
||||
$tbProduct,
|
||||
$upProSort,
|
||||
$updateProduct,
|
||||
$getProductDetail,
|
||||
$delProduct,
|
||||
$tbShopCategory,
|
||||
$updateProductStatus,
|
||||
$tbProductV2,
|
||||
$updateProductData
|
||||
} from "@/http/yskApi/goods.js"
|
||||
import {
|
||||
productListGet,
|
||||
tbProductGroupGet,
|
||||
tbProductGroupDelete,
|
||||
tbProductGroupPut,
|
||||
upGroupSort,
|
||||
tbProductGroupPost
|
||||
} from "@/http/yskApi/shop.js"
|
||||
|
||||
|
||||
|
||||
import {
|
||||
returnAllCategory
|
||||
} from '@/pageProduct/util.js'
|
||||
|
||||
const pageData = reactive({
|
||||
modelDesc: '是否下架',
|
||||
stateCurrent: 0,
|
||||
componentBottom: 45,
|
||||
search: {
|
||||
value: '',
|
||||
placeholder: '输入搜索的商品'
|
||||
},
|
||||
showGoodsDetail: false,
|
||||
selGoodsIndex: '',
|
||||
selGoods: {},
|
||||
totalElements: 0,
|
||||
totalPage: 0,
|
||||
bindGoodsList: [],
|
||||
goodsList: [],
|
||||
query: {
|
||||
page: 0,
|
||||
size: 999,
|
||||
categoryId: '',
|
||||
name: ''
|
||||
},
|
||||
category: '',
|
||||
categoryList: [], //分类列表
|
||||
categoryShow: false,
|
||||
categoryName: '',
|
||||
hasAjax: false
|
||||
})
|
||||
watch(() => pageData.query.categoryId, (newval) => {
|
||||
getGoodsList()
|
||||
})
|
||||
|
||||
watch(()=>pageData.stateCurrent,(newval)=>{
|
||||
if(newval){
|
||||
setGoodsList()
|
||||
}else{
|
||||
init()
|
||||
}
|
||||
})
|
||||
|
||||
function isGroundingChange(e) {
|
||||
const {
|
||||
goodsIndex,
|
||||
guigeIndex
|
||||
} = popup.guige
|
||||
pageData.goodsList[goodsIndex].skuList[guigeIndex].isGrounding = e
|
||||
}
|
||||
|
||||
function isPauseSaleChange(e) {
|
||||
const {
|
||||
goodsIndex,
|
||||
guigeIndex
|
||||
} = popup.guige
|
||||
pageData.goodsList[goodsIndex].skuList[guigeIndex].isPauseSale = e
|
||||
}
|
||||
|
||||
function onCategoryShowChange(show) {
|
||||
console.log(show);
|
||||
pageData.categoryShow = show
|
||||
}
|
||||
|
||||
function goodsClick(e) {
|
||||
console.log(e);
|
||||
pageData.goodsList[e].checked = !pageData.goodsList[e].checked
|
||||
}
|
||||
|
||||
function setCategory(category) {
|
||||
pageData.query.categoryId = category.id
|
||||
pageData.categoryName = category.name
|
||||
}
|
||||
|
||||
let $goodsList=[]
|
||||
function setGoodsList(){
|
||||
pageData.goodsList = $goodsList.filter(v=>!pageData.bindGoodsList.find(bindGoods=>bindGoods.id==v.id))
|
||||
}
|
||||
function getGoodsList() {
|
||||
$tbProductV2(pageData.query).then(res => {
|
||||
pageData.hasAjax = true
|
||||
pageData.totalElements = res.totalElements
|
||||
$goodsList=res.content.map(v=>{
|
||||
return {
|
||||
...v,checked:false
|
||||
}
|
||||
})
|
||||
setGoodsList()
|
||||
|
||||
})
|
||||
}
|
||||
onShow(() => {
|
||||
// getGoodsList()
|
||||
})
|
||||
async function getGroupBindGoods() {
|
||||
const res = await productListGet(option.id)
|
||||
pageData.bindGoodsList = res
|
||||
}
|
||||
const option = reactive({})
|
||||
async function init() {
|
||||
const res = await productListGet(option.id)
|
||||
pageData.bindGoodsList = res
|
||||
getGoodsList()
|
||||
}
|
||||
onLoad((opt) => {
|
||||
tbProductGroupGet({
|
||||
page: 0,
|
||||
size: 999,
|
||||
sort: 'id',
|
||||
shopId: uni.getStorageSync('shopId')
|
||||
})
|
||||
Object.assign(option, opt)
|
||||
init()
|
||||
// $tbShopCategory({
|
||||
// page: 0,
|
||||
// size: 200
|
||||
// }).then(res => {
|
||||
// pageData.categoryList = returnAllCategory(res.content)
|
||||
// console.log(pageData.categoryList);
|
||||
// })
|
||||
})
|
||||
|
||||
const statesTabsList = ['已添加', '未添加']
|
||||
|
||||
const control = ref(null)
|
||||
const model = ref(null)
|
||||
const goodsStockModel = ref(null)
|
||||
|
||||
function returnGoodsStockData() {
|
||||
return reactive({
|
||||
sort: 0,
|
||||
isStock: false,
|
||||
isDistribute: false,
|
||||
isPauseSale: false,
|
||||
isGrounding: false,
|
||||
stockNumber: 0,
|
||||
})
|
||||
}
|
||||
|
||||
async function save() {
|
||||
console.log(pageData.goodsList);
|
||||
await tbProductGroupPut({
|
||||
...option,
|
||||
shopId:uni.getStorageSync('shopId'),
|
||||
productIds:[...pageData.bindGoodsList.map(v=>v.id),...pageData.goodsList.filter(v=>v.checked).map(v=>v.id)]
|
||||
})
|
||||
pageData.stateCurrent=0
|
||||
}
|
||||
|
||||
|
||||
function updateGroup(){
|
||||
|
||||
}
|
||||
|
||||
//删除商品
|
||||
function goodsDel(index) {
|
||||
const goods = pageData.bindGoodsList[index]
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '是否确认将' + goods.name + '从该分组中移除',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
pageData.bindGoodsList.splice(index, 1)
|
||||
tbProductGroupPut({
|
||||
...option,
|
||||
shopId:uni.getStorageSync('shopId'),
|
||||
productIds:pageData.bindGoodsList.map(v=>v.id)
|
||||
})
|
||||
} else if (res.cancel) {}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function statesTableClick(index) {
|
||||
pageData.stateCurrent = index
|
||||
}
|
||||
|
||||
|
||||
function tabsChange(i) {
|
||||
console.log(i);
|
||||
pageData.showGoodsDetail = i ? true : false
|
||||
}
|
||||
|
||||
|
||||
//改变商品的选中状态
|
||||
function changeGoodsChecked(checked, index) {
|
||||
if (index !== undefined) {
|
||||
pageData.goodsList[index].checked = checked
|
||||
} else {
|
||||
pageData.goodsList.map(v => {
|
||||
v.checked = checked
|
||||
})
|
||||
}
|
||||
control.value.setisSelectAll(isAllChecked() ? true : false)
|
||||
}
|
||||
|
||||
|
||||
// 获取已经选中的商品
|
||||
function getChechkedGoodsList() {
|
||||
return pageData.goodsList.filter(v => v.checked)
|
||||
}
|
||||
//是否全部选中
|
||||
function isAllChecked() {
|
||||
return getChechkedGoodsList().length === pageData.goodsList.length
|
||||
}
|
||||
// 是否有商品选中
|
||||
function isHasChekdGoods() {
|
||||
return getChechkedGoodsList().length ? true : false
|
||||
}
|
||||
|
||||
function searchFunc() {
|
||||
console.log('searchFunc');
|
||||
getGoodsList()
|
||||
}
|
||||
|
||||
let showChecked = ref(false)
|
||||
|
||||
//商品start
|
||||
|
||||
function goodsRadioClick(index) {
|
||||
var checked = !pageData.goodsList[index].checked
|
||||
changeGoodsChecked(checked, index)
|
||||
}
|
||||
|
||||
|
||||
//下架
|
||||
function offShelf() {
|
||||
const hasCheckedArr = getChechkedGoodsList()
|
||||
const hasChecked = isHasChekdGoods()
|
||||
if (!hasChecked) {
|
||||
return infoBox.showToast('您还没有选中商品!')
|
||||
}
|
||||
model.value.open()
|
||||
}
|
||||
//下架确认
|
||||
function modelConfirm() {
|
||||
console.log('confirm');
|
||||
model.value.close()
|
||||
}
|
||||
|
||||
//商品end
|
||||
|
||||
//控制条
|
||||
function controlChange(bol) {
|
||||
showChecked.value = bol
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 全选
|
||||
function allCheckedChange(checked) {
|
||||
changeGoodsChecked(checked)
|
||||
}
|
||||
|
||||
// 页数改变事件
|
||||
function pageChange(page) {
|
||||
console.log(page);
|
||||
pageData.query.page = page - 1
|
||||
getGoodsList()
|
||||
}
|
||||
|
||||
//分类
|
||||
const category = ref(null)
|
||||
|
||||
function toggleCategory() {
|
||||
category.value.toggle()
|
||||
}
|
||||
|
||||
function cateClick(cate) {
|
||||
console.log(cate);
|
||||
pageData.query.categoryId = cate.id
|
||||
pageData.categoryName = cate.name
|
||||
pageData.category = cate
|
||||
getGoodsList()
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
page {
|
||||
background: #F9F9F9;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
.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;
|
||||
align-items: center;
|
||||
height: 64rpx;
|
||||
|
||||
image {
|
||||
padding: 22rpx;
|
||||
width: 26rpx;
|
||||
height: 26rpx;
|
||||
}
|
||||
|
||||
input {
|
||||
flex: 1;
|
||||
font-size: 27rpx;
|
||||
}
|
||||
|
||||
::v-deep uni-button {
|
||||
font-size: 28rpx;
|
||||
color: $my-main-color;
|
||||
background: rgba(255, 255, 255, 1);
|
||||
}
|
||||
|
||||
::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-placeholder {
|
||||
font-size: 27rpx;
|
||||
}
|
||||
|
||||
.uni-icons {
|
||||
color: rgba(230, 230, 230, 1) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.input-icon {
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.search-button {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
background-color: transparent !important;
|
||||
color: transparent !important;
|
||||
}
|
||||
|
||||
.states1 {
|
||||
margin-top: 24rpx;
|
||||
|
||||
.item {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
|
||||
.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;
|
||||
}
|
||||
}
|
||||
|
||||
&.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>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<template>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
|
|
@ -0,0 +1,555 @@
|
|||
<template>
|
||||
<view class="page">
|
||||
<view class="box">
|
||||
<view>
|
||||
<uni-forms :model="category" :rules="rules" err-show-type="toast" ref="form" :border="true"
|
||||
label-position="top" label-width="350">
|
||||
<view class="block">
|
||||
<view class="">
|
||||
<uni-forms-item label="分类名称" required name="name">
|
||||
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
v-model="category.name" placeholder="输入分类名称" />
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<template v-if="option.type=='edit'">
|
||||
<uni-forms-item label="排序" required name="sort">
|
||||
<uni-easyinput :placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
v-model="category.sort" type="number" placeholder="排序越小越靠前" />
|
||||
</uni-forms-item>
|
||||
</template>
|
||||
|
||||
<uni-forms-item label="">
|
||||
<view class="u-flex u-row-between u-col-center">
|
||||
<view class="label-title">分组状态</view>
|
||||
<view class="u-flex">
|
||||
<my-switch v-model="category.isShow"></my-switch>
|
||||
</view>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
</uni-forms>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="save-btn-box">
|
||||
<button class="save-btn" hover-class="btn-hover-class" @click="save">保存</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom" ref="bottom"></view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import tColorPicker from '@/components/t-color-picker/t-color-picker'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import infoBox from '@/commons/utils/infoBox.js';
|
||||
import {
|
||||
onLoad,
|
||||
onReady
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
onMounted,
|
||||
reactive,
|
||||
nextTick,
|
||||
ref,
|
||||
onBeforeMount,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
tbProductGroupGet,
|
||||
tbProductGroupDelete,
|
||||
tbProductGroupPut,
|
||||
upGroupSort,
|
||||
tbProductGroupPost
|
||||
} from '@/http/yskApi/shop.js'
|
||||
|
||||
const $productCategory = {
|
||||
add: tbProductGroupPost,
|
||||
del: tbProductGroupDelete,
|
||||
update: tbProductGroupPut,
|
||||
get: tbProductGroupGet
|
||||
}
|
||||
|
||||
|
||||
const refAddChilCate = ref(null)
|
||||
const refAddChilCateTitle = ref('添加子分类')
|
||||
|
||||
function refAddChilCateClose() {
|
||||
refAddChilCate.value.close()
|
||||
categoryChild.value = {
|
||||
...categoryBasicData
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let refMoreSheet = ref(null)
|
||||
let selItem = {
|
||||
data: '',
|
||||
index: ''
|
||||
}
|
||||
|
||||
|
||||
// 表单样式
|
||||
const placeholderStyle = ref('font-size:28rpx;')
|
||||
//表单边框
|
||||
const inputBorder = ref(false)
|
||||
const form = ref(null)
|
||||
const bottom = ref(null)
|
||||
//表单验证
|
||||
const rules = {
|
||||
name: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '输入分类名称'
|
||||
}]
|
||||
},
|
||||
sort: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '输入排序'
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
const refFiles = ref([])
|
||||
|
||||
function setRefFile(index) {
|
||||
refFiles.value[index] = null;
|
||||
return (el) => {
|
||||
if (el) {
|
||||
refFiles.value[index] = el;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function toTimer(timer, index) {
|
||||
console.log(timer);
|
||||
uni.setStorageSync('timer', timer.map(v => {
|
||||
return {
|
||||
...v,
|
||||
cycleChecked: v.cycleChecked.map(v => v.value)
|
||||
}
|
||||
}))
|
||||
go.to('PAGES_CATEGORY_TIMER', {
|
||||
index: index
|
||||
})
|
||||
}
|
||||
|
||||
function returnTimers(timers) {
|
||||
const {
|
||||
listingTime,
|
||||
offShelf,
|
||||
cycleChecked
|
||||
} = timers
|
||||
let len = cycleChecked.length
|
||||
if (len === 7) {
|
||||
return `每天 ${listingTime.value} - ${offShelf.value}`
|
||||
}
|
||||
let result = cycleChecked.reduce((prve, cur) => {
|
||||
return prve + cur.text.replace('星期', '周')
|
||||
}, '')
|
||||
return `${result} ${listingTime.value} - ${offShelf.value}`
|
||||
}
|
||||
//图片上传
|
||||
function FileUploadprogress() {
|
||||
|
||||
}
|
||||
|
||||
function FileUploadsuccess() {
|
||||
|
||||
}
|
||||
|
||||
function FileUploadail() {
|
||||
|
||||
}
|
||||
|
||||
function FileUploadselect(e) {
|
||||
// TEST
|
||||
// FormData.images.push(e)
|
||||
}
|
||||
|
||||
|
||||
function returnOptionsBasicData() {
|
||||
return {
|
||||
...categoryOptionsBasicData
|
||||
}
|
||||
}
|
||||
// 构造分类的基础数据
|
||||
const categoryBasicData = {
|
||||
id: '',
|
||||
name: '',
|
||||
isShow: 1,
|
||||
sort: 0,
|
||||
productIds: [],
|
||||
saleTime: [],
|
||||
useTime: 0,
|
||||
shopId: uni.getStorageSync('shopId')
|
||||
}
|
||||
const categoryChild = ref({
|
||||
...categoryBasicData
|
||||
})
|
||||
|
||||
function onFieldChange(e) {
|
||||
console.log(e);
|
||||
}
|
||||
// 分类列表
|
||||
const category = reactive({
|
||||
...categoryBasicData,
|
||||
childrenList: []
|
||||
})
|
||||
//添加子分类
|
||||
function addcategoryChildren() {
|
||||
refAddChilCate.value.open()
|
||||
// category.childrenList.push({
|
||||
// ...categoryBasicData
|
||||
// })
|
||||
// scrollPageBottom()
|
||||
}
|
||||
|
||||
//页面滚动到最底部
|
||||
function scrollPageBottom() {
|
||||
nextTick(() => {
|
||||
uni.pageScrollTo({
|
||||
duration: 100, // 过渡时间
|
||||
scrollTop: 100000, // 滚动的实际距离
|
||||
})
|
||||
})
|
||||
}
|
||||
//设置表单验证规则
|
||||
function setFormRules() {
|
||||
form.value.setRules(rules)
|
||||
}
|
||||
const formRefs = ref([]);
|
||||
//绑定表单元素
|
||||
function setFormRef(index) {
|
||||
formRefs.value[index] = null;
|
||||
return (el) => {
|
||||
if (el) {
|
||||
formRefs.value[index] = el;
|
||||
}
|
||||
};
|
||||
}
|
||||
// 绑定option input元素
|
||||
const refFormInput = ref([])
|
||||
|
||||
function setFormInputRef(index, index1) {
|
||||
const newIndex = index * 10000 + index1
|
||||
return (el) => {
|
||||
if (el) {
|
||||
if (!refFormInput.value[newIndex]) {
|
||||
refFormInput.value[newIndex] = el;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 当表单内容输入变化根据配置的rules进行验证
|
||||
function inpuChange(index, index1) {
|
||||
const newIndex = index * 10000 + index1
|
||||
console.log(refFormInput.value[newIndex]);
|
||||
refFormInput.value[newIndex].onFieldChange()
|
||||
}
|
||||
|
||||
|
||||
|
||||
function triggerEvent(emitName, data) {
|
||||
if (emitName) {
|
||||
uni.$emit(emitName, data)
|
||||
}
|
||||
}
|
||||
const option = reactive({
|
||||
type: ''
|
||||
})
|
||||
|
||||
function isNoEmpty(obj) {
|
||||
return obj && JSON.stringify(obj) !== '{}'
|
||||
}
|
||||
|
||||
/**
|
||||
* 监听定时器保存,拿到数据
|
||||
* @param {Boolean} open //控制开启或关闭监听
|
||||
*/
|
||||
function watchTimerSave(open = true) {
|
||||
if (open) {
|
||||
uni.$on('timerSave', function(res) {
|
||||
const {
|
||||
index,
|
||||
data
|
||||
} = res
|
||||
console.log('timerSave get');
|
||||
console.log(res);
|
||||
if (index == -1) {
|
||||
category.timers = data
|
||||
} else {
|
||||
category.childrenList[index].timers = data
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.$off('timerSave', function(data) {
|
||||
console.log('timerSave remove');
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
watchTimerSave()
|
||||
|
||||
onLoad(params => {
|
||||
let cateItem = uni.getStorageSync('cateItem')
|
||||
if (isNoEmpty(params)) {
|
||||
option.type = params.type
|
||||
}
|
||||
if (option.type === 'edit' && isNoEmpty(cateItem)) {
|
||||
console.log(cateItem);
|
||||
for (let i in cateItem) {
|
||||
if (i.substring(0, 2) === 'is' && i.length > 2) {
|
||||
cateItem[i] = cateItem[i] * 1
|
||||
} else {
|
||||
cateItem[i] = cateItem[i] === 'null' ? '' : cateItem[i]
|
||||
}
|
||||
}
|
||||
Object.assign(category, cateItem)
|
||||
}
|
||||
console.log(category);
|
||||
uni.setNavigationBarTitle({
|
||||
title: option.type === 'add' ? '添加分组' : '编辑分组'
|
||||
})
|
||||
})
|
||||
|
||||
function emitcategorySave() {
|
||||
// emitcategorySave 触发规格保存事件将数据给到添加商品页面
|
||||
// guigeEdit 触发规格保存事件将数据给到添加规格页面
|
||||
uni.removeStorageSync('guige')
|
||||
triggerEvent(emitName, category.list)
|
||||
}
|
||||
|
||||
|
||||
function returnValidateResult(obj) {
|
||||
const validateFuncObj = {
|
||||
name: (value) => {
|
||||
return {
|
||||
pass: value.length >= 1,
|
||||
errMeessage: '请输入分类名称'
|
||||
}
|
||||
},
|
||||
sort: (value) => {
|
||||
return {
|
||||
pass: value !== '',
|
||||
errMeessage: '请输入排序'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function validateFunc(key, value) {
|
||||
if (validateFuncObj.hasOwnProperty(key)) {
|
||||
const func = validateFuncObj[key]
|
||||
return func(value)
|
||||
}
|
||||
return {
|
||||
pass: true
|
||||
}
|
||||
}
|
||||
let resultArr = []
|
||||
for (let key in obj) {
|
||||
resultArr.push(validateFunc(key, obj[key]))
|
||||
}
|
||||
resultArr = resultArr.filter(v => !v.pass)
|
||||
return resultArr
|
||||
}
|
||||
let timer = null
|
||||
|
||||
function onfileChange(val, data, key) {
|
||||
data[key] = val
|
||||
}
|
||||
|
||||
|
||||
async function save() {
|
||||
let isAllPassForm = 0
|
||||
const formRules = {}
|
||||
const result = []
|
||||
result.push(...returnValidateResult(category))
|
||||
for (let obj of category.childrenList) {
|
||||
const res = returnValidateResult(obj)
|
||||
result.push(...res)
|
||||
}
|
||||
if (result.length) {
|
||||
return infoBox.showToast(result[0].errMeessage)
|
||||
}
|
||||
|
||||
if (option.type === 'edit') {
|
||||
const res = await $productCategory.update({
|
||||
...category,
|
||||
childrenList: ''
|
||||
})
|
||||
} else {
|
||||
const res = await $productCategory.add({
|
||||
...category,
|
||||
childrenList: ''
|
||||
})
|
||||
}
|
||||
|
||||
infoBox.showToast(option.type === 'edit' ? '修改成功' : '添加成功')
|
||||
timer = setTimeout(() => {
|
||||
clearTimeout(timer)
|
||||
go.back()
|
||||
}, 1500);
|
||||
// const res = await form.value.validate().then(res => {
|
||||
// go.back()
|
||||
// })
|
||||
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
page {
|
||||
background: #F9F9F9;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
$icon-size: 34rpx;
|
||||
$icon-line-width: 20rpx;
|
||||
$icon-line-height: 4rpx;
|
||||
|
||||
.category-icon {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
}
|
||||
|
||||
.page {
|
||||
background: #F9F9F9;
|
||||
padding: 30rpx;
|
||||
padding-bottom: 200rpx;
|
||||
}
|
||||
|
||||
.my-switch {
|
||||
transform: scale(0.7);
|
||||
}
|
||||
|
||||
::v-deep .uni-forms-item__error {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
::v-deep .option .uni-forms-item {
|
||||
padding: 0;
|
||||
min-height: inherit;
|
||||
background-color: transparent;
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: $icon-size;
|
||||
height: $icon-size;
|
||||
position: relative;
|
||||
border-radius: 50%;
|
||||
|
||||
&:before,
|
||||
&::after {
|
||||
position: absolute;
|
||||
display: block;
|
||||
content: '';
|
||||
background-color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.icon-add {
|
||||
background-color: $my-main-color;
|
||||
|
||||
&::before {
|
||||
width: $icon-line-height;
|
||||
height: $icon-line-width;
|
||||
top: calc(($icon-size /2) - ($icon-line-width / 2));
|
||||
left: calc(($icon-size /2) - ($icon-line-height / 2));
|
||||
}
|
||||
|
||||
&::after {
|
||||
width: $icon-line-width;
|
||||
height: 4rpx;
|
||||
top: calc(($icon-size /2) - ($icon-line-height / 2));
|
||||
left: calc(($icon-size /2) - ($icon-line-width / 2));
|
||||
}
|
||||
}
|
||||
|
||||
.icon-reduce {
|
||||
background-color: $my-red-color;
|
||||
|
||||
&::after {
|
||||
width: $icon-line-width;
|
||||
height: $icon-line-height;
|
||||
top: calc(($icon-size /2) - ($icon-line-height / 2));
|
||||
left: calc(($icon-size /2) - ($icon-line-width / 2));
|
||||
}
|
||||
}
|
||||
|
||||
.label-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
}
|
||||
|
||||
.lh40 {
|
||||
line-height: 40rpx;
|
||||
}
|
||||
|
||||
.box {
|
||||
font-size: 28rpx;
|
||||
|
||||
.block {
|
||||
background: #FFFFFF;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
padding: 12rpx 24rpx;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.save-btn-box {
|
||||
position: fixed;
|
||||
left: 30rpx;
|
||||
right: 30rpx;
|
||||
bottom: 60rpx;
|
||||
|
||||
}
|
||||
|
||||
::v-deep.uni-forms-item {
|
||||
align-items: inherit;
|
||||
}
|
||||
|
||||
::v-deep .uni-forms-item .uni-forms-item__label {
|
||||
text-indent: 0;
|
||||
font-size: 28rpx !important;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
::v-deep .border-top-0 .uni-forms-item.is-direction-top {
|
||||
border-color: transparent !important;
|
||||
}
|
||||
|
||||
.save-btn {
|
||||
background-color: $my-main-color;
|
||||
color: #fff;
|
||||
border-radius: 12rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.btn-hover-class {
|
||||
opacity: .6;
|
||||
}
|
||||
|
||||
.zuofa {
|
||||
padding: 28rpx 0;
|
||||
background: #F9F9F9;
|
||||
padding-left: 42rpx;
|
||||
border-radius: 14rpx 14rpx 14rpx 14rpx;
|
||||
}
|
||||
|
||||
::v-deep .uni-input-placeholder {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.option {
|
||||
padding: 26rpx 30rpx 24rpx 24rpx;
|
||||
background: #F9F9F9;
|
||||
}
|
||||
|
||||
.option-item {
|
||||
margin-bottom: 34rpx;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,213 @@
|
|||
<template>
|
||||
<view class="u-p-30 min-page">
|
||||
<view class="u-flex">
|
||||
<view style="width: 210rpx;">
|
||||
<my-button shape="circle" @click="addTimer">添加定时器</my-button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="list u-m-t-20" v-if="list.length">
|
||||
<view class="block" v-for="(item,index) in list" :key="index">
|
||||
<view class="u-flex u-row-between">
|
||||
<view>定时器{{index+1}}</view>
|
||||
<uni-icons @click="delTimer(index)" type="trash"></uni-icons>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-20 u-row-between">
|
||||
<view>周期</view>
|
||||
<view @click="selectAllClick(index)">全选</view>
|
||||
</view>
|
||||
<view class="u-m-t-20">
|
||||
<uni-data-checkbox multiple v-model="item.cycleChecked" :localdata="cycle"></uni-data-checkbox>
|
||||
</view>
|
||||
<view class="u-m-t-20">
|
||||
<view class="u-flex">
|
||||
<view>上架时间:</view>
|
||||
<view class="u-flex-1 u-m-l-10">
|
||||
<picker mode="multiSelector" @change="listingTimeChange($event,index)"
|
||||
:value="item.listingTime.index" :range="times">
|
||||
<view class="bg-gray u-p-l-20 u-p-t-6 u-p-b-6 u-p-r-20 ">
|
||||
{{item.listingTime.value}}
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-20">
|
||||
<view>下架时间:</view>
|
||||
<view class="u-flex-1 u-m-l-10">
|
||||
<picker mode="multiSelector" @change="offShelfChange($event,index)"
|
||||
:value="item.offShelf.index" :range="times">
|
||||
<view class="bg-gray u-p-l-20 u-p-t-6 u-p-b-6 u-p-r-20 ">
|
||||
{{item.offShelf.value}}
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="u-flex u-row-center u-m-t-60">
|
||||
<my-button width="580" shape="circle" @click="save">保存</my-button>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
onLoad,
|
||||
onReady
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
ref
|
||||
} from 'vue';
|
||||
import go from '@/commons/utils/go.js';
|
||||
import myButton from '@/components/my-components/my-button.vue'
|
||||
//返回一天的时间 时分格式
|
||||
function returnDayTime() {
|
||||
return new Array(2).fill(1).map((v, index) => {
|
||||
if (index === 0) {
|
||||
return new Array(24).fill(1).map((hour, index) => {
|
||||
return `0${index}`.slice(-2)
|
||||
})
|
||||
}
|
||||
if (index === 1) {
|
||||
return new Array(60).fill(1).map((hour, index) => {
|
||||
return `0${index}`.slice(-2)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
const times = ref(returnDayTime())
|
||||
let defaultTimeIndex = ref(0)
|
||||
|
||||
function getTime(indexArr) {
|
||||
const hour = times.value[0][indexArr[0]]
|
||||
const month = times.value[1][indexArr[1]]
|
||||
return `${hour}:${month}`
|
||||
}
|
||||
//获取$event.detail.value
|
||||
function getEnentDetailValue(e) {
|
||||
return e.detail.value
|
||||
}
|
||||
|
||||
function setListTimeValue(index, key, time) {
|
||||
list.value[index][key].value = time
|
||||
}
|
||||
|
||||
function listingTimeChange(e, index) {
|
||||
const indexArr = getEnentDetailValue(e)
|
||||
const time = getTime(indexArr)
|
||||
setListTimeValue(index, 'listingTime', time)
|
||||
}
|
||||
|
||||
function offShelfChange(e, index) {
|
||||
const indexArr = getEnentDetailValue(e)
|
||||
const time = getTime(indexArr)
|
||||
setListTimeValue(index, 'offShelf', time)
|
||||
}
|
||||
|
||||
|
||||
|
||||
const cycle = [{
|
||||
value: 0,
|
||||
text: '星期一'
|
||||
},
|
||||
{
|
||||
value: 1,
|
||||
text: '星期二'
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
text: '星期三'
|
||||
},
|
||||
{
|
||||
value: 3,
|
||||
text: '星期四'
|
||||
},
|
||||
{
|
||||
value: 4,
|
||||
text: '星期五'
|
||||
},
|
||||
{
|
||||
value: 5,
|
||||
text: '星期六'
|
||||
},
|
||||
{
|
||||
value: 6,
|
||||
text: '星期日'
|
||||
}
|
||||
]
|
||||
const ListDataconstructor = {
|
||||
cycleChecked: [0, 1, 2, 3, 4, 5, 6],
|
||||
}
|
||||
|
||||
function returnBasicTimeConstructor() {
|
||||
return {
|
||||
listingTime: {
|
||||
value: '09:00',
|
||||
index: [9, 0]
|
||||
},
|
||||
offShelf: {
|
||||
value: '18:00',
|
||||
index: [18, 0]
|
||||
}
|
||||
}
|
||||
}
|
||||
const list = ref([returnBasicDataConstructor()])
|
||||
function returnBasicDataConstructor() {
|
||||
return {
|
||||
...ListDataconstructor,
|
||||
...returnBasicTimeConstructor()
|
||||
}
|
||||
}
|
||||
|
||||
function addTimer() {
|
||||
list.value.push(returnBasicDataConstructor())
|
||||
}
|
||||
function delTimer(index) {
|
||||
list.value.splice(index,1)
|
||||
}
|
||||
function selectAllClick(index){
|
||||
list.value[index].cycleChecked=ListDataconstructor.cycleChecked
|
||||
}
|
||||
let index=null
|
||||
// 触发定时器保存事件将数据给到添加商品页面
|
||||
function emitTimerSave(){
|
||||
uni.$emit('timerSave',{
|
||||
data:list.value.map(v=>{
|
||||
return {
|
||||
...v,
|
||||
cycleChecked:v.cycleChecked.map(index=>{
|
||||
return {value:index,text:cycle[index].text}
|
||||
})
|
||||
}
|
||||
}),
|
||||
index:index
|
||||
})
|
||||
go.back()
|
||||
}
|
||||
function save(){
|
||||
console.log(list.value);
|
||||
emitTimerSave()
|
||||
}
|
||||
onLoad((opt)=>{
|
||||
index=opt.index
|
||||
const arr=uni.getStorageSync('timer')
|
||||
if(arr.length){
|
||||
list.value=arr
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.min-page {
|
||||
background-color: #F9F9F9;
|
||||
}
|
||||
|
||||
.block {
|
||||
background: #FFFFFF;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
padding: 30rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,231 @@
|
|||
<template>
|
||||
<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>
|
||||
</view>
|
||||
<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>
|
||||
<view class="u-flex">
|
||||
<view class="u-m-r-14 color-999">是否启用</view>
|
||||
<up-switch :activeValue="1" :inactiveValue="0" v-model="isShow" @change="isShowChange" :size="18"></up-switch>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-24 u-p-l-54 ">
|
||||
<view class="u-flex-1 u-flex">
|
||||
<view class="color-666">分组名</view>
|
||||
<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>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="u-m-t-24 u-flex u-row-right">
|
||||
<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 {
|
||||
ColorMain
|
||||
} from '@/commons/color.js'
|
||||
|
||||
const emits = defineEmits(['changeClick','edit', 'editName','editSort', 'del', 'isShowChange'])
|
||||
|
||||
const props = defineProps({
|
||||
index: {
|
||||
type: Number
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
isShow:true
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
let isShow = ref(props.data.isShow)
|
||||
|
||||
function isShowChange() {
|
||||
console.log(isShow.value);
|
||||
emits('isShowChange', {
|
||||
...props.data,
|
||||
isShow: isShow.value
|
||||
})
|
||||
}
|
||||
|
||||
let isSellNone = ref(true)
|
||||
isSellNone.value = props.isSellNone
|
||||
|
||||
function isSellNoneChange() {
|
||||
console.log(isSellNone.value);
|
||||
console.log('isSellNoneChange');
|
||||
}
|
||||
|
||||
let checked = ref(false)
|
||||
|
||||
function radioClick() {
|
||||
console.log(props.index);
|
||||
emits('radioClick', props.index)
|
||||
}
|
||||
|
||||
function changeClick() {
|
||||
emits('changeClick', props.index)
|
||||
}
|
||||
|
||||
function useTypeClick() {
|
||||
emits('useTypeClick', 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)
|
||||
// uni.setStorageSync('cateItem', props.data)
|
||||
// go.to('PAGES_CATEGORY_EDIT', {
|
||||
// type: 'edit',
|
||||
// })
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
$imgSize: 126rpx;
|
||||
$price-color: #F02C45;
|
||||
|
||||
.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-default {
|
||||
border-color: #999;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.price {
|
||||
color: $price-color;
|
||||
}
|
||||
|
||||
.h-100 {
|
||||
height: $imgSize;
|
||||
}
|
||||
|
||||
.img {
|
||||
width: $imgSize;
|
||||
height: $imgSize;
|
||||
}
|
||||
|
||||
.icon-arrow-right {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
|
||||
.stock {
|
||||
padding-right: 46rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.goods {
|
||||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||||
background-color: #fff;
|
||||
padding: 24rpx 28rpx 16rpx 28rpx;
|
||||
font-size: 28rpx;
|
||||
|
||||
.skus {
|
||||
background: #F9F9F9;
|
||||
border-radius: 14rpx 14rpx 14rpx 14rpx;
|
||||
padding: 28rpx 42rpx;
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.tag-primary {
|
||||
background-color: $my-main-color;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,128 @@
|
|||
<template>
|
||||
<up-popup :show="popShow" @close="close" @open="open" mode="center" :round="9">
|
||||
<view class="u-p-32 box u-font-28">
|
||||
<view class="u-flex u-relative u-row-center">
|
||||
<view class="u-font-32">编辑</view>
|
||||
<view class="u-absolute close">
|
||||
<up-icon @click="close" :size="16" color="#000" name="close-circle-fill"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-36">
|
||||
<view>修改排序:</view>
|
||||
<view class="u-m-t-38">
|
||||
<view class="u-m-b-32">
|
||||
<view class="u-m-t-16">
|
||||
<up-input v-model="sort">
|
||||
</up-input>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="u-m-t-60">
|
||||
<my-button type="primary" shape="circle" @tap="save">
|
||||
<view class="u-font-32">
|
||||
保存
|
||||
</view>
|
||||
</my-button>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
ref,
|
||||
watch,
|
||||
onMounted,
|
||||
computed
|
||||
} from 'vue';
|
||||
import {
|
||||
returnSkuSnap,
|
||||
returnTypeEnum,
|
||||
returnCategory
|
||||
} from '@/pageProduct/util.js'
|
||||
import {
|
||||
$tbShopUnit
|
||||
} from '@/http/yskApi/goods.js'
|
||||
const props = defineProps({
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
category: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
item: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
sort:''
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
function changeShowRecoders(show) {
|
||||
recoders.show = show
|
||||
}
|
||||
|
||||
const data = ref(props.item)
|
||||
const emits = defineEmits(['update:show', 'save'])
|
||||
const form = reactive({
|
||||
note: ''
|
||||
})
|
||||
let popShow = ref(props.show)
|
||||
let sort=ref('')
|
||||
|
||||
watch(()=>props.item.sort,(newval)=>{
|
||||
sort.value=newval
|
||||
})
|
||||
|
||||
watch(() => props.show, (newval) => {
|
||||
popShow.value = newval
|
||||
if (newval) {
|
||||
data.value = props.item
|
||||
}
|
||||
})
|
||||
const isSku = computed(() => {
|
||||
// return data.value.typeEnum == '多规格'
|
||||
return false
|
||||
})
|
||||
watch(() => popShow.value, (newval) => {
|
||||
emits('update:show', newval)
|
||||
})
|
||||
|
||||
function close() {
|
||||
popShow.value = false
|
||||
}
|
||||
|
||||
function open() {
|
||||
|
||||
}
|
||||
|
||||
function save() {
|
||||
emits('save', {
|
||||
...data.value,
|
||||
sort:sort.value
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.box {
|
||||
width: 556rpx;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.close {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.number {
|
||||
color: #EE4646;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,128 @@
|
|||
<template>
|
||||
<up-popup :show="popShow" @close="close" @open="open" mode="center" :round="9">
|
||||
<view class="u-p-32 box u-font-28">
|
||||
<view class="u-flex u-relative u-row-center">
|
||||
<view class="u-font-32">编辑</view>
|
||||
<view class="u-absolute close">
|
||||
<up-icon @click="close" :size="16" color="#000" name="close-circle-fill"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-36">
|
||||
<view>修改排序:</view>
|
||||
<view class="u-m-t-38">
|
||||
<view class="u-m-b-32">
|
||||
<view class="u-m-t-16">
|
||||
<up-input v-model="sort">
|
||||
</up-input>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="u-m-t-60">
|
||||
<my-button type="primary" shape="circle" @tap="save">
|
||||
<view class="u-font-32">
|
||||
保存
|
||||
</view>
|
||||
</my-button>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
ref,
|
||||
watch,
|
||||
onMounted,
|
||||
computed
|
||||
} from 'vue';
|
||||
import {
|
||||
returnSkuSnap,
|
||||
returnTypeEnum,
|
||||
returnCategory
|
||||
} from '@/pageProduct/util.js'
|
||||
import {
|
||||
$tbShopUnit
|
||||
} from '@/http/yskApi/goods.js'
|
||||
const props = defineProps({
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
category: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
item: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
sort:''
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
function changeShowRecoders(show) {
|
||||
recoders.show = show
|
||||
}
|
||||
|
||||
const data = ref(props.item)
|
||||
const emits = defineEmits(['update:show', 'save'])
|
||||
const form = reactive({
|
||||
note: ''
|
||||
})
|
||||
let popShow = ref(props.show)
|
||||
let sort=ref('')
|
||||
|
||||
watch(()=>props.item.sort,(newval)=>{
|
||||
sort.value=newval
|
||||
})
|
||||
|
||||
watch(() => props.show, (newval) => {
|
||||
popShow.value = newval
|
||||
if (newval) {
|
||||
data.value = props.item
|
||||
}
|
||||
})
|
||||
const isSku = computed(() => {
|
||||
// return data.value.typeEnum == '多规格'
|
||||
return false
|
||||
})
|
||||
watch(() => popShow.value, (newval) => {
|
||||
emits('update:show', newval)
|
||||
})
|
||||
|
||||
function close() {
|
||||
popShow.value = false
|
||||
}
|
||||
|
||||
function open() {
|
||||
|
||||
}
|
||||
|
||||
function save() {
|
||||
emits('save', {
|
||||
...data.value,
|
||||
sort:sort.value
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.box {
|
||||
width: 556rpx;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.close {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.number {
|
||||
color: #EE4646;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,483 @@
|
|||
<template>
|
||||
<view class="safe-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="categoryDel" @useTypeClick="categoryUseTypeClick"
|
||||
@editSort="popupShow($event,'sort',true)" @edit="actionsShow" @radioClick="goodsRadioClick"
|
||||
@isShowChange="isSHowChange" :index="index" :data="item" :showChecked="showChecked"
|
||||
:showDetail="pageData.showGoodsDetail"></my-category>
|
||||
</view>
|
||||
<view class="u-m-t-44">
|
||||
<my-pagination :size="pageData.query.size" :totalElements="pageData.totalElements"
|
||||
@change="pageChange"></my-pagination>
|
||||
<view style="height: 200rpx;"></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 删除弹窗 -->
|
||||
<my-model desc="请确保此分类下没有任何商品确认删除?" ref="delModel" @confirm="delModelConfirm"></my-model>
|
||||
<view class="fixed-b">
|
||||
<my-button :height="80" shape="circle" showShadow @tap="toAddCategory">新建分组</my-button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<edit-sort @save="updataGroup" :item="popup.selData" v-model:show="popup.sort.show"></edit-sort>
|
||||
|
||||
<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,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
onShow
|
||||
} from '@dcloudio/uni-app'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import myCategory from './components/category.vue'
|
||||
import infoBox from "@/commons/utils/infoBox.js"
|
||||
import editSort from './components/edit-sort.vue';
|
||||
import {
|
||||
tbProductGroupGet,
|
||||
tbProductGroupDelete,
|
||||
tbProductGroupPut,
|
||||
upGroupSort,
|
||||
tbProductGroupPost
|
||||
} from '@/http/yskApi/shop.js'
|
||||
const $productCategory = {
|
||||
add: tbProductGroupPost,
|
||||
del: tbProductGroupDelete,
|
||||
update: tbProductGroupPut,
|
||||
get: tbProductGroupGet
|
||||
}
|
||||
const actions = reactive({
|
||||
list: [{
|
||||
name: '排序',
|
||||
color: '#333',
|
||||
fontSize: '16'
|
||||
}, {
|
||||
name: '管理商品',
|
||||
color: '#333',
|
||||
fontSize: '16'
|
||||
}],
|
||||
show: false,
|
||||
})
|
||||
|
||||
function actionSelect(e) {
|
||||
console.log(e);
|
||||
if (e.name == '排序') {
|
||||
return popupShow(actions.selIndex, 'sort', true)
|
||||
}
|
||||
if (e.name == '管理商品') {
|
||||
const {id,isShow,name,sort}=actions.selData
|
||||
return go.to('PAGES_GOODS_GROUP_EDIT_GOODS', {
|
||||
id,isShow,name,sort
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function actionsHide() {
|
||||
actions.show = false
|
||||
}
|
||||
|
||||
function actionsShow(e) {
|
||||
console.log(e);
|
||||
actions.selData = pageData.list[e]
|
||||
actions.selIndex = e
|
||||
actions.show = true
|
||||
}
|
||||
|
||||
|
||||
const popup = reactive({
|
||||
selIndex: -1,
|
||||
selData: {
|
||||
sort: ''
|
||||
},
|
||||
sort: {
|
||||
show: false
|
||||
}
|
||||
})
|
||||
|
||||
function popupShow(e, key, show) {
|
||||
popup.selData = pageData.list[e]
|
||||
popup.selIndex = e
|
||||
popup[key].show = show
|
||||
}
|
||||
async function updataGroup(e) {
|
||||
console.log(e);
|
||||
const res = await $productCategory.update(e)
|
||||
popup.sort.show = false;
|
||||
pageData.list[popup.selIndex] = e
|
||||
infoBox.showToast('更新成功')
|
||||
}
|
||||
const tabsList = ['简洁', '详情']
|
||||
const statesTabsList = ['在售中', '已下架']
|
||||
const states1TabsList = ['全部', '已售罄']
|
||||
const control = ref(null)
|
||||
const delModel = ref(null)
|
||||
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
|
||||
}
|
||||
]
|
||||
})
|
||||
const pageData = reactive({
|
||||
stateCurrent: 0,
|
||||
stateCurrent1: 0,
|
||||
componentBottom: 264,
|
||||
search: {
|
||||
value: '',
|
||||
placeholder: '输入搜索的商品'
|
||||
},
|
||||
showGoodsDetail: false,
|
||||
query: {
|
||||
page: 0,
|
||||
size: 10,
|
||||
sort: 'id',
|
||||
shopId: uni.getStorageSync('shopId')
|
||||
},
|
||||
totalElements: 0,
|
||||
list: [],
|
||||
selCategory: ''
|
||||
})
|
||||
|
||||
async function init() {
|
||||
const res = await $productCategory.get(pageData.query)
|
||||
pageData.list = res.content
|
||||
pageData.totalElements = res.totalElements
|
||||
}
|
||||
onShow(() => {
|
||||
init()
|
||||
})
|
||||
|
||||
function toAddCategory() {
|
||||
go.to('PAGES_GOODS_GROUP_EDIT', {
|
||||
type: 'add'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
function goodsSortModelCancel() {
|
||||
console.log('goodsSortModelCancel');
|
||||
goodsSortModel.value.close()
|
||||
}
|
||||
async function goodsSortModelSave() {
|
||||
console.log('goodsSortModelSave');
|
||||
|
||||
const res = await $productCategory.update({
|
||||
...pageData.selCategory,
|
||||
sort: sort.value
|
||||
})
|
||||
infoBox.showToast('修改成功')
|
||||
goodsSortModelCancel()
|
||||
init()
|
||||
}
|
||||
|
||||
async function isSHowChange(data) {
|
||||
const res = await $productCategory.update({
|
||||
...data
|
||||
})
|
||||
infoBox.showToast('修改成功')
|
||||
// init()
|
||||
}
|
||||
|
||||
function categoryUseTypeClick(index) {
|
||||
goodsTypeModelData.index = index
|
||||
// goodsTypeModelData.useTypes=pageData.list[index].useTypes
|
||||
const cateItem = pageData.list[index]
|
||||
console.log(cateItem);
|
||||
goodsTypeModelData.selCategory = cateItem
|
||||
goodsTypeModelData.title = cateItem.name
|
||||
goodsTypeModel.value.open()
|
||||
}
|
||||
|
||||
|
||||
//点击修改按钮弹出修改商品弹窗
|
||||
function goodsChangeClick(index) {
|
||||
console.log(index);
|
||||
const goods = pageData.list[index]
|
||||
sort.value = goods.sort
|
||||
pageData.selCategory = goods
|
||||
goodsSortModel.value.open()
|
||||
}
|
||||
|
||||
function statesTableClick(index) {
|
||||
pageData.stateCurrent = index
|
||||
}
|
||||
|
||||
function states1TableClick(index) {
|
||||
pageData.stateCurrent1 = index
|
||||
}
|
||||
|
||||
let test = ref(false)
|
||||
|
||||
function tabsChange(i) {
|
||||
console.log(i);
|
||||
pageData.showGoodsDetail = i ? true : false
|
||||
}
|
||||
|
||||
|
||||
//改变商品的选中状态
|
||||
function changeGoodsChecked(checked, index) {
|
||||
if (index !== undefined) {
|
||||
pageData.list[index].checked = checked
|
||||
} else {
|
||||
pageData.list.map(v => {
|
||||
v.checked = checked
|
||||
})
|
||||
}
|
||||
control.value.setisSelectAll(isAllChecked() ? true : false)
|
||||
}
|
||||
|
||||
|
||||
// 获取已经选中的商品
|
||||
function getChechkedlist() {
|
||||
return pageData.list.filter(v => v.checked)
|
||||
}
|
||||
//是否全部选中
|
||||
function isAllChecked() {
|
||||
return getChechkedlist().length === pageData.list.length
|
||||
}
|
||||
// 是否有商品选中
|
||||
function isHasChekdGoods() {
|
||||
return getChechkedlist().length ? true : false
|
||||
}
|
||||
|
||||
function searchFunc() {
|
||||
console.log('searchFunc');
|
||||
}
|
||||
|
||||
let showChecked = ref(false)
|
||||
|
||||
//商品start
|
||||
|
||||
function goodsRadioClick(index) {
|
||||
var checked = !pageData.list[index].checked
|
||||
changeGoodsChecked(checked, index)
|
||||
}
|
||||
|
||||
|
||||
//下架
|
||||
function offShelf() {
|
||||
const hasCheckedArr = getChechkedlist()
|
||||
const hasChecked = isHasChekdGoods()
|
||||
if (!hasChecked) {
|
||||
return infoBox.showToast('您还没有选中商品!')
|
||||
}
|
||||
model.value.open()
|
||||
}
|
||||
let nowCateIndex = null
|
||||
|
||||
function categoryDel(index) {
|
||||
// nowCateIndex=index
|
||||
// delModel.value.open()
|
||||
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '请确保此分类下没有任何商品确认删除?',
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
const islast = pageData.list.length === 1
|
||||
$productCategory.del([pageData.list[index].id]).then(res => {
|
||||
infoBox.showToast('删除成功')
|
||||
// if(islast&&pageData.query.page>=1){
|
||||
// pageData.query.page--
|
||||
// }
|
||||
init()
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
fail: () => {},
|
||||
complete: () => {}
|
||||
});
|
||||
}
|
||||
//删除分类确认
|
||||
function delModelConfirm() {
|
||||
console.log('confirm');
|
||||
pageData.list.splice(nowCateIndex, 1)
|
||||
delModel.value.close()
|
||||
}
|
||||
|
||||
//商品end
|
||||
|
||||
//控制条
|
||||
function controlChange(bol) {
|
||||
console.log(bol);
|
||||
showChecked.value = bol
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 全选
|
||||
function allCheckedChange(checked) {
|
||||
changeGoodsChecked(checked)
|
||||
}
|
||||
|
||||
// 页数改变事件
|
||||
function pageChange(page) {
|
||||
pageData.query.page = page - 1
|
||||
init()
|
||||
}
|
||||
|
||||
|
||||
//分类
|
||||
const category = ref(null)
|
||||
|
||||
function toggleCategory() {
|
||||
category.value.toggle()
|
||||
}
|
||||
|
||||
function cateClick(cate) {
|
||||
console.log(cate);
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
page {
|
||||
background: #F9F9F9;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
.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;
|
||||
align-items: center;
|
||||
height: 64rpx;
|
||||
|
||||
image {
|
||||
padding: 22rpx;
|
||||
width: 26rpx;
|
||||
height: 26rpx;
|
||||
}
|
||||
|
||||
input {
|
||||
flex: 1;
|
||||
font-size: 27rpx;
|
||||
}
|
||||
|
||||
::v-deep uni-button {
|
||||
font-size: 28rpx;
|
||||
color: $my-main-color;
|
||||
background: rgba(255, 255, 255, 1);
|
||||
}
|
||||
|
||||
::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-placeholder {
|
||||
font-size: 27rpx;
|
||||
}
|
||||
|
||||
.uni-icons {
|
||||
color: rgba(230, 230, 230, 1) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.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>
|
||||
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="11.864" height="11.592" viewBox="0 0 11.864 11.592"><defs><style>.a{fill:#64a7fe;}</style></defs><path class="a" d="M79.676,85.867H68.721a.409.409,0,0,0,0,.818h11a.407.407,0,0,0,.409-.409.534.534,0,0,0-.455-.409Zm-11-1.227H70.63A.324.324,0,0,0,70.9,84.5l6.728-6.728a.388.388,0,0,0,0-.591L75.722,75.23a.388.388,0,0,0-.591,0l-1.364,1.364L68.4,81.957a.393.393,0,0,0-.136.273v1.955a.491.491,0,0,0,.136.318.324.324,0,0,0,.273.136ZM75.4,76.093l1.364,1.364-.773.773-1.364-1.364ZM69.13,82.412l4.955-4.955,1.364,1.364-4.955,4.955H69.13Z" transform="translate(-68.267 -75.093)"/></svg>
|
||||
|
After Width: | Height: | Size: 622 B |
|
|
@ -76,12 +76,12 @@
|
|||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
* {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
text-decoration: none;
|
||||
outline: none;
|
||||
}
|
||||
// * {
|
||||
// padding: 0;
|
||||
// margin: 0;
|
||||
// text-decoration: none;
|
||||
// outline: none;
|
||||
// }
|
||||
|
||||
ul,
|
||||
li {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
<template>
|
||||
<view class="u-p-30 safe-page">
|
||||
<up-sticky v-if="option.type==='edit'" offset-top="20" zIndex="99">
|
||||
<myTabs :list="tabsList" v-model="tabsCurrent"></myTabs>
|
||||
<myTabs :list="tabsList" v-model="tabsCurrent"></myTabs>
|
||||
</up-sticky>
|
||||
|
||||
<view class="box">
|
||||
<template v-if="tabsCurrent===0">
|
||||
<view class="basic">
|
||||
|
|
@ -11,20 +10,13 @@
|
|||
err-show-type="toast" validateTrigger="submit" label-width="350" ref="Forms">
|
||||
<view class="block">
|
||||
<uni-forms-item label="商品类型" required showRequired>
|
||||
<up-radio-group
|
||||
:disabled="option.type=='edit'"
|
||||
v-model="FormData.typeEnum"
|
||||
placement="row"
|
||||
>
|
||||
<up-radio
|
||||
:customStyle="{marginRight: '30px'}"
|
||||
v-for="(item, index) in pageData.types"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:name="item.value"
|
||||
>
|
||||
</up-radio>
|
||||
</up-radio-group>
|
||||
<up-radio-group :disabled="option.type=='edit'" v-model="FormData.typeEnum"
|
||||
placement="row">
|
||||
<up-radio :customStyle="{marginRight: '30px'}"
|
||||
v-for="(item, index) in pageData.types" :key="index" :label="item.name"
|
||||
:name="item.value">
|
||||
</up-radio>
|
||||
</up-radio-group>
|
||||
<!-- <view class="u-flex u-flex-wrap types " :class="{disabled:option.productId!==''}">
|
||||
<view class="item" @tap="changeFormData('typeEnum',item.value)"
|
||||
:class="{active:FormData.typeEnum===item.value}"
|
||||
|
|
@ -37,7 +29,7 @@
|
|||
</view> -->
|
||||
|
||||
</uni-forms-item>
|
||||
<uni-forms-item ref="fileItem" label="图片">
|
||||
<uni-forms-item ref="fileItem" label="图片" required showRequired>
|
||||
<my-upload-file ref="refFile" :images="FormData.images"></my-upload-file>
|
||||
<view class="u-m-t-16 color-999 u-font-24">
|
||||
注:第一张图为商品封面图,图片尺寸为750x750
|
||||
|
|
@ -63,17 +55,6 @@
|
|||
</uni-forms-item>
|
||||
</view>
|
||||
|
||||
<!-- <uni-forms-item label="商品详情" required>
|
||||
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||
type="textarea" v-model="FormData.goodsDetail" placeholder="请填写商品详情" />
|
||||
</uni-forms-item> -->
|
||||
|
||||
<!-- <view class="">
|
||||
<uni-forms-item label="规格模式" required>
|
||||
<uni-data-checkbox v-model="FormData.specificationsPattern"
|
||||
:localdata="specificationMode" />
|
||||
</uni-forms-item>
|
||||
</view> -->
|
||||
<view class="border-top-0">
|
||||
<uni-forms-item label="单位" required showRequired name="categoryId">
|
||||
|
||||
|
|
@ -84,7 +65,7 @@
|
|||
</uni-forms-item>
|
||||
</view>
|
||||
|
||||
<template v-if="FormData.typeEnum==='group'">
|
||||
<template v-if="FormData.typeEnum==='group'">
|
||||
<view class="border-top-0">
|
||||
<uni-forms-item label="团购券分类" required showRequired name="categoryId">
|
||||
<view class="u-p-30 bg-gray u-m-b-20" v-if="FormData.groupCategoryId.length">
|
||||
|
|
@ -118,179 +99,29 @@
|
|||
<choose-group-category @confirm="refChooseCouponCategoryConfirm"
|
||||
ref="refChooseGroupCategory"></choose-group-category>
|
||||
</template>
|
||||
|
||||
|
||||
<!-- <view class="">
|
||||
<uni-forms-item label=" " required>
|
||||
<view class="u-flex u-row-between zuofa" @tap="toGuige ">
|
||||
<view class="color-333">{{returnSpecificationsGroup }}</view>
|
||||
<uni-icons type="right"></uni-icons>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</view> -->
|
||||
|
||||
|
||||
<!-- <uni-forms-item label="底价(元)" name="floorPrice" required>
|
||||
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||
:inputBorder="inputBorder" v-model="FormData.floorPrice" placeholder="请输入底价(元)" />
|
||||
</uni-forms-item> -->
|
||||
<!-- <uni-forms-item label="售卖方式" required>
|
||||
<view style="display: none;"><uni-easyinput :paddingNone="inputPaddingNone"
|
||||
:inputBorder="inputBorder" v-model="FormData.salesMethod"
|
||||
placeholder="请选择售卖方式" />
|
||||
</view>
|
||||
<picker @change="salesMethodChange" :value="salesMethod.defaultIndex"
|
||||
:range="salesMethod.list">
|
||||
<view class="u-flex u-row-between lh40" v-if="FormData.salesMethod===0">
|
||||
<view class="color-333">{{salesMethod.list[FormData.salesMethod]||'售卖方式'}}
|
||||
</view>
|
||||
<uni-icons type="right"></uni-icons>
|
||||
</view>
|
||||
<view class="u-flex u-row-between lh40" v-if="FormData.salesMethod===1">
|
||||
<view class="u-flex">
|
||||
<text
|
||||
class="color-333">{{salesMethod.list[FormData.salesMethod]||'售卖方式'}}</text>
|
||||
<view class="u-flex color-999">
|
||||
<text>(</text>
|
||||
<text class="color-red">*</text>
|
||||
<text class="u-font-24">注意:预售商品不支持堂食</text>
|
||||
<text>)</text>
|
||||
</view>
|
||||
</view>
|
||||
<uni-icons type="right"></uni-icons>
|
||||
</view>
|
||||
<view class="u-flex u-row-between lh40" v-if="FormData.salesMethod===2">
|
||||
<view class="u-flex">
|
||||
<text
|
||||
class="color-333">{{salesMethod.list[FormData.salesMethod]||'售卖方式'}}</text>
|
||||
<view class="u-flex color-999">
|
||||
<text>(</text>
|
||||
<text class="color-red">*</text>
|
||||
<text class="u-font-24">注意:该商品仅作展示,无法进行下单</text>
|
||||
<text>)</text>
|
||||
</view>
|
||||
</view>
|
||||
<uni-icons type="right"></uni-icons>
|
||||
</view>
|
||||
</picker>
|
||||
</uni-forms-item> -->
|
||||
<!-- <template v-if="FormData.salesMethod==1">
|
||||
<view class="bg-gray border-top-0">
|
||||
<uni-forms-item label="交货时间" required>
|
||||
<radio-group @change="DeliveryTimeChange">
|
||||
<label class="u-flex " :class="{
|
||||
'u-m-b-40':index===0
|
||||
}" v-for="(item, index) in DeliveryTime" :key="item.value">
|
||||
<view>
|
||||
<radio :color="ColorMain" :value="item.value"
|
||||
:checked="index === DeliveryTimeCurrent" />
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
<template v-if="index===0">
|
||||
<uni-datetime-picker v-model="FormData.startTime"
|
||||
:hide-second="true" :end="limitDayTime">
|
||||
<view class="u-flex u-row-between">
|
||||
<view>
|
||||
<text></text>
|
||||
<text
|
||||
class="color-999">{{FormData.startTime||'选择开始时间'}}</text>
|
||||
</view>
|
||||
<uni-icons type="right" color="#999"></uni-icons>
|
||||
</view>
|
||||
</uni-datetime-picker>
|
||||
|
||||
</template>
|
||||
<template v-if="index===1">
|
||||
<view class="u-flex ">
|
||||
<view>
|
||||
付款成功
|
||||
</view>
|
||||
<uni-easyinput :paddingNone="inputPaddingNone"
|
||||
:placeholderStyle="placeholderStyle"
|
||||
:inputBorder="false"
|
||||
v-model="FormData.paySuccessAfterDay" type="number"
|
||||
placeholder="请填写天数" />
|
||||
|
||||
|
||||
<view>
|
||||
天后交货
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
</label>
|
||||
</radio-group>
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<view class="color-999 u-font-24 u-m-t-20 u-p-b-30">
|
||||
<text class="color-red">*</text> 注意: 只允许设置{{limitDay}}天内的发货时间,请务必按照约定时间发货以免引起客户投诉
|
||||
</view>
|
||||
<view class="">
|
||||
<uni-forms-item label="" required>
|
||||
<slot name="label">
|
||||
<view class="class">
|
||||
<text class="label-title u-m-r-6">预售可预约天数</text>
|
||||
<uni-icons @click="showModel('help')" color="#999"
|
||||
type="help"></uni-icons>
|
||||
</view>
|
||||
</slot>
|
||||
<view class="u-flex">
|
||||
<uni-easyinput :paddingNone="inputPaddingNone" :min="1" :max="15"
|
||||
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
v-model="FormData.discountPrice" type="number" placeholder="填写天数" />
|
||||
<text>天</text>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
</template> -->
|
||||
<!-- <uni-forms-item label="" required>
|
||||
<view class="u-flex u-row-between lh40">
|
||||
<view class="label-title">库存</view>
|
||||
<my-switch v-model="FormData.isStock"></my-switch>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<view class="border-top-0 none-label" v-if="FormData.isStock">
|
||||
<uni-forms-item label="" required>
|
||||
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||
:inputBorder="inputBorder" v-model="FormData.stockNumber" type="number"
|
||||
placeholder="请填写库存" />
|
||||
</uni-forms-item>
|
||||
</view> -->
|
||||
|
||||
</view>
|
||||
|
||||
<template v-if="FormData.typeEnum==='sku' ">
|
||||
<!-- <view class="block border-top-0">
|
||||
<uni-forms-item label="选择规格" required name="categoryId">
|
||||
|
||||
<uni-data-picker :clear-icon="false" @change="specIdChange"
|
||||
:map="{text:'name',value:'id'}" placeholder="请选择规格" popup-title="请选择规格"
|
||||
:localdata="pageData.specList" v-model="FormData.specId">
|
||||
</uni-data-picker>
|
||||
</uni-forms-item>
|
||||
</view> -->
|
||||
<template v-if="FormData.typeEnum=='sku' ">
|
||||
<view class="block border-top-0">
|
||||
<uni-forms-item label=" ">
|
||||
<view class="u-flex u-row-between " @tap="toGuige">
|
||||
<view class="color-333 font-bold">
|
||||
<text v-if="!skuList.length">选择规格</text>
|
||||
<text v-if="!skuList.list.length">选择规格</text>
|
||||
<text v-else>编辑规格</text>
|
||||
</view>
|
||||
<uni-icons type="right"></uni-icons>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<template v-if="skuList.length">
|
||||
<template v-if="skuList.list.length">
|
||||
<view class="u-text-center">
|
||||
<view class="u-flex font-bold u-m-b-12">
|
||||
<view class="u-flex-1">组合名称</view>
|
||||
<view class="u-flex-1">售价</view>
|
||||
<view class="u-flex-1">库存数量</view>
|
||||
</view>
|
||||
<view class="u-flex u-p-b-12 u-p-t-12" v-for="(item,index) in skuList"
|
||||
<view class="u-flex u-p-b-12 u-p-t-12" v-for="(item,index) in skuList.list"
|
||||
:key="index">
|
||||
<view class="u-flex-1">{{item.specSnap}}</view>
|
||||
<view class="u-flex-1">{{item.salePrice}}</view>
|
||||
<view class="u-flex-1">¥{{item.salePrice}}</view>
|
||||
<view class="u-flex-1">{{item.stockNumber}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -374,9 +205,9 @@
|
|||
</view>
|
||||
</template>
|
||||
|
||||
<template v-if="FormData.typeEnum!=='sku'">
|
||||
<template v-if="FormData.typeEnum!='sku'">
|
||||
<view class="u-m-t-32 u-font-32 u-m-l-10 u-m-b-32">规格属性</view>
|
||||
<view class="block" v-for="(sku,index) in skuList" :key="index">
|
||||
<view class="block" v-for="(sku,index) in skuList.list" :key="index">
|
||||
<view class="border-top-0">
|
||||
<uni-forms-item label="售价">
|
||||
<uni-easyinput :paddingNone="inputPaddingNone"
|
||||
|
|
@ -392,7 +223,7 @@
|
|||
:inputBorder="inputBorder" v-model="sku.memberPrice" type="digit"
|
||||
placeholder="请输入会员价(元)" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="成本价(元)">
|
||||
<!-- <uni-forms-item label="成本价(元)">
|
||||
<uni-easyinput @blur="priceFormat(sku,'costPrice')" :paddingNone="inputPaddingNone"
|
||||
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
v-model="sku.costPrice" type="digit" placeholder="请输入成本价(元)" />
|
||||
|
|
@ -402,7 +233,7 @@
|
|||
:paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||
:inputBorder="inputBorder" v-model="sku.originPrice" type="digit"
|
||||
placeholder="请输入原价(元)" />
|
||||
</uni-forms-item>
|
||||
</uni-forms-item> -->
|
||||
<uni-forms-item label="起售数量">
|
||||
<uni-easyinput @blur="priceFormat(sku,'suit')" :paddingNone="inputPaddingNone"
|
||||
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
|
|
@ -598,138 +429,11 @@
|
|||
</template>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- <view class="block">
|
||||
<view class="border-top-0">
|
||||
<uni-forms-item label="" required>
|
||||
<view class="u-flex u-row-between lh40">
|
||||
<view class="label-title">打折设置</view>
|
||||
<my-switch v-model="FormData.openDiscount"
|
||||
@change="openDiscountChange"></my-switch>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<view class="border-top-0 none-label" v-if="FormData.openDiscount">
|
||||
<uni-forms-item label="" required>
|
||||
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||
:inputBorder="inputBorder" v-model="FormData.discountPrice" type="digit"
|
||||
placeholder="请填写折后价" />
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<uni-forms-item label="" required>
|
||||
<view class="u-flex u-row-between lh40">
|
||||
<view class="label-title">不参与会员折扣</view>
|
||||
<my-switch v-model="FormData.isVipDiscount"></my-switch>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="会员价(元)" required>
|
||||
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||
:inputBorder="inputBorder" v-model="FormData.vipPrice" type="digit"
|
||||
placeholder="请输入会员价(元)" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="包装费(元)" required>
|
||||
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||
:inputBorder="inputBorder" v-model="FormData.packagingFee" type="digit"
|
||||
placeholder="请输入包装费(元)" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="重量(千克)" required>
|
||||
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||
:inputBorder="inputBorder" v-model="FormData.weight" type="digit"
|
||||
placeholder="请输入重量(千克)" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="赠送积分" required>
|
||||
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||
:inputBorder="inputBorder" v-model="FormData.integral" type="digit"
|
||||
placeholder="请输入赠送积分" />
|
||||
</uni-forms-item>
|
||||
|
||||
</view> -->
|
||||
|
||||
<!-- <view class="block">
|
||||
<view class="border-top-0 ">
|
||||
<uni-forms-item label="" required>
|
||||
<view class="u-flex u-row-between lh40">
|
||||
<view class="label-title">每日销量上限</view>
|
||||
<my-switch v-model="FormData.openDailySalesLimit"></my-switch>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<view class="border-top-0 none-label" v-if="FormData.openDailySalesLimit">
|
||||
<uni-forms-item label="" required>
|
||||
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||
:inputBorder="inputBorder" v-model="FormData.dailySalesLimit" type="digit"
|
||||
placeholder="请填写每日销量上限" />
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<uni-forms-item label="" required>
|
||||
<view class="u-flex u-row-between lh40">
|
||||
<view class="label-title">每单限购</view>
|
||||
<my-switch v-model="FormData.openOrderBuyLimit"></my-switch>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<view class="border-top-0 none-label" v-if="FormData.openOrderBuyLimit">
|
||||
<uni-forms-item label="" required>
|
||||
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||
:inputBorder="inputBorder" v-model="FormData.orderBuyLimit" type="digit"
|
||||
placeholder="请填写每单限购" />
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<uni-forms-item label="" required>
|
||||
<view class="u-flex u-row-between lh40">
|
||||
<view class="label-title">每人限购</view>
|
||||
<my-switch v-model="FormData.openEveryoneBuyLimit"></my-switch>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<view class="border-top-0 none-label" v-if="FormData.openEveryoneBuyLimit">
|
||||
<uni-forms-item label="" required>
|
||||
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||
:inputBorder="inputBorder" v-model="FormData.everyoneBuyLimit" type="digit"
|
||||
placeholder="请填写每人限购" />
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<uni-forms-item label="最低起售(件)" required>
|
||||
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||
:inputBorder="inputBorder" v-model="FormData.minBuyLimit" type="number"
|
||||
placeholder="请输入最低起售(件)" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="包装费(元)" required>
|
||||
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||
:inputBorder="inputBorder" v-model="FormData.packagingFee" type="digit"
|
||||
placeholder="请输入包装费(元)" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="">
|
||||
<view class="u-flex u-row-between" @tap="toTimerPage">
|
||||
<view>
|
||||
<view class="label-title">定时上下架</view>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<view class="color-666">{{returnTimerText()}}</view>
|
||||
<uni-icons type="right"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
|
||||
<uni-forms-item label="虚拟销量" required>
|
||||
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||
:inputBorder="inputBorder" v-model="FormData.virtualSales" type="number"
|
||||
placeholder="虚拟销量" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="" required>
|
||||
<view class="u-flex u-row-between lh40">
|
||||
<view class="label-title">设为推荐</view>
|
||||
<my-switch v-model="FormData.isRecommend"></my-switch>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
|
||||
</view> -->
|
||||
|
||||
</uni-forms>
|
||||
<view style="height: 200rpx;"></view>
|
||||
<view style="padding-left: 110rpx;padding-right: 110rpx;" class="u-m-t-20" v-if="option.type==='edit'" @click="delModelShow">
|
||||
<my-button bgColor="#F9F9F9" shape="circle" type="cancel" >
|
||||
<view style="padding-left: 110rpx;padding-right: 110rpx;" class="u-m-t-20"
|
||||
v-if="option.type==='edit'" @click="delModelShow">
|
||||
<my-button bgColor="#F9F9F9" shape="circle" type="cancel">
|
||||
<view class="color-red">删除该商品</view>
|
||||
</my-button>
|
||||
</view>
|
||||
|
|
@ -737,18 +441,13 @@
|
|||
<view class="save-btn-box">
|
||||
<my-button shape="circle" @tap="save">保存</my-button>
|
||||
</view>
|
||||
<!-- <view class="u-m-t-20" v-if="option.type==='edit'" @click="delModelShow">
|
||||
<my-button bgColor="#fff" shape="circle" type="cancel" >
|
||||
<view class="color-red">删除该商品</view>
|
||||
</my-button>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<template v-if="tabsCurrent===1">
|
||||
<edit-haocai :goods="FormData" @cancel="changeTabsCurrent(0)"></edit-haocai>
|
||||
<edit-haocai @updateGoods="updateGoodsDetail" :goods="FormData" @cancel="changeTabsCurrent(0)"></edit-haocai>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
|
|
@ -762,15 +461,16 @@
|
|||
</template>
|
||||
</my-model>
|
||||
|
||||
|
||||
|
||||
<!-- 删除弹窗 -->
|
||||
<my-model @confirm="delmodelConfirm" ref="delModel" desc="确认删除">
|
||||
</my-model>
|
||||
<!-- 选择商品 -->
|
||||
<choose-goods ref="refChooseGoods" @confirm="refChooseGoodsConfirm" :category="pageData.category"></choose-goods>
|
||||
<!-- 更多操作 -->
|
||||
<my-action-sheet @itemClick="actionSheetClick" ref="refMoreSheet" :list="actionSheet.list"></my-action-sheet>
|
||||
|
||||
|
||||
<!-- 删除弹窗 -->
|
||||
<my-model @confirm="delmodelConfirm" ref="delModel" desc="确认删除">
|
||||
</my-model>
|
||||
<!-- 选择商品 -->
|
||||
<choose-goods ref="refChooseGoods" @confirm="refChooseGoodsConfirm"
|
||||
:category="pageData.category"></choose-goods>
|
||||
<!-- 更多操作 -->
|
||||
<my-action-sheet @itemClick="actionSheetClick" ref="refMoreSheet" :list="actionSheet.list"></my-action-sheet>
|
||||
</view>
|
||||
|
||||
|
||||
|
|
@ -798,7 +498,7 @@
|
|||
import myButton from '@/components/my-components/my-button'
|
||||
import mySwitch from '@/components/my-components/my-switch.vue'
|
||||
import infoBox from "@/commons/utils/infoBox.js"
|
||||
|
||||
|
||||
import {
|
||||
$types,
|
||||
$defaultSku
|
||||
|
|
@ -1146,11 +846,12 @@
|
|||
|
||||
const tabsList = ['基础设置', '耗材绑定']
|
||||
let tabsCurrent = ref(0)
|
||||
function changeTabsCurrent(newval){
|
||||
tabsCurrent.value=newval
|
||||
|
||||
function changeTabsCurrent(newval) {
|
||||
tabsCurrent.value = newval
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const Forms = ref(null)
|
||||
|
||||
|
||||
|
|
@ -1253,10 +954,15 @@
|
|||
usageRules: ""
|
||||
}
|
||||
})
|
||||
const skuList = reactive([{
|
||||
...$defaultSku,
|
||||
barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()}`
|
||||
}])
|
||||
const skuList = reactive({
|
||||
list: [{
|
||||
...$defaultSku,
|
||||
barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()}`
|
||||
}]
|
||||
})
|
||||
watch(() => skuList.list, (newval) => {
|
||||
console.log(newval);
|
||||
})
|
||||
//库存表单数据
|
||||
const stockData = reactive({
|
||||
inventoryMode: 0,
|
||||
|
|
@ -1294,13 +1000,21 @@
|
|||
url: v
|
||||
}
|
||||
})
|
||||
$goodsData = res
|
||||
Object.assign(FormData, res)
|
||||
if (res.skuList.length) {
|
||||
for (let i in res.skuList) {
|
||||
skuList[i] = res.skuList[i]
|
||||
for(let i in res.conInfos){
|
||||
const con=res.conInfos[i]
|
||||
const item=res.skuList.find(v=>v.id==con.productSkuId)
|
||||
if(item){
|
||||
if(item.hasOwnProperty('haoCaiList')){
|
||||
item.haoCaiList.push(con)
|
||||
}else{
|
||||
item.haoCaiList=[con]
|
||||
}
|
||||
}
|
||||
}
|
||||
$goodsData = res
|
||||
console.log(res);
|
||||
Object.assign(FormData, res)
|
||||
skuList.list = res.skuList || []
|
||||
//多规格
|
||||
if (res.typeEnum === 'sku') {
|
||||
const selectSpec = JSON.parse(res.selectSpec)
|
||||
|
|
@ -1319,13 +1033,12 @@
|
|||
selectSpec: selectSpec.map(s => {
|
||||
return {
|
||||
...s,
|
||||
// value: s.value.map(v => {
|
||||
// return {
|
||||
// text: v,
|
||||
// value: v
|
||||
// }
|
||||
// })
|
||||
|
||||
value: s.value.map(v => {
|
||||
return typeof v === 'string' ? {
|
||||
text: v,
|
||||
value: v
|
||||
} : v
|
||||
})
|
||||
}
|
||||
}),
|
||||
result: res.skuList.map(v => {
|
||||
|
|
@ -1339,7 +1052,8 @@
|
|||
...v
|
||||
},
|
||||
names,
|
||||
specSnap: v.specSnap
|
||||
specSnap: v.specSnap,
|
||||
coverImg:v.coverImg
|
||||
}
|
||||
}),
|
||||
specList: [],
|
||||
|
|
@ -1422,9 +1136,14 @@
|
|||
const pageData = reactive({
|
||||
// 商品类型
|
||||
// types: $types,
|
||||
types: [
|
||||
{name:'单规格',value:'normal'},
|
||||
{name:'多规格',value:'sku'}
|
||||
types: [{
|
||||
name: '单规格',
|
||||
value: 'normal'
|
||||
},
|
||||
{
|
||||
name: '多规格',
|
||||
value: 'sku'
|
||||
}
|
||||
],
|
||||
// 单位
|
||||
units: [],
|
||||
|
|
@ -1441,6 +1160,10 @@
|
|||
pageData.skuList = res
|
||||
})
|
||||
}
|
||||
function updateGoodsDetail(){
|
||||
getGoodsDetail()
|
||||
getProductSku()
|
||||
}
|
||||
onLoad((params) => {
|
||||
if (isEmpty(params)) {
|
||||
option.type = params.type ? params.type : 'add'
|
||||
|
|
@ -1454,6 +1177,10 @@
|
|||
uni.setNavigationBarTitle({
|
||||
title: option.type === 'add' ? '添加商品' : '编辑商品'
|
||||
})
|
||||
if (option.type === 'edit') {
|
||||
getGoodsDetail()
|
||||
getProductSku()
|
||||
}
|
||||
defaultValueInit()
|
||||
getCategory()
|
||||
getTbShopUnit()
|
||||
|
|
@ -1461,10 +1188,10 @@
|
|||
})
|
||||
|
||||
onShow(() => {
|
||||
if (option.type === 'edit') {
|
||||
getGoodsDetail()
|
||||
getProductSku()
|
||||
}
|
||||
// if (option.type === 'edit') {
|
||||
// getGoodsDetail()
|
||||
// getProductSku()
|
||||
// }
|
||||
})
|
||||
|
||||
|
||||
|
|
@ -1498,15 +1225,23 @@
|
|||
if (typeEnum === 'group' && !groupCategoryId.length) {
|
||||
return infoBox.showToast('请选择团购券分类')
|
||||
}
|
||||
|
||||
// if(typeEnum==='sku'){
|
||||
// return infoBox.showErrorToast('请选择规格')
|
||||
// }
|
||||
const images = refFile.value.getFileList()
|
||||
if(images.length<=0){
|
||||
return infoBox.showToast('请上传商品图片')
|
||||
}
|
||||
const skuSnap = []
|
||||
const submitSkuList = FormData.specificationsGroup ? skuList : [{
|
||||
let submitSkuList = FormData.specificationsGroup ? skuList.list : [{
|
||||
...$defaultSku,
|
||||
barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()}`
|
||||
}]
|
||||
}];
|
||||
if(typeEnum=='normal'){
|
||||
submitSkuList=skuList.list ;
|
||||
}
|
||||
console.log(submitSkuList);
|
||||
if (FormData.specificationsGroup) {
|
||||
for (let i of FormData.specificationsGroup.selectSpec) {
|
||||
if (i.selectSpecResult.length) {
|
||||
|
|
@ -1517,7 +1252,6 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
const submitData = {
|
||||
...FormData,
|
||||
images: images,
|
||||
|
|
@ -1526,7 +1260,13 @@
|
|||
specInfo: JSON.stringify(submitSkuList),
|
||||
lowPrice: submitSkuList[0].salePrice,
|
||||
specificationsGroup: undefined,
|
||||
selectSpec: JSON.stringify(FormData.specificationsGroup.selectSpec),
|
||||
selectSpec: JSON.stringify(FormData.specificationsGroup.selectSpec.map(spe=>{
|
||||
return {
|
||||
...spe,value:spe.value.map(v=>{
|
||||
return typeof v==='string'?v:v.text||v.value
|
||||
})
|
||||
}
|
||||
})),
|
||||
skuSnap: JSON.stringify(skuSnap)
|
||||
}
|
||||
//编辑
|
||||
|
|
@ -1562,29 +1302,33 @@
|
|||
|
||||
/**
|
||||
* 监听规格保存,拿到数据
|
||||
* @param {Boolean} open //控制开启或关闭监听
|
||||
*/
|
||||
function watchSpecificationsSave(open = true) {
|
||||
if (open) {
|
||||
uni.$on('emitspecificationsSave', function(data) {
|
||||
FormData.specificationsGroup = data
|
||||
skuList.length = data.result.length
|
||||
for (let i in data.result) {
|
||||
const v = data.result[i]
|
||||
skuList[i] = {
|
||||
...v.skus,
|
||||
...v.names,
|
||||
specSnap: v.specSnap,
|
||||
}
|
||||
}
|
||||
console.log(skuList);
|
||||
})
|
||||
} else {
|
||||
uni.$off('emitspecificationsSave', function(data) {
|
||||
console.log('emitspecificationsSave remove');
|
||||
})
|
||||
}
|
||||
const newSkuList = reactive({
|
||||
list: []
|
||||
})
|
||||
|
||||
function watchSpecificationsSave() {
|
||||
uni.$off('emitspecificationsSave')
|
||||
uni.$on('emitspecificationsSave', function(data) {
|
||||
FormData.specificationsGroup = data
|
||||
skuList.list = data.result.map(v => {
|
||||
return {
|
||||
...v.skus,
|
||||
...v.names,
|
||||
specSnap: v.specSnap,
|
||||
coverImg: v.coverImg || ''
|
||||
}
|
||||
})
|
||||
newSkuList.list = data.result.map(v => {
|
||||
return {
|
||||
...v.skus,
|
||||
...v.names,
|
||||
specSnap: v.specSnap,
|
||||
coverImg: v.coverImg || ''
|
||||
}
|
||||
})
|
||||
console.log(skuList.list);
|
||||
})
|
||||
}
|
||||
|
||||
function toGroup() {
|
||||
|
|
@ -1666,23 +1410,20 @@
|
|||
watch(() => FormData.typeEnum, (newval) => {
|
||||
if (option.type === 'add') {
|
||||
if (newval === 'sku') {
|
||||
skuList.length = 0
|
||||
skuList.list = []
|
||||
} else {
|
||||
skuList[0] = {
|
||||
skuList.list[0] = {
|
||||
...$defaultSku,
|
||||
barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()}`
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
watchSpecificationsSave()
|
||||
watchTimerSave()
|
||||
onBeforeUnmount(() => {
|
||||
watchSpecificationsSave(false)
|
||||
watchTimerSave(false)
|
||||
onShow(() => {
|
||||
watchSpecificationsSave()
|
||||
})
|
||||
onReady(() => {
|
||||
Forms.value&&Forms.value.setRules(rules)
|
||||
Forms.value && Forms.value.setRules(rules)
|
||||
})
|
||||
watch(() => pageData.types, (newval) => {
|
||||
Forms.value.setRules(rules)
|
||||
|
|
@ -1764,6 +1505,7 @@
|
|||
.box {
|
||||
margin-top: 36rpx;
|
||||
font-size: 28rpx;
|
||||
|
||||
.block {
|
||||
background: #FFFFFF;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
|
|
|
|||
|
|
@ -91,8 +91,8 @@
|
|||
|
||||
function haocaiClick(item, index) {
|
||||
console.log(item);
|
||||
if (item.consId != props.modelValue) {
|
||||
emits('update:modelValue', item.consId)
|
||||
if (item.id != props.modelValue) {
|
||||
emits('update:modelValue', item.id)
|
||||
emits('change', item)
|
||||
}
|
||||
popShow.value = false
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@
|
|||
<view class="">
|
||||
<template v-if="isBindGuige&&isSku">
|
||||
<view class="list">
|
||||
<view class="u-p-b-32 u-p-t-32 border-bottom" v-for="(item,index) in skuList" :key="index">
|
||||
<view class="u-p-b-32 u-p-t-32 border-bottom" v-for="(sku,index) in skuList" :key="index">
|
||||
<view>规格名称</view>
|
||||
<view class="u-m-t-16">{{item.specSnap}}</view>
|
||||
<view class="u-m-t-16">{{sku.specSnap}}</view>
|
||||
<view class="color-666 u-m-t-24 u-flex">
|
||||
<view class="xuhao">序号</view>
|
||||
<view class="u-flex u-flex-1 u-p-l-32 gap-20">
|
||||
|
|
@ -26,29 +26,24 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-32 color-666">
|
||||
<view class="u-m-t-24" v-for="(haocai,haocaiIndex) in item.haoaiList"
|
||||
<view class="u-m-t-24" v-for="(item,haocaiIndex) in sku.haoCaiList"
|
||||
:key="haocaiIndex">
|
||||
<view class=" u-flex">
|
||||
<view class="xuhao">{{haocaiIndex+1}}</view>
|
||||
<view class="u-flex u-flex-1 u-p-l-32 gap-20">
|
||||
<view class="u-flex-1 ">
|
||||
<view class="u-flex input">
|
||||
<view>{{item.name}}</view>
|
||||
<up-icon :size="10" name="arrow-down-fill"></up-icon>
|
||||
</view>
|
||||
<choose-haocai @change="conInfosChange($event,item)"
|
||||
:listMap="$haocaiMap" :list="haoCaiList"
|
||||
v-model="item.conInfoId"></choose-haocai>
|
||||
</view>
|
||||
<view class="u-flex-1 ">
|
||||
<view class="u-flex input">
|
||||
<view>{{item.unit}}</view>
|
||||
<up-icon :size="10" name="arrow-down-fill"></up-icon>
|
||||
</view>
|
||||
<choose-danwei :listMap="$danweiMap" :list="danweiList"
|
||||
v-model="item.conUnit"></choose-danwei>
|
||||
</view>
|
||||
<view class="u-flex-1 ">
|
||||
<view class="u-flex input">
|
||||
<up-input border="none"></up-input>
|
||||
<up-icon color="#EB4F4F" @click="delGuigeHaocao(index,haocaiIndex)"
|
||||
:size="16" name="minus-circle-fill"></up-icon>
|
||||
</view>
|
||||
<view class="u-flex input">
|
||||
<up-input border="none" v-model="item.surplusStock"></up-input>
|
||||
<up-icon @click="delGuigeHaocao(index,haocaiIndex)" color="#EB4F4F" :size="16"
|
||||
name="minus-circle-fill"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -173,16 +168,20 @@
|
|||
deletetbProskuCon,
|
||||
} from "@/http/yskApi/consumable.js";
|
||||
import {
|
||||
tbShopCurrencyGet,$hasPermission
|
||||
tbShopCurrencyGet,
|
||||
$hasPermission
|
||||
} from '@/http/yskApi/shop.js'
|
||||
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import chooseHaocai from './choose-haocai.vue';
|
||||
import chooseDanwei from './choose-danwei.vue';
|
||||
import {
|
||||
$tbProskuConV2
|
||||
} from '@/http/yskApi/goods.js'
|
||||
const emits=defineEmits(['cancel'])
|
||||
function cancel(){
|
||||
import { cloneWith } from 'lodash';
|
||||
const emits = defineEmits(['cancel', 'updateGoods'])
|
||||
|
||||
function cancel() {
|
||||
emits('cancel')
|
||||
}
|
||||
const props = defineProps({
|
||||
|
|
@ -203,27 +202,29 @@
|
|||
console.log(newval);
|
||||
conInfos.value = newval
|
||||
})
|
||||
|
||||
function conInfosChange(newval, item) {
|
||||
console.log(newval);
|
||||
item.stockNumber = newval.balance
|
||||
item.conUnit = newval.conUnit
|
||||
}
|
||||
|
||||
|
||||
const skuList = ref(props.goods.skuList)
|
||||
watch(() => props.goods.skuList, (newval) => {
|
||||
console.log(newval);
|
||||
skuList.value = newval
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const $baseicHaocaiData = {
|
||||
conInfoId: '',
|
||||
conUnit: '',
|
||||
surplusStock: ''
|
||||
}
|
||||
|
||||
function addHaocai() {
|
||||
conInfos.value.push({
|
||||
conInfoId: '',
|
||||
conUnit: '',
|
||||
surplusStock: ''
|
||||
...$baseicHaocaiData
|
||||
})
|
||||
}
|
||||
const popup = reactive({
|
||||
|
|
@ -233,11 +234,21 @@
|
|||
})
|
||||
|
||||
function addGuigeHaocai(index) {
|
||||
console.log(index);
|
||||
if (skuList.value[index].haoCaiList) {
|
||||
skuList.value[index].haoCaiList.push({
|
||||
...$baseicHaocaiData
|
||||
})
|
||||
} else {
|
||||
skuList.value[index].haoCaiList = [{
|
||||
...$baseicHaocaiData
|
||||
}]
|
||||
}
|
||||
console.log(skuList.value[index]);
|
||||
}
|
||||
|
||||
function delHaocai(index) {
|
||||
const item = conInfos.value[index]
|
||||
console.log(item);
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '是否删除该耗材',
|
||||
|
|
@ -258,7 +269,24 @@
|
|||
}
|
||||
|
||||
function delGuigeHaocao(guigeIndex, haocaiIndex) {
|
||||
skuList.value[guigeIndex].haoaiList.splice(haocaiIndex, 1)
|
||||
const item = skuList.value[guigeIndex].haoCaiList[haocaiIndex]
|
||||
console.log(item);
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '是否删除该耗材',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
if (item&&item.id) {
|
||||
deletetbProskuCon([item.id]).then(res1 => {
|
||||
skuList.value[guigeIndex].haoCaiList.splice(haocaiIndex, 1)
|
||||
})
|
||||
} else {
|
||||
skuList.value[guigeIndex].haoCaiList.splice(haocaiIndex, 1)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 是否是多规格商品
|
||||
|
|
@ -270,30 +298,66 @@
|
|||
isBindGuige.value = isSku.value
|
||||
})
|
||||
|
||||
function save() {
|
||||
async function save() {
|
||||
console.log('save');
|
||||
const isPas= conInfos.value.every(v=>{
|
||||
return v.conInfoId&&v.conUnit&&v.surplusStock>0
|
||||
})
|
||||
console.log(isPas);
|
||||
return
|
||||
let ajaxData = ''
|
||||
let isPas=false
|
||||
if(!isBindGuige.value){
|
||||
//绑定至商品
|
||||
isPas = conInfos.value.every(v => {
|
||||
return v.conInfoId && v.conUnit && v.surplusStock > 0
|
||||
})
|
||||
}else{
|
||||
//绑定至规格
|
||||
isPas = skuList.value.filter(v=>v.haoCaiList&&v.haoCaiList.length).every(sku => {
|
||||
console.log(sku.haoCaiList);
|
||||
return sku.haoCaiList.every(v=>{
|
||||
return v.conInfoId && v.conUnit && v.surplusStock > 0
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
if (!isPas) {
|
||||
return infoBox.showToast('请填写全部耗材选项值')
|
||||
}
|
||||
let ajaxData = {
|
||||
productId: props.goods.id,
|
||||
cons: []
|
||||
}
|
||||
if (!isBindGuige.value) {
|
||||
//绑定至商品
|
||||
ajaxData = conInfos.value.map(v => {
|
||||
ajaxData.cons = conInfos.value.map(v => {
|
||||
return {
|
||||
id: v.id || '',
|
||||
conInfoId: v.conInfoId,
|
||||
productId: props.goods.id,
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
productSkuId: 0,
|
||||
surplusStock: v.surplusStock
|
||||
surplusStock: v.surplusStock * 1,
|
||||
status: 1
|
||||
}
|
||||
})
|
||||
} else {
|
||||
for(let i in skuList.value){
|
||||
const haocaiList=skuList.value[i].haoCaiList||[]
|
||||
for(let k in haocaiList){
|
||||
const v=haocaiList[k]
|
||||
ajaxData.cons.push({
|
||||
id: v.id || '',
|
||||
conInfoId: v.conInfoId,
|
||||
productId: props.goods.id,
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
productSkuId: skuList.value[i].id,
|
||||
surplusStock: v.surplusStock * 1,
|
||||
status: 1
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
console.log(ajaxData);
|
||||
$tbProskuConV2(ajaxData)
|
||||
await $tbProskuConV2(ajaxData)
|
||||
emits('updateGoods')
|
||||
infoBox.showToast('修改成功')
|
||||
}
|
||||
|
||||
let haoCaiList = ref([])
|
||||
|
|
@ -303,12 +367,11 @@
|
|||
|
||||
function init() {
|
||||
gettbConsInfo({
|
||||
page: 0,
|
||||
size: 200
|
||||
"status": 1,
|
||||
}).then(res => {
|
||||
for (let i in res.content) {
|
||||
const item = res.content[i]
|
||||
$haocaiMap[item.consId] = item
|
||||
$haocaiMap[item.id] = item
|
||||
}
|
||||
haoCaiList.value = res.content
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
</view>
|
||||
|
||||
<view class="u-m-t-24">
|
||||
{{item.selectSpecResult}}
|
||||
<uni-data-checkbox @change="createResult" multiple :selectedColor="color.ColorMain"
|
||||
v-model="item.selectSpecResult" :localdata="item.value"></uni-data-checkbox>
|
||||
|
||||
|
|
@ -30,6 +29,19 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- <view class="block u-m-b-32 u-p-30">
|
||||
<view class="font-bold">批量修改</view>
|
||||
<view class="u-flex fast-edit u-flex-wrap gap-20 u-m-t-12">
|
||||
<view class="color-main item u-flex u-row-center u-col-center" v-for="(item,index) in fastEdit.list" :key="index">
|
||||
<view class="u-flex u-col-center">
|
||||
<view class="u-m-r-12">{{item.text}}</view>
|
||||
<up-icon size="16" :color="color.ColorMain" name="edit-pen"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view> -->
|
||||
<view>
|
||||
<view class="block u-m-b-32" v-for="(item,index) in FormData.result" :key="index">
|
||||
|
||||
|
|
@ -97,12 +109,12 @@
|
|||
<uni-easyinput @blur="priceFormat(item.skus,'firstShared')"
|
||||
:paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||
:inputBorder="inputBorder" v-model="item.skus.firstShared" type="digit"
|
||||
placeholder="请输入起售数量" />
|
||||
placeholder="请输入分销金额" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="商品条码" required>
|
||||
<uni-easyinput disabled :paddingNone="inputPaddingNone"
|
||||
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
v-model="item.skus.barCode" placeholder="请输入起售数量" />
|
||||
v-model="item.skus.barCode" placeholder="请输入商品条码" />
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -112,18 +124,25 @@
|
|||
|
||||
<view class="save-btn-box">
|
||||
<button class="save-btn" hover-class="btn-hover-class" @click="save">保存</button>
|
||||
<button class="save-btn edit-btn" hover-class="btn-hover-class" @click="fastEditShow">
|
||||
<view class="u-flex u-row-center">
|
||||
<view class="u-m-r-6">批量修改</view>
|
||||
<up-icon name="edit-pen" :color="color.ColorMain"></up-icon>
|
||||
</view>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom" ref="bottom"></view>
|
||||
|
||||
<pop-fast-edit @update="updateSkuKey" v-model:show="fastEdit.show"></pop-fast-edit>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import myUploadFile from '@/components/my-components/my-upload-file'
|
||||
import {
|
||||
formatPrice
|
||||
} from "@/commons/utils/format.js";
|
||||
|
||||
import popFastEdit from "./components/fast-edit.vue"
|
||||
const refFiles = ref([]);
|
||||
//绑定文件上传元素
|
||||
function setRefFile(index) {
|
||||
|
|
@ -135,10 +154,26 @@
|
|||
};
|
||||
}
|
||||
|
||||
const fastEdit=reactive({
|
||||
show:false,
|
||||
list:[
|
||||
{text:'会员价',key:'memberPrice',value:''},
|
||||
{text:'成本价',key:'costPrice',value:''},
|
||||
{text:'原价',key:'originPrice',value:''},
|
||||
{text:'起售数量',key:'suit',value:''},
|
||||
{text:'库存数量',key:'stockNumber',value:''},
|
||||
{text:'分销金额',key:'firstShared',value:''}
|
||||
],
|
||||
sel:''
|
||||
})
|
||||
function fastEditShow(){
|
||||
fastEdit.show=true
|
||||
}
|
||||
//上个页面传来的参数
|
||||
let option={}
|
||||
|
||||
|
||||
|
||||
//number类型数据限制
|
||||
function priceFormat(item, key) {
|
||||
nextTick(() => {
|
||||
|
|
@ -180,7 +215,19 @@
|
|||
watch
|
||||
} from 'vue';
|
||||
|
||||
|
||||
function updateSkuKey(arr){
|
||||
for(let i in FormData.result){
|
||||
const sku=FormData.result[i].skus
|
||||
for(let k in arr){
|
||||
const item=arr[k]
|
||||
if(sku.hasOwnProperty(item.key)){
|
||||
sku[item.key]=item.value
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
const inputPaddingNone = ref(true)
|
||||
const form = ref(null)
|
||||
const originSpecMap={}
|
||||
|
|
@ -353,15 +400,16 @@
|
|||
getTbProductSpec()
|
||||
const obj = uni.getStorageSync('guige')
|
||||
if (obj&&JSON.stringify(obj) !== '{}') {
|
||||
console.log(obj.selectSpec);
|
||||
option.productId=opt.productId
|
||||
Object.assign(FormData, obj)
|
||||
for(let i of obj.result){
|
||||
const key=returnSpecSnap(i.names)
|
||||
originSpecMap[key]=i
|
||||
}
|
||||
console.log(FormData);
|
||||
nextTick(() => {
|
||||
FormData.result = obj.result
|
||||
console.log(FormData.result);
|
||||
})
|
||||
}
|
||||
console.log(opt);
|
||||
|
|
@ -516,7 +564,7 @@
|
|||
left: 30rpx;
|
||||
right: 30rpx;
|
||||
bottom: 60rpx;
|
||||
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
::v-deep.uni-forms-item {
|
||||
|
|
@ -540,7 +588,12 @@
|
|||
border-radius: 12rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.edit-btn{
|
||||
background-color: #fff;
|
||||
color: #333;
|
||||
border-radius: 12rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.btn-hover-class {
|
||||
opacity: .6;
|
||||
}
|
||||
|
|
@ -551,7 +604,18 @@
|
|||
padding-left: 42rpx;
|
||||
border-radius: 14rpx 14rpx 14rpx 14rpx;
|
||||
}
|
||||
|
||||
.fast-edit{
|
||||
.item{
|
||||
color: #333;
|
||||
border: 1px solid #bbb;
|
||||
padding: 4rpx 10rpx 8rpx 10rpx;
|
||||
border-radius: 10rpx;
|
||||
min-width: 186rpx;
|
||||
&.active{
|
||||
color: $my-main-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
::v-deep .uni-input-placeholder {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,157 @@
|
|||
<template>
|
||||
<up-popup :show="popShow" @close="close" @open="open" mode="center" :round="9">
|
||||
<view class="u-p-32 box u-font-28">
|
||||
<view class="u-flex u-relative u-row-center">
|
||||
<view class="u-font-32">快速修改</view>
|
||||
<view class="u-absolute close">
|
||||
<up-icon @click="close" :size="16" color="#000" name="close-circle-fill"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-36">
|
||||
<view class="u-m-b-24" v-for="(item,index) in list" :key="index">
|
||||
<view>{{item.text}}:</view>
|
||||
<view class="u-m-t-24">
|
||||
<up-input v-model="item.value">
|
||||
<template #suffix>
|
||||
<up-button @click="itemClick(item)" type="primary" text="修改" size="mini"></up-button>
|
||||
</template>
|
||||
</up-input>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="u-m-t-60">
|
||||
<my-button type="primary" shape="circle" @tap="save">
|
||||
<view class="u-font-32">
|
||||
修改
|
||||
</view>
|
||||
</my-button>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
ref,
|
||||
watch,
|
||||
onMounted,
|
||||
computed
|
||||
} from 'vue';
|
||||
import {
|
||||
returnSkuSnap,
|
||||
returnTypeEnum,
|
||||
returnCategory
|
||||
} from '@/pageProduct/util.js'
|
||||
import {
|
||||
$tbShopUnit
|
||||
} from '@/http/yskApi/goods.js'
|
||||
const props = defineProps({
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
const arr = [
|
||||
{
|
||||
text: '售价',
|
||||
key: 'salePrice',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
text: '会员价',
|
||||
key: 'memberPrice',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
text: '成本价',
|
||||
key: 'costPrice',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
text: '原价',
|
||||
key: 'originPrice',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
text: '起售数量',
|
||||
key: 'suit',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
text: '库存数量',
|
||||
key: 'stockNumber',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
text: '分销金额',
|
||||
key: 'firstShared',
|
||||
value: ''
|
||||
}
|
||||
]
|
||||
const list = ref([...arr])
|
||||
|
||||
function changeShowRecoders(show) {
|
||||
recoders.show = show
|
||||
}
|
||||
|
||||
const data = ref(props.item)
|
||||
const emits = defineEmits(['update:show', 'update','itemClick'])
|
||||
const form = reactive({
|
||||
note: ''
|
||||
})
|
||||
let popShow = ref(props.show)
|
||||
|
||||
function itemClick(item){
|
||||
console.log(item);
|
||||
emits('update',[item])
|
||||
}
|
||||
|
||||
|
||||
watch(() => props.show, (newval) => {
|
||||
popShow.value = newval
|
||||
if (newval) {
|
||||
data.value = props.item
|
||||
}
|
||||
})
|
||||
const isSku = computed(() => {
|
||||
// return data.value.typeEnum == '多规格'
|
||||
return false
|
||||
})
|
||||
watch(() => popShow.value, (newval) => {
|
||||
emits('update:show', newval)
|
||||
})
|
||||
|
||||
function close() {
|
||||
popShow.value = false
|
||||
list.value=[...arr]
|
||||
}
|
||||
|
||||
function open() {
|
||||
|
||||
}
|
||||
|
||||
function save() {
|
||||
emits('update',list.value)
|
||||
popShow.value = false
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.box {
|
||||
width: 556rpx;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.close {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.number {
|
||||
color: #EE4646;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -16,10 +16,10 @@
|
|||
报损数量
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
<up-input v-model="form.number">
|
||||
<template #suffix>
|
||||
<up-input v-model="form.stockNumber" type="number">
|
||||
<!-- <template #suffix>
|
||||
<view>{{data.unitName}}</view>
|
||||
</template>
|
||||
</template> -->
|
||||
</up-input>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
<view>备注</view>
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
<up-textarea :height="42" v-model="form.note" placeholder="请输入备注"></up-textarea>
|
||||
<up-textarea :height="42" v-model="form.remark" placeholder="请输入备注"></up-textarea>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-b-32">
|
||||
|
|
@ -36,9 +36,7 @@
|
|||
<view>上传图片</view>
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
<scroll-view scroll-y="true" style="max-height: 300rpx;">
|
||||
<my-up-upload v-model="form.images"></my-up-upload>
|
||||
</scroll-view>
|
||||
<my-up-upload :maxCount="1" :multiple="false" v-model="form.coverImg"></my-up-upload>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-60">
|
||||
|
|
@ -67,8 +65,9 @@
|
|||
returnCategory
|
||||
} from '@/pageProduct/util.js'
|
||||
import {
|
||||
$tbShopUnit
|
||||
$frmLoss
|
||||
} from '@/http/yskApi/goods.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
const props = defineProps({
|
||||
show: {
|
||||
type: Boolean,
|
||||
|
|
@ -88,9 +87,9 @@
|
|||
const data = ref(props.goods)
|
||||
const emits = defineEmits(['update:show', 'save'])
|
||||
const form = reactive({
|
||||
note: '',
|
||||
number: 1,
|
||||
images: []
|
||||
remark: '',
|
||||
stockNumber: 1,
|
||||
coverImg: []
|
||||
})
|
||||
let popShow = ref(props.show)
|
||||
watch(() => props.show, (newval) => {
|
||||
|
|
@ -111,8 +110,21 @@
|
|||
|
||||
}
|
||||
|
||||
function save() {
|
||||
console.log(form.images);
|
||||
async function save() {
|
||||
if (form.stockNumber <= 0) {
|
||||
return infoBox.showToast('请输入正确的报损数量')
|
||||
}
|
||||
if (!form.remark) {
|
||||
return infoBox.showToast('请输入备注')
|
||||
}
|
||||
console.log(form);
|
||||
const res= await $frmLoss({
|
||||
...form,
|
||||
productId:props.goods.id,
|
||||
coverImg:form.coverImg[0]?form.coverImg[0].serveUrl:''
|
||||
})
|
||||
infoBox.showToast('提交成功!')
|
||||
popShow.value=false
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<view class="control" :style="getComputedStyle()">
|
||||
<view class="u-flex control1" v-if="showControl1">
|
||||
<view class="btn" @click="changeShowControl1">批量管理</view>
|
||||
<!-- <view class="btn" @click="changeShowControl1">批量管理</view> -->
|
||||
<view class="btn" @tap="go.to('PAGES_PRODUCT_ADD')">商品添加</view>
|
||||
<!-- <view class="color-999 btn u-flex u-row-center" @click="emitToggleCategory">
|
||||
<text class="u-m-r-10">{{categoryName||'选择分类'}}</text>
|
||||
|
|
@ -114,8 +114,8 @@
|
|||
|
||||
.control {
|
||||
position: fixed;
|
||||
left: 30rpx;
|
||||
right: 30rpx;
|
||||
left: 110rpx;
|
||||
right: 110rpx;
|
||||
z-index: 100;
|
||||
background: #3E3A3A;
|
||||
border-radius: 100rpx;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
</view>
|
||||
<view class=" u-flex u-row-between u-m-t-30">
|
||||
<view>售罄</view>
|
||||
<up-switch :size="20" @change="isPauseSaleChange" v-model="isPauseSale"></up-switch>
|
||||
<up-switch :activeValue="1" :inactiveValue="0" :size="20" @change="isPauseSaleChange" v-model="isPauseSale"></up-switch>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -40,7 +40,9 @@
|
|||
returnCategory
|
||||
} from '@/pageProduct/util.js'
|
||||
import {
|
||||
$updateGrounding, $updateProductStatus
|
||||
$updateGrounding,
|
||||
$updateProductStatus,$updateProductData,
|
||||
$tbProskuConV2
|
||||
} from '@/http/yskApi/goods.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
const props = defineProps({
|
||||
|
|
@ -73,7 +75,7 @@
|
|||
// 是否上架
|
||||
const isGrounding = ref(1)
|
||||
const data = ref(props.goods)
|
||||
const emits = defineEmits(['update:show', 'save', 'isGroundingChange','isPauseSaleChange'])
|
||||
const emits = defineEmits(['update:show', 'save', 'isGroundingChange', 'isPauseSaleChange'])
|
||||
const form = reactive({
|
||||
note: ''
|
||||
})
|
||||
|
|
@ -102,21 +104,30 @@
|
|||
function save() {
|
||||
emits('save')
|
||||
}
|
||||
|
||||
function upDateGoods(par) {
|
||||
return $updateProductData([{
|
||||
id: data.value.id,
|
||||
isSku: 1,
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
...par
|
||||
}])
|
||||
}
|
||||
|
||||
async function isGroundingChange(e) {
|
||||
console.log(e);
|
||||
await $updateGrounding({
|
||||
isGrounding: e ? true : false,
|
||||
skuId: props.goods.id
|
||||
await upDateGoods({
|
||||
key:'grounding',
|
||||
value: e
|
||||
})
|
||||
emits('isGroundingChange', e)
|
||||
infoBox.showToast('更新成功')
|
||||
}
|
||||
|
||||
async function isPauseSaleChange(e) {
|
||||
console.log(e);
|
||||
await $updateProductStatus({
|
||||
targetId: props.goods.id,
|
||||
updateKey: "pauseSaleSku",
|
||||
updateValue: e?1:0
|
||||
await upDateGoods({
|
||||
key:'pauseSale',
|
||||
value: e
|
||||
})
|
||||
emits('isPauseSaleChange', e)
|
||||
infoBox.showToast('更新成功')
|
||||
|
|
|
|||
|
|
@ -87,9 +87,10 @@
|
|||
<my-step :list="recoders.list"></my-step>
|
||||
</scroll-view>
|
||||
<view class="color-999 u-font-24 u-flex u-row-center u-col-center">
|
||||
<view class="u-flex" @click="changeShowRecoders(false)">
|
||||
<view class="u-m-r-6">收起记录</view>
|
||||
<up-icon name="arrow-up" :size="12"></up-icon>
|
||||
<!-- <view class="u-flex" @click="changeShowRecoders(false)"> -->
|
||||
<view class="u-flex" @click="toRecodes">
|
||||
<view class="u-m-r-6">全部记录</view>
|
||||
<up-icon name="arrow-right" :size="12"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
|
@ -117,7 +118,7 @@
|
|||
returnCategory
|
||||
} from '@/pageProduct/util.js'
|
||||
import {
|
||||
$tbShopUnit
|
||||
$tbShopUnit,$getProductStockDetail
|
||||
} from '@/http/yskApi/goods.js'
|
||||
const props = defineProps({
|
||||
show: {
|
||||
|
|
@ -135,29 +136,15 @@
|
|||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
function toRecodes(){
|
||||
}
|
||||
function changeShowRecoders(show) {
|
||||
recoders.show = show
|
||||
}
|
||||
const recoders = reactive({
|
||||
list: [{
|
||||
title: '2024-09-15 11:20:30',
|
||||
content: '开启了库存,库存由0件修改为5件'
|
||||
},
|
||||
{
|
||||
title: '2024-09-15 ',
|
||||
content: '开启了库存,库存由0件修改为4件'
|
||||
},
|
||||
{
|
||||
title: '2024-09-15 ',
|
||||
content: '开启了库存,库存由0件修改为3件'
|
||||
},
|
||||
{
|
||||
title: '2024-09-15 ',
|
||||
content: '开启了库存,库存由0件修改为2件'
|
||||
},
|
||||
],
|
||||
show: false,
|
||||
list: [],
|
||||
show: true,
|
||||
active: 0
|
||||
})
|
||||
|
||||
|
|
@ -171,8 +158,27 @@
|
|||
popShow.value = newval
|
||||
if (newval) {
|
||||
data.value = props.goods
|
||||
getProductStockDetail()
|
||||
}
|
||||
})
|
||||
async function getProductStockDetail(){
|
||||
const {content}=await $getProductStockDetail({
|
||||
page:0,
|
||||
size:2,
|
||||
productId:props.goods.id,
|
||||
column:'/api/tbProductStockDetail/stock/count',
|
||||
shopId:uni.getStorageSync('shopId'),
|
||||
createdAt:[]
|
||||
})
|
||||
console.log(content);
|
||||
recoders.list=content.map(v=>{
|
||||
return {
|
||||
...v,
|
||||
title:v.createdAt,
|
||||
content:v.type+':'+Math.abs(v.stockNumber)
|
||||
}
|
||||
})
|
||||
}
|
||||
const isSku = computed(() => {
|
||||
// return data.value.typeEnum == '多规格'
|
||||
return false
|
||||
|
|
|
|||
|
|
@ -33,17 +33,18 @@
|
|||
<view class="info-p-l color-333 u-flex u-row-between">
|
||||
<view class="u-flex">
|
||||
<text class="u-m-r-24">{{data.name}}</text>
|
||||
<!-- <uni-tag size="small" type="primary"
|
||||
<!-- <uni-tag size="small" type="primary"
|
||||
custom-style="background-color: #318AFE;" :text="data.typeEnum"></uni-tag> -->
|
||||
</view>
|
||||
<view class="u-font-32">
|
||||
<text v-if="data.typeEnum=='单规格'">¥</text>
|
||||
<text>{{data.lowPrice}}</text>
|
||||
<!-- <text>¥</text>
|
||||
<text>{{data.lowPrice}}</text>
|
||||
<text v-if="data.typeEnum == '多规格'">~¥{{data.maxPrice }}</text> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-44">
|
||||
<view class="u-m-t-24">
|
||||
<template v-if="data.skuList.length>=2">
|
||||
<view class="u-flex u-flex-wrap w-full gap-10 u-col-top">
|
||||
<view class="u-font-24 info-p-l u-m-t-14">规格:</view>
|
||||
|
|
@ -64,7 +65,7 @@
|
|||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view style="height: 24rpx;">
|
||||
<view style="height: 44rpx;">
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
|
@ -86,11 +87,11 @@
|
|||
<view class="u-flex">
|
||||
<view class="u-flex">
|
||||
<view class="u-m-r-18 color-999">售罄</view>
|
||||
<my-switch v-model="data.isSellNoneChange" @change="isHotChange"></my-switch>
|
||||
<my-switch v-model="isPauseSale" @change="isPauseSaleChange"></my-switch>
|
||||
</view>
|
||||
<view class="u-flex u-m-l-30">
|
||||
<view class="u-m-r-18 color-999">下架产品</view>
|
||||
<my-switch v-model="data.isSellNoneChange" @change="isHotChange"></my-switch>
|
||||
<view class="u-m-r-18 color-999">{{data.isGrounding?'下架产品':'上架产品' }}</view>
|
||||
<my-switch v-model="isGrounding" @change="isGroundingChange"></my-switch>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
|
|
@ -109,17 +110,21 @@
|
|||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
watch,
|
||||
watchEffect
|
||||
} from 'vue';
|
||||
import {
|
||||
$goodsIsHot
|
||||
$goodsIsHot,
|
||||
$tbProskuConV2,$updateProductData
|
||||
} from '@/http/yskApi/goods.js'
|
||||
import mySwitch from '@/components/my-components/my-switch.vue'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import {
|
||||
ColorMain
|
||||
} from '@/commons/color.js'
|
||||
const emits = defineEmits(['radioClick', 'changeClick', 'xiajia', 'del', 'changePrice', 'baosun', 'guigeClick','editStock'])
|
||||
const emits = defineEmits(['radioClick', 'changeClick', 'xiajia', 'del', 'changePrice', 'baosun', 'guigeClick','update',
|
||||
'editStock'
|
||||
])
|
||||
const props = defineProps({
|
||||
index: {
|
||||
type: Number
|
||||
|
|
@ -127,7 +132,8 @@
|
|||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
return {
|
||||
}
|
||||
}
|
||||
},
|
||||
showChecked: {
|
||||
|
|
@ -139,27 +145,44 @@
|
|||
default: false
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
function isHotChange(e) {
|
||||
$goodsIsHot({
|
||||
|
||||
|
||||
async function upDateGoods(par) {
|
||||
const res = await $updateProductData([{
|
||||
id: props.data.id,
|
||||
isHot: props.data.isHot
|
||||
}).then(res => {
|
||||
uni.showToast({
|
||||
title: '修改成功',
|
||||
icon: 'none'
|
||||
})
|
||||
isSku: 0,
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
...par
|
||||
}])
|
||||
uni.showToast({
|
||||
title: '修改成功',
|
||||
icon: 'none'
|
||||
})
|
||||
emits('update')
|
||||
}
|
||||
|
||||
let isPauseSale=ref(props.data.isPauseSale)
|
||||
let isGrounding=ref(props.data.isGrounding)
|
||||
watch(() => props.data.isPauseSale, (newval) => {
|
||||
isPauseSale.value=newval
|
||||
})
|
||||
watch(() => props.data.isGrounding, (newval) => {
|
||||
isGrounding.value=newval
|
||||
})
|
||||
|
||||
function isPauseSaleChange(e) {
|
||||
upDateGoods({
|
||||
key: 'pauseSale',
|
||||
value: e
|
||||
})
|
||||
}
|
||||
|
||||
let isSellNone = ref(false)
|
||||
isSellNone.value = props.isSellNone
|
||||
|
||||
function isSellNoneChange() {
|
||||
console.log(isSellNone.value);
|
||||
console.log('isSellNoneChange');
|
||||
function isGroundingChange(e) {
|
||||
upDateGoods({
|
||||
key: 'grounding',
|
||||
value: e
|
||||
})
|
||||
}
|
||||
|
||||
let checked = ref(false)
|
||||
|
|
@ -196,7 +219,8 @@
|
|||
function guigeClick(guigeIndex) {
|
||||
emits('guigeClick', props.index, guigeIndex)
|
||||
}
|
||||
function editStock(){
|
||||
|
||||
function editStock() {
|
||||
emits('editStock', props.index)
|
||||
}
|
||||
//携带参数type edit跳转到商品添加页面,编辑与添加同一页面,根据type值来判断
|
||||
|
|
@ -301,7 +325,7 @@
|
|||
}
|
||||
|
||||
.skd {
|
||||
padding: 14rpx 40rpx 14rpx 20rpx;
|
||||
padding: 20rpx 20rpx 14rpx 20rpx;
|
||||
background: #F0F2F5;
|
||||
border-radius: 4rpx;
|
||||
position: relative;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
<view class="goods-list u-p-30">
|
||||
<template v-if="pageData.goodsList.length">
|
||||
<view class="u-m-b-32" v-for="(item,index) in pageData.goodsList" :key="index">
|
||||
<my-goods @changePrice="changePriceShow" @changeClick="goodsChangeClick"
|
||||
<my-goods :key="item.id" @update="getGoodsList" @changePrice="changePriceShow" @changeClick="goodsChangeClick"
|
||||
@editStock="changeStockShow" @guigeClick="editGuigeShow" @baosun="baosunShow"
|
||||
@radioClick="goodsRadioClick" :index="index" :data="item" @del="goodsDel"
|
||||
:showChecked="showChecked" :showDetail="pageData.showGoodsDetail"></my-goods>
|
||||
|
|
@ -187,7 +187,9 @@
|
|||
page: 0,
|
||||
size: 10,
|
||||
categoryId: '',
|
||||
name: ''
|
||||
name: '',
|
||||
isPauseSale:'',
|
||||
isGrounding:''
|
||||
},
|
||||
category: '',
|
||||
categoryList: [], //分类列表
|
||||
|
|
@ -198,7 +200,12 @@
|
|||
watch(() => pageData.query.categoryId, (newval) => {
|
||||
getGoodsList()
|
||||
})
|
||||
|
||||
watch(() => pageData.query.isPauseSale, (newval) => {
|
||||
getGoodsList()
|
||||
})
|
||||
watch(() => pageData.query.isGrounding, (newval) => {
|
||||
getGoodsList()
|
||||
})
|
||||
const popup = reactive({
|
||||
price: {
|
||||
show: false
|
||||
|
|
@ -362,6 +369,7 @@
|
|||
}
|
||||
|
||||
function getGoodsList() {
|
||||
pageData.hasAjax = false
|
||||
$tbProductV2(pageData.query).then(res => {
|
||||
pageData.hasAjax = true
|
||||
console.log(res);
|
||||
|
|
@ -377,9 +385,10 @@
|
|||
})
|
||||
}
|
||||
onShow(() => {
|
||||
getGoodsList()
|
||||
// getGoodsList()
|
||||
})
|
||||
onLoad(() => {
|
||||
getGoodsList()
|
||||
$tbShopCategory({
|
||||
page: 0,
|
||||
size: 200
|
||||
|
|
@ -470,14 +479,36 @@
|
|||
|
||||
|
||||
function statesTableClick(index) {
|
||||
|
||||
pageData.stateCurrent = index
|
||||
console.log(index);
|
||||
if(index==0){
|
||||
pageData.query.isPauseSale=''
|
||||
pageData.query.isGrounding=''
|
||||
return
|
||||
}
|
||||
if(index==1){
|
||||
pageData.query.isPauseSale=1
|
||||
pageData.query.isGrounding=''
|
||||
return
|
||||
}
|
||||
if(index==2){
|
||||
pageData.query.isPauseSale=''
|
||||
pageData.query.isGrounding=1
|
||||
return
|
||||
}
|
||||
if(index==3){
|
||||
pageData.query.isPauseSale=''
|
||||
pageData.query.isGrounding=0
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
let test = ref(false)
|
||||
|
||||
function tabsChange(i) {
|
||||
console.log(i);
|
||||
pageData.showGoodsDetail = i ? true : false
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -128,9 +128,12 @@
|
|||
|
||||
|
||||
function diancan() {
|
||||
const useType=props.status=='using'?props.data.useType:undefined
|
||||
go.to('PAGES_CREATE_ORDER', {
|
||||
tableId: props.data.tableId,
|
||||
name: props.data.name
|
||||
name: props.data.name,
|
||||
maxCapacity: props.data.maxCapacity,
|
||||
status: props.data.status,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@
|
|||
ref,
|
||||
reactive,
|
||||
computed,
|
||||
onBeforeUnmount,
|
||||
watch
|
||||
} from 'vue';
|
||||
const refMoreSheet = ref(null)
|
||||
|
|
@ -376,7 +377,12 @@
|
|||
watch(() => times.active, (newval) => {
|
||||
setTimer()
|
||||
})
|
||||
onBeforeUnmount(()=>{
|
||||
console.log('table page onBeforeUnmount');
|
||||
clearInterval(timer)
|
||||
})
|
||||
onHide(() => {
|
||||
console.log('table page hide');
|
||||
clearInterval(timer)
|
||||
})
|
||||
onShow(opt => {
|
||||
|
|
|
|||
58
pages.json
58
pages.json
|
|
@ -99,6 +99,35 @@
|
|||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pageId": "PAGES_SHOP_SETUP",
|
||||
"path": "pages/shopSetUp/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "设置中心"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pageId": "PAGES_SHOP_EDITVAL",
|
||||
"path": "pages/shopSetUp/editVal",
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"pageId": "PAGES_SHOP_QRCODE",
|
||||
"path": "pages/shopSetUp/shopQRcode",
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"pageId": "PAGES_SHOP_LIST",
|
||||
"path": "pages/shopSetUp/shopList",
|
||||
"style": {
|
||||
"navigationBarTitleText": "选择门店"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"pageId": "PAGES_USER_SETUP",
|
||||
"path": "pages/userSetUp/userSetUp",
|
||||
|
|
@ -965,7 +994,8 @@
|
|||
"pageId": "PAGES_CREATE_ORDER",
|
||||
"path": "index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "代客下单"
|
||||
// "navigationBarTitleText": "代客下单"
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -1340,6 +1370,32 @@
|
|||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pageGoodsGroup",
|
||||
"pages": [{
|
||||
"pageId": "PAGES_GOODS_GROUP",
|
||||
"path": "index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "分组管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pageId": "PAGES_GOODS_GROUP_EDIT",
|
||||
"path": "edit-group/edit-group",
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"pageId": "PAGES_GOODS_GROUP_EDIT_GOODS",
|
||||
"path" : "edit-group-goods/edit-group-goods",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "管理商品"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
|
|
|
|||
|
|
@ -44,8 +44,7 @@
|
|||
$adList
|
||||
} from '@/http/apiManager.js';
|
||||
uni.hideTabBar()
|
||||
onLoad((options) => {
|
||||
});
|
||||
onLoad((options) => {});
|
||||
// 导航列表
|
||||
const navList = [{
|
||||
title: '收银',
|
||||
|
|
@ -62,6 +61,11 @@
|
|||
icon: '/static/indexImg/icon-product-control.svg',
|
||||
pageUrl: 'PAGES_PRODUCT',
|
||||
},
|
||||
{
|
||||
title: '分组管理',
|
||||
icon: '/static/indexImg/goods-group.svg',
|
||||
pageUrl: 'PAGES_GOODS_GROUP',
|
||||
},
|
||||
{
|
||||
title: '分类管理',
|
||||
icon: '/static/indexImg/icon-category.svg',
|
||||
|
|
@ -80,7 +84,7 @@
|
|||
title: '桌台',
|
||||
icon: '/static/indexImg/icon-table.svg',
|
||||
pageUrl: 'PAGES_TABLE'
|
||||
},{
|
||||
}, {
|
||||
title: '排队',
|
||||
icon: '/static/indexImg/icon-table.svg',
|
||||
pageUrl: 'PAGES_LINE_UP'
|
||||
|
|
@ -208,6 +212,11 @@
|
|||
title: '耗材管理',
|
||||
icon: '/static/indexImg/PAGE_SALES_SUMMARY.svg',
|
||||
pageUrl: 'PAGES_SALES_CONSUMABLES'
|
||||
},
|
||||
{
|
||||
title: '退出登录',
|
||||
icon: '/static/indexImg/PAGE_SALES_SUMMARY.svg',
|
||||
pageUrl: 'PAGES_LOGIN'
|
||||
}
|
||||
|
||||
];
|
||||
|
|
|
|||
|
|
@ -212,9 +212,15 @@
|
|||
},
|
||||
|
||||
})
|
||||
|
||||
// #ifdef H5
|
||||
vdata.formData.username = '19502966242'
|
||||
vdata.formData.pwd = '11280923'
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
vdata.formData.username = '15699991111'
|
||||
vdata.formData.pwd = 'qwer1234'
|
||||
// #endif
|
||||
|
||||
|
||||
const getCode = () => {
|
||||
getCodeImg().then(res => {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
<view>就餐类型</view>
|
||||
<view class="u-m-t-24 u-flex ">
|
||||
<view class="u-flex color-666">
|
||||
<up-radio-group v-model="eatTypes.active" placement="row">
|
||||
<up-radio-group :disabled="option.type=='add'" v-model="eatTypes.active" placement="row">
|
||||
<up-radio :customStyle="{marginRight: '30px'}" v-for="(item, index) in eatTypes.list"
|
||||
:key="index" :label="item.name" :name="item.value">
|
||||
</up-radio>
|
||||
|
|
@ -75,7 +75,7 @@
|
|||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="$shop.registerType!='restaurant'">
|
||||
<template v-if="!$shop.isTableFee">
|
||||
<!-- 不免餐位费 -->
|
||||
<view class="block">
|
||||
<view class=" ">
|
||||
|
|
@ -89,7 +89,7 @@
|
|||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<view class="block">
|
||||
<view class="u-p-b-24 ">
|
||||
|
|
@ -184,7 +184,9 @@
|
|||
</view>
|
||||
|
||||
<view class="u-flex u-row-right u-m-t-38">
|
||||
<view class="color-main" @tap="showModel('editMoney')">修改</view>
|
||||
<template v-if="$shop.registerType=='munchies'">
|
||||
<view class="color-main" @tap="showModel('editMoney')">修改</view>
|
||||
</template>
|
||||
<view class="u-flex price u-m-l-32">
|
||||
<view class="">实收金额</view>
|
||||
<view class="font-bold u-font-32">¥{{formatPrice(allPrice) }}</view>
|
||||
|
|
@ -242,6 +244,7 @@
|
|||
} from '@/commons/utils/format.js';
|
||||
import color from '@/commons/color.js';
|
||||
import * as Api from '@/http/yskApi/Instead.js'
|
||||
import $storageManage from '@/commons/utils/storageManage.js'
|
||||
import {
|
||||
tbShopInfo
|
||||
} from '@/http/yskApi/user.js'
|
||||
|
|
@ -284,15 +287,17 @@
|
|||
//更新就餐人数
|
||||
async function updateChoseCount() {
|
||||
console.log($shop.value);
|
||||
if($shop.value.registerType!='restaurant'){
|
||||
if (!$shop.value.isTableFee) {
|
||||
//不免餐位费
|
||||
await Api.$choseCount({
|
||||
const res = await Api.$choseCount({
|
||||
masterId: option.masterId,
|
||||
tableId: option.tableId,
|
||||
tableId: table.value.tableId,
|
||||
num: userNumbers.defaultCateIndex,
|
||||
})
|
||||
Object.assign($seatFee, res)
|
||||
userNumbers.defaultCateIndex = res.totalNumber
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function userNumberChange(e) {
|
||||
|
|
@ -310,7 +315,7 @@
|
|||
} = item
|
||||
const par = {
|
||||
masterId: option.masterId,
|
||||
tableId: option.tableId,
|
||||
tableId: table.value.tableId,
|
||||
productId,
|
||||
num: number,
|
||||
skuId
|
||||
|
|
@ -349,14 +354,18 @@
|
|||
...table.value
|
||||
})
|
||||
}
|
||||
|
||||
const option = reactive({
|
||||
masterId: '',
|
||||
tableId: ""
|
||||
})
|
||||
// 监听选择用户事件
|
||||
let user = ref(null)
|
||||
//更新选择用户
|
||||
function setUser(par) {
|
||||
console.log(option);
|
||||
const submitPar = {
|
||||
masterId: option.masterId,
|
||||
tableId: option.tableId,
|
||||
tableId: table.value.tableId,
|
||||
vipUserId: user.value.id ? user.value.id : '',
|
||||
type: user.value.id ? 0 : 1 //0 设置 1 取消
|
||||
}
|
||||
|
|
@ -392,10 +401,7 @@
|
|||
})
|
||||
}
|
||||
|
||||
const option = reactive({
|
||||
masterId: '',
|
||||
tableId: ""
|
||||
})
|
||||
|
||||
const goods = reactive({
|
||||
list: [],
|
||||
sel: 0
|
||||
|
|
@ -413,9 +419,10 @@
|
|||
totalAmount: 0,
|
||||
})
|
||||
const allPrice = computed(() => {
|
||||
return goods.list.reduce((prve, cur) => {
|
||||
const goodsTotalPrice = goods.list.reduce((prve, cur) => {
|
||||
return prve + cur.salePrice * cur.number * (cur.isGift ? 0 : 1)
|
||||
}, 0).toFixed(2)
|
||||
}, 0)
|
||||
return (goodsTotalPrice + $seatFee.totalAmount || 0).toFixed(2)
|
||||
})
|
||||
|
||||
function setGoodsItem(key, val) {
|
||||
|
|
@ -430,12 +437,18 @@
|
|||
page: 0,
|
||||
size: 300,
|
||||
masterId: option.masterId,
|
||||
tableId: option.tableId
|
||||
tableId: table.value.tableId
|
||||
}) {
|
||||
const {
|
||||
records,
|
||||
seatFee
|
||||
} = await Api.getCart(par)
|
||||
if (seatFee && seatFee.useType) {
|
||||
$storageManage.useType(seatFee.useType)
|
||||
// uni.setStorageSync('useType',seatFee.useType);
|
||||
eatTypes.active = seatFee.useType == 'takeout' ? seatFee.useType : seatFee.useType.replace(
|
||||
/-after|-before/g, '');
|
||||
}
|
||||
goods.list = getNowCart(records)
|
||||
if (seatFee && seatFee.totalNumber) {
|
||||
userNumbers.defaultCateIndex = seatFee.totalNumber || 1
|
||||
|
|
@ -445,7 +458,9 @@
|
|||
console.log(goods.list);
|
||||
}
|
||||
|
||||
let $shop = ref()
|
||||
let $shop = ref({
|
||||
registerType: ''
|
||||
})
|
||||
// 获取账号信息
|
||||
async function getTbShopInfo() {
|
||||
const res = await tbShopInfo()
|
||||
|
|
@ -453,7 +468,7 @@
|
|||
console.log(res);
|
||||
return res
|
||||
}
|
||||
|
||||
|
||||
// 创建订单
|
||||
async function createOrder(par = {
|
||||
masterId: option.masterId,
|
||||
|
|
@ -461,29 +476,48 @@
|
|||
note: note.value,
|
||||
postPay: true,
|
||||
orderId: '',
|
||||
tableId: option.tableId
|
||||
tableId: table.value.tableId
|
||||
}) {
|
||||
updateChoseCount()
|
||||
if (!$shop.value.isTableFee) {
|
||||
//不免餐位费
|
||||
await Api.$choseCount({
|
||||
masterId: option.masterId,
|
||||
tableId: table.value.tableId,
|
||||
num: userNumbers.defaultCateIndex,
|
||||
})
|
||||
}
|
||||
// updateChoseCount()
|
||||
const res = await Api.$createOrder(par)
|
||||
console.log($shop.value);
|
||||
if($shop.value.registerType=='munchies'){
|
||||
console.log(res);
|
||||
if ($shop.value.registerType == 'munchies') {
|
||||
//先付
|
||||
return go.to('PAGES_ORDER_DETAIL',{
|
||||
id:res.id
|
||||
return go.to('PAGES_CRESATE_ORDER_PAY', {
|
||||
orderId: res.id
|
||||
})
|
||||
} else {
|
||||
//后付
|
||||
uni.navigateBack({delta:2})
|
||||
// return go.to('PAGES_ORDER_DETAIL', {
|
||||
// id: res.id
|
||||
// })
|
||||
}
|
||||
uni.showToast({
|
||||
title: '提交成功',
|
||||
icon: 'none'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.$emit('orderDetail:update')
|
||||
uni.navigateBack({
|
||||
delta: 2
|
||||
})
|
||||
}, 500)
|
||||
// setTimeout(() => {
|
||||
// uni.$emit('orderDetail:update')
|
||||
// uni.navigateBack({
|
||||
// delta: 2
|
||||
// })
|
||||
// }, 500)
|
||||
}
|
||||
|
||||
|
||||
function init(){
|
||||
|
||||
}
|
||||
|
||||
onLoad((opt) => {
|
||||
console.log(opt);
|
||||
Object.assign(option, opt)
|
||||
|
|
@ -493,9 +527,10 @@
|
|||
name: opt.name
|
||||
}
|
||||
}
|
||||
init()
|
||||
getCart()
|
||||
getTbShopInfo()
|
||||
updateChoseCount()
|
||||
// updateChoseCount()
|
||||
})
|
||||
|
||||
async function changeUseType() {
|
||||
|
|
@ -512,8 +547,10 @@
|
|||
useType = `dine-in-${isPayAfter? "after" : "before"}`;
|
||||
uni.setStorageSync("useType", useType);
|
||||
}
|
||||
const tableId = useType=='takeout'?undefined: table.value.tableId;
|
||||
const res = await Api.$changeUseType({
|
||||
useType,
|
||||
tableId,
|
||||
cartIds: goods.list.map((v) => v.id),
|
||||
})
|
||||
return res
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@
|
|||
<view>¥</view>
|
||||
<view>{{allPrice}}</view>
|
||||
</view>
|
||||
<my-button shape="circle" height="80" width="220" @tap="toConfimOrder">去下单</my-button>
|
||||
<my-button shape="circle" height="80" width="220" @tap="toConfimOrder">{{table.type=='add'?'确认加菜':'去下单'}} </my-button>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@
|
|||
</scroll-view>
|
||||
</view>
|
||||
<view class="bottom w-full">
|
||||
<my-car @updateNumber="carsNumberChange" :user="data.vipUser" :masterId="data.masterId" :table="data.table"
|
||||
<my-car @updateNumber="carsNumberChange" :user="data.vipUser" :masterId="data.masterId" :table="data.table"
|
||||
:data="cars" @clear="onClearCart"></my-car>
|
||||
</view>
|
||||
|
||||
|
|
@ -128,6 +128,12 @@
|
|||
import {
|
||||
getNowCart
|
||||
} from '@/pagesCreateOrder/util.js'
|
||||
import {
|
||||
$returnUseType
|
||||
} from './util.js'
|
||||
import {
|
||||
tbShopInfo
|
||||
} from '@/http/yskApi/user.js'
|
||||
const cars = reactive([])
|
||||
const data = reactive({
|
||||
scrollTop: 0, //tab标题的滚动条位置
|
||||
|
|
@ -153,7 +159,19 @@
|
|||
},
|
||||
|
||||
})
|
||||
|
||||
|
||||
// 获取账号信息
|
||||
let $shop=ref({})
|
||||
async function getTbShopInfo() {
|
||||
const res = await tbShopInfo()
|
||||
$shop.value = res
|
||||
const useType=data.table.status=='using'?data.table.useType:$returnUseType(res)
|
||||
uni.setStorageSync('useType',useType)
|
||||
console.log(res);
|
||||
return res
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function setTabBar(category, goods, cars) {
|
||||
|
|
@ -247,6 +265,9 @@
|
|||
}
|
||||
//加入购物车
|
||||
function addCart(par) {
|
||||
if(!data.table.tableId){
|
||||
return infoBox.showToast('请先选择台桌!')
|
||||
}
|
||||
const submitPar = {
|
||||
masterId: data.masterId,
|
||||
tableId: data.table.tableId,
|
||||
|
|
@ -318,18 +339,8 @@
|
|||
}
|
||||
}
|
||||
async function init() {
|
||||
getTbShopInfo()
|
||||
getTableInfo()
|
||||
const {
|
||||
masterId
|
||||
} = await getMasterId()
|
||||
data.masterId = masterId
|
||||
const cartRes = await getCart()
|
||||
cars.length = 0
|
||||
const cartArr = getNowCart(cartRes.records)
|
||||
for (let i in cartArr) {
|
||||
cars.push(cartArr[i])
|
||||
}
|
||||
|
||||
const categoryRes = await getCategory()
|
||||
const category = categoryRes.content.reduce((prve, cur) => {
|
||||
prve.push({
|
||||
|
|
@ -347,6 +358,21 @@
|
|||
}
|
||||
return isShow;
|
||||
});
|
||||
if(!data.table.tableId){
|
||||
//无台桌
|
||||
setTabBar(category, goods, [])
|
||||
return
|
||||
}
|
||||
const {
|
||||
masterId
|
||||
} = await getMasterId()
|
||||
data.masterId = masterId
|
||||
const cartRes = await getCart()
|
||||
cars.length = 0
|
||||
const cartArr = getNowCart(cartRes.records)
|
||||
for (let i in cartArr) {
|
||||
cars.push(cartArr[i])
|
||||
}
|
||||
|
||||
setTabBar(category, goods, cars)
|
||||
|
||||
|
|
@ -849,12 +875,15 @@
|
|||
onLoad((opt) => {
|
||||
console.log(opt)
|
||||
Object.assign(data.table, opt)
|
||||
if (!opt.tableId) {
|
||||
infoBox.showErrorToast('暂不支持不选择台桌下载,请从桌台点餐')
|
||||
return setTimeout(() => {
|
||||
go.back()
|
||||
}, 1500)
|
||||
if(opt.useType){
|
||||
uni.setStorageSync('useType',opt.useType)
|
||||
}
|
||||
// if (!opt.tableId) {
|
||||
// infoBox.showErrorToast('暂不支持不选择台桌下载,请从桌台点餐')
|
||||
// return setTimeout(() => {
|
||||
// go.back()
|
||||
// }, 1500)
|
||||
// }
|
||||
init()
|
||||
})
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,52 +1,74 @@
|
|||
//根据店铺信息返回是否是后付款
|
||||
export function $trturnPayAfter(shop) {
|
||||
//munchies 先付 restaurant 后付
|
||||
const payAfter = shop.registerType == "munchies" ? false : true;
|
||||
return payAfter
|
||||
}
|
||||
//根据店铺信息返回就餐类型
|
||||
export function $returnUseType(shop, useType) {
|
||||
//是否是后付款
|
||||
const payAfter = $trturnPayAfter(shop)
|
||||
let result = "takeout";
|
||||
if (useType == "takeout") {
|
||||
result = 'takeout'
|
||||
} else {
|
||||
//堂食
|
||||
result = `dine-in-${payAfter ? "after" : "before"}`;
|
||||
}
|
||||
return result
|
||||
}
|
||||
//判断商品是否可以下单
|
||||
export function isCanBuy(goods,isStock) {
|
||||
return goods.isGrounding && goods.isPauseSale == 0 && (isStock?goods.stockNumber > 0:true) ;
|
||||
export function isCanBuy(goods, isStock) {
|
||||
return goods.isGrounding && goods.isPauseSale == 0 && (isStock ? goods.stockNumber > 0 : true);
|
||||
}
|
||||
|
||||
|
||||
// 一个数组是否包含另外一个数组全部元素
|
||||
function arrayContainsAll(arr1, arr2) {
|
||||
for (let i = 0; i < arr2.length; i++) {
|
||||
if (!arr1.includes(arr2[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
for (let i = 0; i < arr2.length; i++) {
|
||||
if (!arr1.includes(arr2[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//n项 n-1项组合,生成全部结果
|
||||
function generateCombinations(arr, k) {
|
||||
let result = [];
|
||||
let result = [];
|
||||
|
||||
function helper(index, current) {
|
||||
if (current.length === k) {
|
||||
result.push(current.slice()); // 使用slice()来避免直接修改原始数组
|
||||
} else {
|
||||
for (let i = index; i < arr.length; i++) {
|
||||
current.push(arr[i]); // 将当前元素添加到组合中
|
||||
helper(i + 1, current); // 递归调用,索引增加以避免重复选择相同的元素
|
||||
current.pop(); // 回溯,移除当前元素以便尝试其他组合
|
||||
}
|
||||
}
|
||||
}
|
||||
function helper(index, current) {
|
||||
if (current.length === k) {
|
||||
result.push(current.slice()); // 使用slice()来避免直接修改原始数组
|
||||
} else {
|
||||
for (let i = index; i < arr.length; i++) {
|
||||
current.push(arr[i]); // 将当前元素添加到组合中
|
||||
helper(i + 1, current); // 递归调用,索引增加以避免重复选择相同的元素
|
||||
current.pop(); // 回溯,移除当前元素以便尝试其他组合
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
helper(0, []); // 从索引0开始,初始空数组作为起点
|
||||
return result;
|
||||
helper(0, []); // 从索引0开始,初始空数组作为起点
|
||||
return result;
|
||||
}
|
||||
|
||||
function returnReverseVal(val, isReturnString = true) {
|
||||
const isBol = typeof val === "boolean";
|
||||
const isString = typeof val === "string";
|
||||
let reverseNewval = "";
|
||||
if (isBol) {
|
||||
reverseNewval = !val;
|
||||
}
|
||||
if (isString) {
|
||||
reverseNewval = val === "true" ? "false" : "true";
|
||||
}
|
||||
return reverseNewval;
|
||||
const isBol = typeof val === "boolean";
|
||||
const isString = typeof val === "string";
|
||||
let reverseNewval = "";
|
||||
if (isBol) {
|
||||
reverseNewval = !val;
|
||||
}
|
||||
if (isString) {
|
||||
reverseNewval = val === "true" ? "false" : "true";
|
||||
}
|
||||
return reverseNewval;
|
||||
}
|
||||
|
||||
export default{
|
||||
isCanBuy,arrayContainsAll,generateCombinations,returnReverseVal
|
||||
export default {
|
||||
isCanBuy,
|
||||
arrayContainsAll,
|
||||
generateCombinations,
|
||||
returnReverseVal,$returnUseType
|
||||
}
|
||||
|
|
@ -58,16 +58,15 @@
|
|||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
<view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card top border-r-12 ">
|
||||
|
||||
|
||||
</view>
|
||||
<view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card bottom border-r-12 ">
|
||||
|
||||
<view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card bottom border-r-12 ">
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<edit-discount title="优惠金额" :ref="setModel" name="editMoney" :price="order.amount"></edit-discount>
|
||||
</view>
|
||||
|
|
@ -84,7 +83,7 @@
|
|||
} from '@dcloudio/uni-app'
|
||||
import * as Api from '@/http/yskApi/Instead.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue'
|
||||
import editDiscount from '/pagesCreateOrder/components/edit-discount.vue'
|
||||
const pays = reactive({
|
||||
list: ['扫码收款', '二维码收款'],
|
||||
selIndex: 0,
|
||||
|
|
@ -116,27 +115,37 @@
|
|||
pays.payTypes.selIndex = i
|
||||
}
|
||||
//支付成功回调
|
||||
function paySuccess(){
|
||||
function paySuccess() {
|
||||
infoBox.showToast('支付成功')
|
||||
setTimeout(() => {
|
||||
// uni.$emit('orderDetail:update')
|
||||
uni.navigateBack({delta:2})
|
||||
uni.navigateBack({
|
||||
delta: 2
|
||||
})
|
||||
}, 500)
|
||||
}
|
||||
async function payOrder() {
|
||||
async function payOrder(code) {
|
||||
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
|
||||
await Api.$payOrder({
|
||||
console.log({
|
||||
tableId: order.tableId,
|
||||
masterId: order.masterId,
|
||||
orderId: order.id||order.orderId,
|
||||
orderId: order.id || order.orderId,
|
||||
payType,
|
||||
vipUserId: order.userId,
|
||||
discount: 1,
|
||||
code: ''
|
||||
code: code
|
||||
});
|
||||
await Api.$payOrder({
|
||||
tableId: order.tableId,
|
||||
masterId: order.masterId,
|
||||
orderId: order.id || order.orderId,
|
||||
payType,
|
||||
vipUserId: order.userId,
|
||||
code: code
|
||||
})
|
||||
paySuccess()
|
||||
}
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
getPayType()
|
||||
})
|
||||
|
|
@ -148,18 +157,10 @@
|
|||
const item = pays.payTypes.list[pays.payTypes.selIndex]
|
||||
uni.scanCode({
|
||||
onlyFromCamera: true,
|
||||
success:function (res) {
|
||||
success: function(res) {
|
||||
console.log('条码类型:' + res.scanType);
|
||||
console.log('条码内容:' + res.result);
|
||||
Api.$payOrder({
|
||||
"orderId": order.orderId, // 订单id
|
||||
"payType": item.payType, //
|
||||
"discount": order.discount,
|
||||
"code": res.result
|
||||
}).then(res=>{
|
||||
console.log(res);
|
||||
paySuccess()
|
||||
})
|
||||
payOrder(res.result)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,12 @@
|
|||
<view class="default-box-padding bg-fff border-r-12 u-m-t-20">
|
||||
<view class="u-flex u-row-between">
|
||||
<view class="font-bold">附加费</view>
|
||||
<my-button plain shape="circle" :width="160" :height="56">退菜</my-button>
|
||||
<template v-if="orderInfo.status=='unpaid'">
|
||||
<my-button plain shape="circle" :width="160" :height="56" @click="tuicai">退菜</my-button>
|
||||
</template>
|
||||
<template v-if="orderInfo.status=='closed'">
|
||||
<my-button plain shape="circle" :width="160" :height="56" @click="tuikuan">退款</my-button>
|
||||
</template>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>{{data.name||'餐位费'}}</view>
|
||||
|
|
@ -18,6 +23,10 @@
|
|||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
orderInfo:{
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
table:{
|
||||
type: Object,
|
||||
default: () => {}
|
||||
|
|
@ -27,9 +36,16 @@
|
|||
const statusMap={
|
||||
unpaid:'未支付'
|
||||
}
|
||||
const emits=defineEmits(['tuicai','tuikuan','printOrder'])
|
||||
function returnStatus(status){
|
||||
return statusMap[status]||''
|
||||
}
|
||||
function tuikuan(){
|
||||
emits('tuikuan',props.data)
|
||||
}
|
||||
function tuicai(){
|
||||
emits('tuicai',props.data)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
|
|
@ -17,15 +17,23 @@
|
|||
<view class="u-p-l-30 u-flex-1">
|
||||
<view class="u-flex u-row-between u-col-top">
|
||||
|
||||
<view class="u-flex">
|
||||
<view class="tui" v-if="item.status=='return'">
|
||||
已退
|
||||
<view class="">
|
||||
<view class="u-flex">
|
||||
<view class="tui" v-if="item.status=='return'">
|
||||
已退
|
||||
</view>
|
||||
<view :class="{'line-th':item.status=='return'}">{{item.name||item.productName}}</view>
|
||||
</view>
|
||||
<view :class="{'line-th':item.status=='return'}">{{item.name||item.productName}}</view>
|
||||
<view class="color-999 u-font-24 u-m-t-10">{{item.productSkuName||''}}</view>
|
||||
</view>
|
||||
<view class="u-text-right">
|
||||
<view>¥{{item.salePrice||item.price}}</view>
|
||||
<view v-if="item.status=='return'" class="line-th color-666 u-font-24">¥{{item.salePrice||item.price}}</view>
|
||||
<template v-if="item.status=='return'">
|
||||
<view >¥0.00</view>
|
||||
<view class="line-th color-666 u-font-24">¥{{item.salePrice||item.price}}</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view >¥{{item.salePrice||item.price}}</view>
|
||||
</template>
|
||||
<view class="u-m-t-10 u-font-24">X{{item.number||item.num}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>订单类型</view>
|
||||
<view>堂食</view>
|
||||
<view>{{returnUseType(data.useType)}}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>桌位号</view>
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>下单时间</view>
|
||||
<view ><up-text v-if="data.createdAt" mode="date" :text="data.createdAt"></up-text></view>
|
||||
<view><up-text v-if="data.createdAt" mode="date" :text="data.createdAt"></up-text></view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>订单编号</view>
|
||||
|
|
@ -46,19 +46,28 @@
|
|||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
table:{
|
||||
table: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
seatFee:{
|
||||
seatFee: {
|
||||
type: Object,
|
||||
default: () => {totalNumber:0}
|
||||
default: () => {
|
||||
totalNumber: 0
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
function returnStatus(status){
|
||||
const item=orderEnum.status.find(v=>v.key==status)
|
||||
return item?item.label:''
|
||||
|
||||
function returnStatus(status) {
|
||||
const item = orderEnum.status.find(v => v.key == status)
|
||||
return item ? item.label : ''
|
||||
}
|
||||
|
||||
function returnUseType(useType) {
|
||||
if (!useType) {
|
||||
return ''
|
||||
}
|
||||
return useType == "takeout" ? '堂食' : '自取';
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -5,9 +5,11 @@
|
|||
<text class="color-666">桌位号:</text>
|
||||
<text class="font-bold">{{orderDetail.info.tableName}}</text>
|
||||
</view>
|
||||
<goods-list @printOrder="onPrintOrder" @tuikuan="onTuikuan" :orderInfo="orderDetail.info" :data="orderDetail.goodsList" :seatFee="orderDetail.seatFee.totalAmount"
|
||||
@tuicai="onTuiCai"></goods-list>
|
||||
<extra-vue :data="orderDetail.seatFee"></extra-vue>
|
||||
<goods-list @printOrder="onPrintOrder" @tuikuan="onTuikuan" :orderInfo="orderDetail.info"
|
||||
:data="orderDetail.goodsList" :seatFee="orderDetail.seatFee.totalAmount" @tuicai="onTuiCai"></goods-list>
|
||||
<template v-if="orderDetail.seatFee.totalNumber&&orderDetail.seatFee.totalAmount">
|
||||
<extra-vue @tuicai="onSeatFeeTuicai" @tuikuan="onSeatFeeTuiKuan" :orderInfo="orderDetail.info" :data="orderDetail.seatFee"></extra-vue>
|
||||
</template>
|
||||
<order-vue :data="orderDetail.info" :table="options" :seatFee="orderDetail.seatFee"></order-vue>
|
||||
<step-vue></step-vue>
|
||||
<view style="height: 200rpx;"></view>
|
||||
|
|
@ -51,58 +53,84 @@
|
|||
onHide
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
reactive, ref
|
||||
reactive,
|
||||
ref
|
||||
} from 'vue';
|
||||
import OrderDetail from './page.js'
|
||||
const tuicai = reactive({
|
||||
show: false,
|
||||
isSeatFee:false,
|
||||
selGoods: {}
|
||||
})
|
||||
|
||||
|
||||
function onSeatFeeTuicai(seatFee){
|
||||
tuicai.show = true
|
||||
tuicai.isSeatFee = seatFee
|
||||
tuicai.selGoods = seatFee
|
||||
}
|
||||
function onSeatFeeTuiKuan(seatFee){
|
||||
go.to('PAGES_ORDER_TUIKUAN', {
|
||||
|
||||
})
|
||||
}
|
||||
function onTuiCai(goods, index) {
|
||||
console.log(goods);
|
||||
tuicai.show = true
|
||||
tuicai.selGoods = goods
|
||||
}
|
||||
async function printDishes(){
|
||||
try{
|
||||
const res= await Api.$printDishes({
|
||||
tableId:orderDetail.info.tableId
|
||||
})
|
||||
infoBox.showToast('已发送打印请求')
|
||||
}catch(e){
|
||||
infoBox.showToast('发送打印请求失败')
|
||||
//TODO handle the exception
|
||||
}
|
||||
|
||||
}
|
||||
function onPrintOrder(){
|
||||
uni.showModal({
|
||||
title:'提示',
|
||||
content:'是否打印当前台桌菜品',
|
||||
success(res) {
|
||||
if(res.confirm){
|
||||
printDishes()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
function onTuikuan(goods, index){
|
||||
go.to('PAGES_ORDER_TUIKUAN',{
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
async function tuicaiConfirm() {
|
||||
console.log(tuicai.selGoods);
|
||||
const res = await Api.$returnCart({
|
||||
cartId:tuicai.selGoods.hasOwnProperty('cartId')? tuicai.selGoods.cartId:tuicai.selGoods.id,
|
||||
cartId: tuicai.selGoods.hasOwnProperty('cartId') ? tuicai.selGoods.cartId : tuicai.selGoods.id,
|
||||
tableId: orderDetail.info.tableId,
|
||||
})
|
||||
tuicai.selGoods.status = 'return'
|
||||
tuicai.show = false
|
||||
}
|
||||
|
||||
|
||||
async function printDishes() {
|
||||
try {
|
||||
const res = await Api.$printDishes({
|
||||
tableId: orderDetail.info.tableId
|
||||
})
|
||||
infoBox.showToast('已发送打印请求')
|
||||
} catch (e) {
|
||||
infoBox.showToast('发送打印请求失败')
|
||||
//TODO handle the exception
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function onPrintOrder() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '是否打印当前台桌菜品',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
printDishes()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function onTuikuan(goods, index) {
|
||||
const {id,productId,productSkuId,productName,productSkuName,cartId,num,priceAmount,price}=goods
|
||||
go.to('PAGES_ORDER_TUIKUAN', {
|
||||
id,
|
||||
cartId,
|
||||
productId,
|
||||
productSkuId,
|
||||
productName,
|
||||
num,
|
||||
number:0,
|
||||
productSkuName:productSkuName||'',
|
||||
priceAmount,price
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
const uiPage = new OrderDetail()
|
||||
setTimeout(() => {
|
||||
uiPage.setVal('user', {
|
||||
|
|
@ -112,8 +140,8 @@
|
|||
|
||||
function diancan() {
|
||||
go.to('PAGES_CREATE_ORDER', {
|
||||
tableId: options.tableId,
|
||||
tableName: options.name,
|
||||
tableId: options.tableId || orderDetail.info.tableId,
|
||||
name: options.name || orderDetail.info.tableName,
|
||||
type: 'add'
|
||||
})
|
||||
}
|
||||
|
|
@ -138,13 +166,13 @@
|
|||
const options = reactive({})
|
||||
async function init() {
|
||||
const res = await orderApi.tbOrderInfoDetail(options.id)
|
||||
if(res.detailList.length){
|
||||
uni.setStorageSync('useType',res.detailList[0].useType)
|
||||
if (res.detailList.length) {
|
||||
uni.setStorageSync('useType', res.detailList[0].useType)
|
||||
}
|
||||
const masterId = res.masterId
|
||||
options.masterId = res.masterId
|
||||
if (res.status == 'unpaid') {
|
||||
// if (false) {
|
||||
// if (res.status == 'unpaid') {
|
||||
if (false) {
|
||||
const {
|
||||
records,
|
||||
seatFee
|
||||
|
|
@ -161,6 +189,7 @@
|
|||
for (let i in res.detailList) {
|
||||
const goods = res.detailList[i]
|
||||
if (goods.productName != '客座费') {
|
||||
console.log(goods);
|
||||
if (goodsMap.hasOwnProperty(goods.placeNum)) {
|
||||
goodsMap[goods.placeNum].push(goods)
|
||||
} else {
|
||||
|
|
@ -181,7 +210,6 @@
|
|||
}))
|
||||
console.log(orderDetail.goodsList);
|
||||
}
|
||||
console.log(orderDetail);
|
||||
orderDetail.info = res
|
||||
}
|
||||
|
||||
|
|
@ -192,20 +220,21 @@
|
|||
init()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 监听选择用户事件
|
||||
let user = ref(null)
|
||||
//更新选择用户
|
||||
function setUser(par) {
|
||||
const submitPar = {
|
||||
masterId: option.masterId,
|
||||
tableId: option.tableId,
|
||||
masterId: options.masterId,
|
||||
tableId: options.tableId,
|
||||
vipUserId: user.value.id ? user.value.id : '',
|
||||
type: user.value.id ? 0 : 1 //0 设置 1 取消
|
||||
}
|
||||
Object.assign(submitPar, par)
|
||||
return Api.$setUser(submitPar)
|
||||
}
|
||||
|
||||
function watchChooseuser() {
|
||||
uni.$off('choose-user')
|
||||
uni.$on('choose-user', (data) => {
|
||||
|
|
@ -214,15 +243,15 @@
|
|||
setUser()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
onShow(() => {
|
||||
watchEmit()
|
||||
watchChooseuser()
|
||||
init()
|
||||
})
|
||||
onLoad((opt) => {
|
||||
Object.assign(options, opt)
|
||||
console.log(options);
|
||||
init()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -96,7 +96,8 @@
|
|||
}
|
||||
}
|
||||
goodsMapInit()
|
||||
watch(() => props.data.detailList, (newval) => {
|
||||
watch(() => props.data.detailList.length, (newval) => {
|
||||
goodsNumber.value=0
|
||||
goodsMapInit()
|
||||
})
|
||||
|
||||
|
|
@ -111,8 +112,10 @@
|
|||
}
|
||||
|
||||
function sendTypeFilter(t) {
|
||||
console.log(t);
|
||||
if (t) {
|
||||
return orderEnum.sendType.find(item => item.key == t).label;
|
||||
const item=orderEnum.sendType.find(item => item.key == t)
|
||||
return item?item.label:'';
|
||||
} else {
|
||||
return t;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<view class="list">
|
||||
<view v-for="(item,index) in list" :key="index">
|
||||
<order-item @printOrder="print" :data="item" :index="index"></order-item>
|
||||
<order-item @printOrder="print" :key="index" :data="item" :index="index"></order-item>
|
||||
</view>
|
||||
<view v-if="hasAjax&&!list.length">
|
||||
<my-img-empty tips="亲,你还没有订单哦~"></my-img-empty>
|
||||
|
|
|
|||
|
|
@ -4,16 +4,18 @@
|
|||
<view class="search bg-fff u-p-t-32 u-p-l-28 u-p-r-28 u-p-b-32">
|
||||
<up-search v-bind="search" v-model="search.val"></up-search>
|
||||
</view>
|
||||
<filter-vue v-model:time="pageData.order.query.createdAt"></filter-vue>
|
||||
<filter-vue v-model:time="order.data.query.createdAt"></filter-vue>
|
||||
</view>
|
||||
<order-list @printOrder="onPrintOrder" :hasAjax="pageData.order.hasAjax" :list="pageData.order.list"></order-list>
|
||||
<my-pagination :totalElements="pageData.order.totalElements"></my-pagination>
|
||||
<order-list @printOrder="onPrintOrder" :hasAjax="order.data.hasAjax" :list="order.data.list"></order-list>
|
||||
<my-pagination @change="pageChange" :totalElements="order.data.total"></my-pagination>
|
||||
<view style="height: 100rpx;"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {onLoad,onShow,onPullDownRefresh} from '@dcloudio/uni-app'
|
||||
import * as Api from '@/http/yskApi/order.js'
|
||||
import LIST from '@/commons/class/list.js'
|
||||
import {$printOrder} from '@/http/yskApi/Instead.js'
|
||||
import filterVue from './compoents/filter.vue';
|
||||
import orderList from './compoents/order-list.vue';
|
||||
|
|
@ -21,6 +23,7 @@
|
|||
import {
|
||||
reactive, watch
|
||||
} from 'vue';
|
||||
|
||||
const search = reactive({
|
||||
val: '',
|
||||
placeholder: '搜索单号/昵称/姓名/手机号码/商品名称',
|
||||
|
|
@ -33,36 +36,47 @@
|
|||
}
|
||||
})
|
||||
|
||||
const pageData = reactive({
|
||||
order: {
|
||||
list: [],
|
||||
totalElements:0,
|
||||
hasAjax:false,
|
||||
query: {
|
||||
createdAt: [],
|
||||
id: "",
|
||||
orderNo: "",
|
||||
orderType: "0",
|
||||
page: 0,
|
||||
pageSize: 10,
|
||||
payType: "",
|
||||
productName: "",
|
||||
status: ""
|
||||
}
|
||||
const order=new LIST({
|
||||
list: [],
|
||||
query: {
|
||||
createdAt: [],
|
||||
id: "",
|
||||
orderNo: "",
|
||||
orderType: "0",
|
||||
page: 0,
|
||||
pageSize: 10,
|
||||
payType: "",
|
||||
productName: "",
|
||||
status: ""
|
||||
}
|
||||
})
|
||||
watch(()=>pageData.order.query.createdAt,(newval)=>{
|
||||
function pageChange(e){
|
||||
order.setVal('page',e)
|
||||
console.log(e);
|
||||
console.log(order.data.page);
|
||||
init()
|
||||
}
|
||||
|
||||
console.log(order.list);
|
||||
|
||||
watch(()=>order.data.query.createdAt,(newval)=>{
|
||||
init()
|
||||
})
|
||||
async function init() {
|
||||
const {content,totalElements}=await Api.tbOrderInfoData(pageData.order.query)
|
||||
pageData.order.hasAjax=true
|
||||
pageData.order.totalElements=totalElements
|
||||
pageData.order.list=content
|
||||
console.log(content);
|
||||
const {content,totalElements}=await Api.tbOrderInfoData({...order.data.query,page:order.data.page})
|
||||
uni.stopPullDownRefresh()
|
||||
order.setVal('list',content)
|
||||
console.log(order.data.list);
|
||||
order.setVal('total',totalElements)
|
||||
order.setVal('hasAjax',true)
|
||||
}
|
||||
init()
|
||||
onPullDownRefresh(()=>{
|
||||
pageData.order.query.page=0
|
||||
init()
|
||||
})
|
||||
|
||||
|
||||
onShow(init)
|
||||
async function printOrder(item){
|
||||
try{
|
||||
console.log(item);
|
||||
|
|
|
|||
|
|
@ -49,51 +49,54 @@
|
|||
<text>余额:</text>
|
||||
<text>¥0.00</text>
|
||||
</view> -->
|
||||
<my-radio @click="changePayType(index)" :modelValue="index==pays.payTypes.selIndex">
|
||||
<my-radio @click="changePayType(index)"
|
||||
:modelValue="index==pays.payTypes.selIndex">
|
||||
</my-radio>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-60 u-p-b-30">
|
||||
<my-button @click="payOrder">确认付款</my-button>
|
||||
<my-button @click="payOrderClick">确认付款</my-button>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="">
|
||||
<view class="u-font-32 u-m-t-40 u-text-center">请让顾客使用微信扫码</view>
|
||||
<view class="u-flex u-row-center u-m-t-40 ">
|
||||
<up-qrcode :size="140" val="uview-plus"></up-qrcode>
|
||||
<up-qrcode :size="140" :val="payCodeUrl"></up-qrcode>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 二维码支付扫码 -->
|
||||
<template v-if="pays.selIndex==1">
|
||||
<template v-if="pays.selIndex==1">
|
||||
<view class="card border-bottom top u-m-t-32">
|
||||
|
||||
|
||||
</view>
|
||||
<view class="bg-fff card bottom border-r-12 u-p-32">
|
||||
<view class="font-bold u-font-32 u-text-center">
|
||||
¥{{discount.currentPrice?discount.currentPrice: order.amount}}</view>
|
||||
<view class="u-flex u-row-center u-m-t-24">
|
||||
<up-loading-icon size="14" text="等待支付"></up-loading-icon>
|
||||
<view class="u-flex pay-success">
|
||||
<up-icon color="#5CBB6F" name="checkmark-circle-fill"></up-icon>
|
||||
<view class="u-m-l-6">支付成功</view>
|
||||
</view>
|
||||
<template v-if="order.status=='unpaid'">
|
||||
<up-loading-icon size="14" text="等待支付"></up-loading-icon>
|
||||
</template>
|
||||
<template v-if="order.status=='closed'">
|
||||
<view class="u-flex pay-success">
|
||||
<up-icon color="#5CBB6F" name="checkmark-circle-fill"></up-icon>
|
||||
<view class="u-m-l-6">支付成功</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -107,7 +110,8 @@
|
|||
reactive,
|
||||
onMounted,
|
||||
watch,
|
||||
ref
|
||||
ref,
|
||||
onBeforeUnmount
|
||||
} from 'vue';
|
||||
import {
|
||||
onLoad
|
||||
|
|
@ -119,6 +123,12 @@
|
|||
|
||||
let payStatus = ref(null) //loading success
|
||||
|
||||
let timer = null
|
||||
|
||||
function clear() {
|
||||
clearInterval(timer)
|
||||
timer = null
|
||||
}
|
||||
|
||||
const pays = reactive({
|
||||
list: ['扫码收款', '二维码收款'],
|
||||
|
|
@ -129,6 +139,22 @@
|
|||
}
|
||||
})
|
||||
|
||||
watch(() => pays.selIndex, (newval) => {
|
||||
clearInterval(timer)
|
||||
if (newval) {
|
||||
timer = setInterval(() => {
|
||||
orderApi.tbOrderInfoDetail(order.orderId).then(res => {
|
||||
order.status=res.status
|
||||
if(res.status=='closed'){
|
||||
paySuccess()
|
||||
}
|
||||
})
|
||||
}, 2000)
|
||||
} else {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
const models = new Map();
|
||||
|
||||
function setModel(el) {
|
||||
|
|
@ -169,6 +195,15 @@
|
|||
})
|
||||
}, 500)
|
||||
}
|
||||
|
||||
function payOrderClick(){
|
||||
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
|
||||
console.log(payType);
|
||||
if(payType=='scanCode'||payType=='deposit'){
|
||||
return saomaPay()
|
||||
}
|
||||
payOrder()
|
||||
}
|
||||
async function payOrder() {
|
||||
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
|
||||
await Api.$payOrder({
|
||||
|
|
@ -190,6 +225,8 @@
|
|||
amount: 0
|
||||
})
|
||||
|
||||
|
||||
|
||||
function saomaPay() {
|
||||
const item = pays.payTypes.list[pays.payTypes.selIndex]
|
||||
uni.scanCode({
|
||||
|
|
@ -223,14 +260,26 @@
|
|||
return saomaPay('scanCode')
|
||||
}
|
||||
})
|
||||
let payCodeUrl = ref('')
|
||||
async function init() {
|
||||
|
||||
const res = await orderApi.tbOrderInfoDetail(order.orderId)
|
||||
Object.assign(order, res)
|
||||
}
|
||||
onLoad((opt) => {
|
||||
orderApi.$getOrderPayUrl({
|
||||
orderId: opt.orderId
|
||||
}).then(res => {
|
||||
payCodeUrl.value = res
|
||||
})
|
||||
console.log(opt);
|
||||
Object.assign(order, opt)
|
||||
init()
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
clear()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
|
|
@ -1,22 +1,178 @@
|
|||
<template>
|
||||
<view>
|
||||
|
||||
<view class="min-page bg-gray u-p-30">
|
||||
<view class="bg-fff u-p-24 border-r-12 u-flex u-row-between">
|
||||
<view>全退</view>
|
||||
<view>
|
||||
<my-radio v-model="allTui"></my-radio>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bg-fff border-r-12 list u-m-t-32">
|
||||
<view class="u-flex u-row-between border-top item u-p-t-32 u-p-b-32"
|
||||
v-for="(item,index) in orderDetail.goodsList" :key="index">
|
||||
<view>
|
||||
<view>{{item.productName}}</view>
|
||||
<view class="u-m-t-10 color-999 u-font-24">{{item.productSkuName||""}}</view>
|
||||
<view class="u-m-t-10 color-999 u-font-24">最多可退×{{item.num}}</view>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<view class="color-red">¥{{item.priceAmount}}</view>
|
||||
<view class="u-flex u-m-l-32 u-col-center">
|
||||
<up-icon @click="changeItem(item,-1)" :size="20" name="minus-circle"></up-icon>
|
||||
<view class="u-m-l-28 u-m-r-28">{{item.number}}</view>
|
||||
<up-icon @click="changeItem(item,1)" :color="color.ColorMain" :size="20"
|
||||
name="plus-circle-fill"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bg-fff u-m-t-32 u-p-24 border-r-12 u-flex u-row-between">
|
||||
<view>支付金额</view>
|
||||
<view>
|
||||
{{to2(totalPrice)}}元
|
||||
</view>
|
||||
</view>
|
||||
<view class="bg-fff u-m-t-32 u-p-24 border-r-12 u-flex u-row-between">
|
||||
<view>退款金额</view>
|
||||
<view class="color-red">
|
||||
{{to2(tuikuanPrice)}}元
|
||||
</view>
|
||||
</view>
|
||||
<view class="bg-fff u-p-24 border-r-12 u-m-t-32">
|
||||
<view>退回优惠券</view>
|
||||
<view class="u-font-24 color-999 u-m-t-16">
|
||||
该订单未使用优惠券
|
||||
</view>
|
||||
</view>
|
||||
<view class="bg-fff u-p-24 border-r-12 u-m-t-32">
|
||||
<view>
|
||||
<text class="color-red">*</text>
|
||||
<text>退款原因</text>
|
||||
</view>
|
||||
<view class="u-m-t-24 u-flex u-flex-wrap gap-28">
|
||||
<view class="tag" @click="changeTuiKuanSel(index)" v-for="(item,index) in tuikuan.list" :key="index">
|
||||
{{item}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-24">
|
||||
<up-textarea placeholder="选填" v-model="note"></up-textarea>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view style="height: 200rpx;"></view>
|
||||
<view class="fixed-b">
|
||||
<up-button text="确认退款" shape="circle" type="primary" size="large" :color="color.ColorMain"></up-button>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
<script setup>
|
||||
import color from '@/commons/color.js';
|
||||
import * as orderApi from '@/http/yskApi/order.js'
|
||||
import {
|
||||
onLoad,
|
||||
onShow,
|
||||
onHide
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
computed,
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
let allTui = ref(false)
|
||||
let note = ref('')
|
||||
const tuikuan = reactive({
|
||||
list: ['点错', '数量点错', '客人要求', '协商退费'],
|
||||
sel: 0
|
||||
})
|
||||
|
||||
function changeTuiKuanSel(i) {
|
||||
tuikuan.sel = i
|
||||
}
|
||||
const orderDetail = reactive({
|
||||
goodsList: [],
|
||||
info: {},
|
||||
seatFee: {
|
||||
totalAmount: 0
|
||||
}
|
||||
})
|
||||
|
||||
watch(()=>allTui.value,(newval)=>{
|
||||
orderDetail.goodsList.map(v=>{
|
||||
v.number=newval?v.num:0
|
||||
})
|
||||
})
|
||||
|
||||
const totalPrice = computed(() => {
|
||||
return orderDetail.goodsList.reduce((prve, cur) => {
|
||||
return prve+cur.priceAmount*1
|
||||
}, 0)
|
||||
})
|
||||
const tuikuanPrice = computed(() => {
|
||||
return orderDetail.goodsList.reduce((prve, cur) => {
|
||||
return prve+cur.number*cur.price
|
||||
}, 0)
|
||||
})
|
||||
|
||||
|
||||
function to2(n){
|
||||
return Number(n).toFixed(2)
|
||||
}
|
||||
|
||||
function changeItem(item, step) {
|
||||
console.log(item);
|
||||
let newval = item.number * 1 + step * 1
|
||||
if (newval <= 0) {
|
||||
newval = 0
|
||||
}
|
||||
if (newval >= item.num) {
|
||||
newval = item.num
|
||||
}
|
||||
item.number = newval
|
||||
}
|
||||
onLoad((opt) => {
|
||||
if (Array.isArray(opt)) {
|
||||
orderDetail.goodsList = opt
|
||||
} else {
|
||||
orderDetail.goodsList = [opt]
|
||||
}
|
||||
console.log(opt);
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
<style lang="scss" scoped>
|
||||
.fixed-b {
|
||||
position: fixed;
|
||||
left: 110rpx;
|
||||
right: 110rpx;
|
||||
bottom: calc(env(safe-area-inset-bottom) + 32rpx);
|
||||
/* #ifdef H5 */
|
||||
bottom: 100rpx;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
</style>
|
||||
.gap-28 {
|
||||
gap: 28rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.list {
|
||||
padding: 0 24rpx;
|
||||
}
|
||||
|
||||
.list .item:first-child {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.tag {
|
||||
padding: 8rpx 16rpx 6rpx 16rpx;
|
||||
border: 1px solid #E5E5E5;
|
||||
border-radius: 4rpx;
|
||||
|
||||
&.active {
|
||||
border-color: #E6F0FF;
|
||||
color: $my-main-color;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32" viewBox="0 0 32 32"><defs><style>.a{fill:#80bcff;}.b{clip-path:url(#a);}.c{fill:#4c99fe;}</style><clipPath id="a"><rect class="a" width="32" height="32" transform="translate(-15261 9372)"/></clipPath></defs><g class="b" transform="translate(15261 -9372)"><path class="c" d="M23.412,15.668H13.271a1.71,1.71,0,0,1,0-3.385H23.412a1.71,1.71,0,0,1,0,3.385M6.082,20.654a1.647,1.647,0,0,0,1.5,1.781c.034,0,.069,0,.1.006a1.8,1.8,0,0,0,0-3.572,1.647,1.647,0,0,0-1.611,1.683c0,.034,0,.069.005.1m0-6.676A1.649,1.649,0,0,0,7.588,15.76l.1.005a1.71,1.71,0,0,0,1.606-1.788,1.71,1.71,0,0,0-1.605-1.786,1.71,1.71,0,0,0-1.606,1.786m17.325,8.37H13.271a1.71,1.71,0,0,1,0-3.385H23.412a1.71,1.71,0,0,1,0,3.385m6.93,5.453V6.638c0-2.538-2.113-2.352-2.113-2.352H16.312a1.76,1.76,0,0,1-1.1-.38,21.847,21.847,0,0,1-1.438-2.435C12.932-.221,11.834.06,11.834.06H2.622A2.641,2.641,0,0,0,0,2.719V27.613c0,3.1,2.113,2.728,2.113,2.728H28.481c2.2,0,1.86-2.54,1.86-2.54" transform="translate(-15260.509 9372.448)"/></g></svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
6
开发文档.md
6
开发文档.md
|
|
@ -19,8 +19,12 @@ H5, 不影响。
|
|||
|
||||
* uni-drawer 组件使用的 px :style="{width:drawerWidth+'px'}" 单位 使用时 请将组件内 改为rpx ``<view class="uni-drawer__content" :class="{'uni-drawer--right': rightMode,'uni-drawer--left': !rightMode, 'uni-drawer__content--visible': showDrawer}" :style="{width:drawerWidth+'rpx'}">``
|
||||
由于是动态传参 所以无法样式复写
|
||||
|
||||
|
||||
### 微信小程序兼容行考虑
|
||||
* 分包内组件路径为 /分包目录/*/组件名称; 使用@/分包目录/*/组件名称会报错。
|
||||
* 分包只能使用分包内的图路径或者static目录下 分包使用别的分包下图片会导致图片未找到
|
||||
* uni tabBar 配置项 请参考 [tabBar配置网址]<https://uniapp.dcloud.net.cn/collocation/pages.html#tabbar>
|
||||
*
|
||||
### 打包注意事项
|
||||
|
||||
* 准备资料:
|
||||
|
|
|
|||
Loading…
Reference in New Issue