Merge branch 'test' of https://e.coding.net/g-cphe0354/cashier_front/cashier_admin_app into dwb
This commit is contained in:
commit
82ad5973fb
|
|
@ -0,0 +1,163 @@
|
|||
import {
|
||||
$hasPermission
|
||||
} from '@/http/yskApi/shop.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
|
||||
const $PermissionObj = {
|
||||
data: [{
|
||||
key: 'yun_xu_cha_kan_jing_ying_shu_ju',
|
||||
text: '允许查看经营数据'
|
||||
},
|
||||
{
|
||||
key: 'yun_xu_cha_kan_suo_you_jiao_ban_ji_lu',
|
||||
text: '允许查看所有交班记录'
|
||||
}
|
||||
],
|
||||
default: [{
|
||||
key: 'yun_xu_xia_dan',
|
||||
text: '允许下单'
|
||||
},
|
||||
{
|
||||
key: 'yun_xu_shou_kuan',
|
||||
text: '允许收款'
|
||||
},
|
||||
{
|
||||
key: 'yun_xu_tui_kuan',
|
||||
text: '允许退款'
|
||||
},
|
||||
{
|
||||
key: 'yun_xu_jiao_ban',
|
||||
text: '允许交班'
|
||||
}
|
||||
],
|
||||
goods: [{
|
||||
key: 'yun_xu_xiu_gai_shang_pin',
|
||||
text: '允许修改商品'
|
||||
},
|
||||
{
|
||||
key: 'yun_xu_shang_xia_jia_shang_pin',
|
||||
text: '允许上下架商品'
|
||||
},
|
||||
{
|
||||
key: 'yun_xu_xiu_gai_fen_lei',
|
||||
text: '允许修改分类'
|
||||
},
|
||||
{
|
||||
key: 'yun_xu_xiu_gai_fen_zu',
|
||||
text: '允许修改分组'
|
||||
}
|
||||
],
|
||||
discount:[
|
||||
{
|
||||
key: 'yun_xu_da_zhe',
|
||||
text: '允许打折'
|
||||
}
|
||||
],
|
||||
vip:[
|
||||
{
|
||||
key: '允许管理会员信息',
|
||||
text: 'yun_xu_guan_li_hui_yuan_xin_xi'
|
||||
},
|
||||
{
|
||||
key: 'yun_xu_xiu_gai_hui_yuan_yu_e',
|
||||
text: '允许修改会员余额'
|
||||
}
|
||||
],
|
||||
stock:[
|
||||
{
|
||||
text: '允许提交报损',
|
||||
key: 'yun_xu_ti_jiao_bao_sun'
|
||||
},
|
||||
{
|
||||
text: '允许沽清',
|
||||
key: 'yun_xu_gu_qing'
|
||||
},
|
||||
{
|
||||
text: '允许售罄商品',
|
||||
key: 'yun_xu_shou_qing_shang_pin'
|
||||
},
|
||||
{
|
||||
text:'允许修改商品库存',
|
||||
key:'yun_xu_xiu_gai_shang_pin_ku_cun'
|
||||
},
|
||||
{
|
||||
text: '允许耗材入库',
|
||||
key: 'yun_xu_hao_cai_ru_ku'
|
||||
},
|
||||
{
|
||||
text: '允许耗材出库',
|
||||
key: 'yun_xu_hao_cai_chu_ku'
|
||||
},
|
||||
{
|
||||
text: '允许耗材盘点',
|
||||
key: 'yun_xu_hao_cai_pan_dian'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
function isChinese(str) {
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
if (str.charCodeAt(i) >= 0x4E00 && str.charCodeAt(i) <= 0x9FFF) {
|
||||
return true; // 是中文
|
||||
}
|
||||
}
|
||||
return false; // 不是中文,全是英文或其他
|
||||
}
|
||||
|
||||
function isObjectButNotArray(value) {
|
||||
return typeof value === 'object' && Array.isArray(value) === false;
|
||||
}
|
||||
|
||||
function findPermissionObj(str) {
|
||||
for (let i in $PermissionObj) {
|
||||
const obj = $PermissionObj[i].find(v => v.key == str || v.text == str)
|
||||
if (obj) {
|
||||
return obj
|
||||
break
|
||||
}
|
||||
}
|
||||
console.error('未找到相关权限配置,请检查权限配置文件commons/utils/hasPermission.js文件进行修改或增加')
|
||||
return false
|
||||
}
|
||||
|
||||
function returnFormatParams(params) {
|
||||
if (typeof params === 'string') {
|
||||
return findPermissionObj(params)
|
||||
} else {
|
||||
if (isObjectButNotArray(params)) {
|
||||
const obj=findPermissionObj(params.key || params.text)
|
||||
return {...params,...obj}
|
||||
} else {
|
||||
console.error('参数只能是字符串或者对象,不能是数组')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否有某权限
|
||||
* @param {Object|String} params
|
||||
*/
|
||||
export async function hasPermission(params) {
|
||||
//如果是商户默认拥有全部权限
|
||||
const loginType=uni.getStorageSync('loginType')
|
||||
if(loginType=='merchant'){
|
||||
return true
|
||||
}
|
||||
params = returnFormatParams(params)
|
||||
if (!params) {
|
||||
return infoBox.showToast('未找到相关权限,请检查代码或在权限配置文件commons/utils/hasPermission.js文件进行修改或增加')
|
||||
}
|
||||
const option = Object.assign({
|
||||
tips: true,
|
||||
key: '',
|
||||
text: ''
|
||||
}, params)
|
||||
const res = await $hasPermission({
|
||||
code: params.key
|
||||
})
|
||||
if (!res && option.tips) {
|
||||
infoBox.showToast('您没有' + params.text + '权限!')
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
|
|
@ -23,6 +23,7 @@ const model = {
|
|||
uni.setStorageSync('shopName',res.shopName)
|
||||
uni.setStorageSync('logo',res.logo)
|
||||
uni.setStorageSync('loginType',res.loginType)
|
||||
uni.setStorageSync('shopUserId',res.user.user.id)
|
||||
},
|
||||
// 退出清空所有的缓存数据。 (不包含 环境相关)
|
||||
cleanByLogout: () => {
|
||||
|
|
@ -79,6 +80,27 @@ const model = {
|
|||
return appCache.shopId
|
||||
}
|
||||
},
|
||||
// 获取和放置店铺员工id
|
||||
shopUserId: (val, isDelete = false) => {
|
||||
if (isDelete) {
|
||||
appCache.shopUserId = ""
|
||||
return uni.removeStorageSync('shopUserId')
|
||||
}
|
||||
|
||||
if (val) {
|
||||
// 有值,为放置
|
||||
appCache.shopUserId = val
|
||||
uni.setStorageSync('shopUserId', val)
|
||||
} else {
|
||||
// 否则为获取
|
||||
|
||||
if (!appCache.shopUserId) {
|
||||
//缓存取不到,获取应用本地信息
|
||||
appCache.shopUserId = uni.getStorageSync('shopUserId')
|
||||
}
|
||||
return appCache.shopUserId
|
||||
}
|
||||
},
|
||||
// 获取和放置useType就餐类型
|
||||
useType: (val, isDelete = false) => {
|
||||
if (isDelete) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
height: height,
|
||||
borderRadius: `calc(${height} / 2)`,
|
||||
}" @click.stop="changeSwitch"
|
||||
:class="{disabled:disabled}"
|
||||
:class="{disabled:disabled&&openDisabledClass}"
|
||||
>
|
||||
<view v-show="!modelValue" class="before" :style="{
|
||||
left: `calc(${margin} * 2)`,
|
||||
|
|
@ -40,6 +40,10 @@
|
|||
type:Boolean,
|
||||
default:false
|
||||
},
|
||||
openDisabledClass:{
|
||||
type:Boolean,
|
||||
default:true
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '40rpx',
|
||||
|
|
@ -82,10 +86,11 @@
|
|||
default: false,
|
||||
},
|
||||
})
|
||||
const emits = defineEmits(['update:modelValue', 'change'])
|
||||
const emits = defineEmits(['update:modelValue', 'change','click'])
|
||||
// 修改switch值
|
||||
function changeSwitch() {
|
||||
if(props.disabled){
|
||||
emits('click')
|
||||
return
|
||||
}
|
||||
let currentVal=props.modelValue
|
||||
|
|
|
|||
|
|
@ -1,80 +1,97 @@
|
|||
<template>
|
||||
<view class="u-relative bg border-r-16">
|
||||
|
||||
|
||||
<view class="u-flex tabs zhanwei u-relative">
|
||||
<view class="active-block" :style="computedBlockStyle">
|
||||
</view>
|
||||
<view class="u-flex-1 u-text-center item"
|
||||
:class="{active:index===current}"
|
||||
@tap="changeCurrent(index)" v-for="(item,index) in props.list" :key="index">
|
||||
{{item}}
|
||||
<view class="u-flex-1 u-text-center item" :class="[index===current?'':'active',size]" @tap="changeCurrent(index)"
|
||||
v-for="(item,index) in props.list" :key="index">
|
||||
{{textKey?item[textKey]:item}}
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
<view class="u-flex tabs u-absolute position-all">
|
||||
|
||||
<view class="u-flex-1 u-text-center item"
|
||||
:class="{active:index===current}"
|
||||
@tap="changeCurrent(index)" v-for="(item,index) in props.list" :key="index">
|
||||
{{item}}
|
||||
|
||||
<view class="u-flex-1 u-text-center item" :class="{active:index===current}" @tap="changeCurrent(index)"
|
||||
v-for="(item,index) in props.list" :key="index">
|
||||
{{textKey?item[textKey]:item}}
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, ref, watch } from 'vue';
|
||||
const props=defineProps({
|
||||
padding:{type:String},
|
||||
list:{type:Array},
|
||||
defaultIndex:{
|
||||
type:Number,
|
||||
default:0
|
||||
import {
|
||||
computed,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
const props = defineProps({
|
||||
size:{
|
||||
type: String,
|
||||
default:''
|
||||
},
|
||||
modelValue:{
|
||||
type:Number,
|
||||
default:0
|
||||
padding: {
|
||||
type: String
|
||||
},
|
||||
list: {
|
||||
type: Array
|
||||
},
|
||||
textKey: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
defaultIndex: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
modelValue: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
})
|
||||
const emit=defineEmits(['change','update:modelValue'])
|
||||
let current=ref(props.modelValue||props.defaultIndex||0)
|
||||
function changeCurrent(index){
|
||||
current.value=index
|
||||
const emit = defineEmits(['change', 'update:modelValue'])
|
||||
let current = ref(props.modelValue || props.defaultIndex || 0)
|
||||
|
||||
function changeCurrent(index) {
|
||||
current.value = index
|
||||
}
|
||||
const computedBlockStyle=computed(()=>{
|
||||
const oneWidth= 100/props.list.length
|
||||
const left= current.value*oneWidth
|
||||
return{
|
||||
width:oneWidth+'%',
|
||||
left:left+'%'
|
||||
const computedBlockStyle = computed(() => {
|
||||
const oneWidth = 100 / props.list.length
|
||||
const left = current.value * oneWidth
|
||||
return {
|
||||
width: oneWidth + '%',
|
||||
left: left + '%'
|
||||
}
|
||||
})
|
||||
watch(()=>props.modelValue,(newval)=>{
|
||||
current.value=newval
|
||||
watch(() => props.modelValue, (newval) => {
|
||||
current.value = newval
|
||||
})
|
||||
watch(()=>current.value,(newval)=>{
|
||||
emit('update:modelValue',newval)
|
||||
emit('change',newval)
|
||||
watch(() => current.value, (newval) => {
|
||||
emit('update:modelValue', newval)
|
||||
emit('change', newval)
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.zhanwei{
|
||||
.item{
|
||||
.zhanwei {
|
||||
.item {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
.bg{
|
||||
|
||||
.bg {
|
||||
background: #E6F0FF;
|
||||
padding: 4rpx 10rpx;
|
||||
}
|
||||
.border-r-16{
|
||||
|
||||
.border-r-16 {
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
.active-block{
|
||||
|
||||
.active-block {
|
||||
background-color: $my-main-color;
|
||||
color: #fff;
|
||||
top: 4rpx;
|
||||
|
|
@ -86,12 +103,14 @@ import { computed, ref, watch } from 'vue';
|
|||
overflow: hidden;
|
||||
z-index: 1;
|
||||
}
|
||||
.tabs{
|
||||
|
||||
.tabs {
|
||||
border-radius: 16rpx;
|
||||
font-size: 28rpx;
|
||||
color: #318AFE;
|
||||
z-index: 2;
|
||||
.active-block{
|
||||
|
||||
.active-block {
|
||||
background-color: $my-main-color;
|
||||
color: #fff;
|
||||
top: 4rpx;
|
||||
|
|
@ -103,14 +122,19 @@ import { computed, ref, watch } from 'vue';
|
|||
overflow: hidden;
|
||||
z-index: 1;
|
||||
}
|
||||
.item{
|
||||
|
||||
.item {
|
||||
padding: 8rpx 0;
|
||||
transition: all .2s ease-in-out;
|
||||
position: relative;
|
||||
background-color: transparent;
|
||||
z-index: 2;
|
||||
&.large{
|
||||
padding: 16rpx 0;
|
||||
}
|
||||
}
|
||||
.item.active{
|
||||
|
||||
.item.active {
|
||||
border-radius: 8rpx;
|
||||
// background-color: $my-main-color;
|
||||
color: #fff;
|
||||
|
|
|
|||
|
|
@ -319,3 +319,15 @@ export function $changeUseType(data) {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 退款
|
||||
export function $returnOrder(data) {
|
||||
return request({
|
||||
url: '/api/place/returnOrder',
|
||||
method: "post",
|
||||
data:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -122,7 +122,7 @@ export const $productSpec=new $API('/api/tbProductSpec',http.req)
|
|||
|
||||
/* 商品列表 V2 */
|
||||
export function $tbProductV2(data) {
|
||||
return http.req('/api/tbProduct/list/v2', {...data,shopId:uni.getStorageSync('shopId')}, 'GET')
|
||||
return http.req('/api/tbProduct/list/v2', {...data,shopId:uni.getStorageSync('shopId')}, 'post')
|
||||
}
|
||||
/* 耗材与商品绑定关系 */
|
||||
export function $tbProskuConV2(data) {
|
||||
|
|
|
|||
|
|
@ -727,7 +727,7 @@ export function $hasPermission(params) {
|
|||
url: '/api/tbShopPermission/hasPermission',
|
||||
method: "get",
|
||||
params:{
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
userId: uni.getStorageSync("shopUserId"),
|
||||
...params
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@
|
|||
tbProductGroupPost
|
||||
} from "@/http/yskApi/shop.js"
|
||||
|
||||
|
||||
import {hasPermission} from '@/commons/utils/hasPermission.js';
|
||||
|
||||
import {
|
||||
returnAllCategory
|
||||
|
|
@ -260,6 +260,10 @@
|
|||
}
|
||||
|
||||
async function save() {
|
||||
const res=await hasPermission('允许修改分组')
|
||||
if(!res){
|
||||
return
|
||||
}
|
||||
console.log(pageData.goodsList);
|
||||
await tbProductGroupPut({
|
||||
...option,
|
||||
|
|
@ -275,7 +279,11 @@
|
|||
}
|
||||
|
||||
//删除商品
|
||||
function goodsDel(index) {
|
||||
async function goodsDel(index) {
|
||||
const res=await hasPermission('允许修改分组')
|
||||
if(!res){
|
||||
return
|
||||
}
|
||||
const goods = pageData.bindGoodsList[index]
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-36">
|
||||
<view>修改排序:</view>
|
||||
<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 v-model="name">
|
||||
</up-input>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
item: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
sort:''
|
||||
name:''
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
@ -74,10 +74,10 @@
|
|||
note: ''
|
||||
})
|
||||
let popShow = ref(props.show)
|
||||
let sort=ref('')
|
||||
let name=ref('')
|
||||
|
||||
watch(()=>props.item.sort,(newval)=>{
|
||||
sort.value=newval
|
||||
watch(()=>props.item.name,(newval)=>{
|
||||
name.value=newval
|
||||
})
|
||||
|
||||
watch(() => props.show, (newval) => {
|
||||
|
|
@ -105,7 +105,7 @@
|
|||
function save() {
|
||||
emits('save', {
|
||||
...data.value,
|
||||
sort:sort.value
|
||||
name:name.value
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
<view class="u-m-b-32" v-for="(item,index) in pageData.list" :key="index">
|
||||
<my-category @del="categoryDel" @useTypeClick="categoryUseTypeClick"
|
||||
@editName="popupShow($event,'name',true)"
|
||||
@editSort="popupShow($event,'sort',true)" @edit="actionsShow" @radioClick="goodsRadioClick"
|
||||
@isShowChange="isSHowChange" :index="index" :data="item" :showChecked="showChecked"
|
||||
:showDetail="pageData.showGoodsDetail"></my-category>
|
||||
|
|
@ -23,6 +24,7 @@
|
|||
</view>
|
||||
|
||||
<edit-sort @save="updataGroup" :item="popup.selData" v-model:show="popup.sort.show"></edit-sort>
|
||||
<edit-name @save="updataGroup" :item="popup.selData" v-model:show="popup.name.show"></edit-name>
|
||||
|
||||
<up-action-sheet :round="10" @select="actionSelect" @close="actionsHide" cancelText="取消" :actions="actions.list"
|
||||
:show="actions.show"></up-action-sheet>
|
||||
|
|
@ -41,6 +43,7 @@
|
|||
import myCategory from './components/category.vue'
|
||||
import infoBox from "@/commons/utils/infoBox.js"
|
||||
import editSort from './components/edit-sort.vue';
|
||||
import editName from './components/edit-name.vue';
|
||||
import {
|
||||
tbProductGroupGet,
|
||||
tbProductGroupDelete,
|
||||
|
|
@ -100,6 +103,9 @@
|
|||
},
|
||||
sort: {
|
||||
show: false
|
||||
},
|
||||
name:{
|
||||
show: false
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -112,6 +118,7 @@
|
|||
console.log(e);
|
||||
const res = await $productCategory.update(e)
|
||||
popup.sort.show = false;
|
||||
popup.name.show = false;
|
||||
pageData.list[popup.selIndex] = e
|
||||
infoBox.showToast('更新成功')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,17 @@
|
|||
<template>
|
||||
<view class="u-p-30 safe-page min-page">
|
||||
<up-sticky v-if="option.type==='edit'" offset-top="20" zIndex="99">
|
||||
<myTabs :list="tabsList" v-model="tabsCurrent"></myTabs>
|
||||
<my-tabs :list="tabsList" v-model="tabsCurrent"></my-tabs>
|
||||
</up-sticky>
|
||||
<view class="box">
|
||||
|
||||
|
||||
<template v-if="tabsCurrent===0">
|
||||
<view class="basic">
|
||||
<uni-forms :model="FormData" :rules="rules" :border="true" label-position="top"
|
||||
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-group 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">
|
||||
|
|
@ -40,21 +39,28 @@
|
|||
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||
:inputBorder="inputBorder" v-model="FormData.name" placeholder="请输入商品名称" />
|
||||
</uni-forms-item>
|
||||
<template v-if="FormData.typeEnum!='group'">
|
||||
<uni-forms-item label="所属分类" required showRequired name="categoryId">
|
||||
<uni-data-picker :clear-icon="false" :map="{text:'name',value:'id'}"
|
||||
placeholder="请选择分类" popup-title="请选择分类" :localdata="pageData.category"
|
||||
v-model="FormData.categoryId">
|
||||
</uni-data-picker>
|
||||
</uni-forms-item>
|
||||
</template>
|
||||
|
||||
<view class="border-top-0">
|
||||
<uni-forms-item label="商品描述">
|
||||
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||
type="textarea" v-model="FormData.shortTitle" placeholder="请填写商品简述" />
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<template v-if="FormData.typeEnum!='group'">
|
||||
<view class="u-relative">
|
||||
<uni-forms-item label="所属分类" required showRequired name="categoryId">
|
||||
<uni-data-picker :clear-icon="false" :map="{text:'name',value:'id'}"
|
||||
placeholder="请选择分类" popup-title="请选择分类" :localdata="pageData.category"
|
||||
v-model="FormData.categoryId">
|
||||
</uni-data-picker>
|
||||
</uni-forms-item>
|
||||
<view class="zhezhao u-absolute position-all" @click="canEditGoodsCategory(true)" v-if="option.type=='edit'&&disabledChangeCategory">
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<view class="border-top-0">
|
||||
<uni-forms-item label="单位" required showRequired name="categoryId">
|
||||
|
|
@ -115,13 +121,13 @@
|
|||
<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 u-text-left">组合名称</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.list"
|
||||
:key="index">
|
||||
<view class="u-flex-1">{{item.specSnap}}</view>
|
||||
<view class="u-flex-1 u-text-left">{{item.specSnap}}</view>
|
||||
<view class="u-flex-1">¥{{item.salePrice}}</view>
|
||||
<view class="u-flex-1">{{item.stockNumber}}</view>
|
||||
</view>
|
||||
|
|
@ -207,7 +213,7 @@
|
|||
</template>
|
||||
|
||||
<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="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.list" :key="index">
|
||||
<view class="border-top-0">
|
||||
<uni-forms-item label="售价">
|
||||
|
|
@ -224,7 +230,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="请输入成本价(元)" />
|
||||
|
|
@ -240,12 +246,12 @@
|
|||
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
v-model="sku.suit" type="digit" placeholder="请输入起售数量" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="库存数量">
|
||||
<!-- <uni-forms-item label="库存数量">
|
||||
<uni-easyinput @blur="priceFormat(sku,'stockNumber')"
|
||||
:paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||
:inputBorder="inputBorder" v-model="sku.stockNumber" type="digit"
|
||||
placeholder="请输入库存数量" />
|
||||
</uni-forms-item>
|
||||
</uni-forms-item> -->
|
||||
<uni-forms-item label="分销金额">
|
||||
<uni-easyinput :paddingNone="inputPaddingNone"
|
||||
@blur="priceFormat(sku,'firstShared')" :placeholderStyle="placeholderStyle"
|
||||
|
|
@ -384,7 +390,7 @@
|
|||
|
||||
<template v-if="FormData.typeEnum!='group'">
|
||||
<view class="block">
|
||||
<view class="border-top-0">
|
||||
<!-- <view class="border-top-0">
|
||||
<uni-forms-item label="上架区域">
|
||||
<view class="u-flex">
|
||||
<view class="u-m-r-30">
|
||||
|
|
@ -393,6 +399,15 @@
|
|||
<my-radio text="小程序商城" v-model="FormData.isShowMall"></my-radio>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</view> -->
|
||||
<view class="border-top-0">
|
||||
<uni-forms-item label="">
|
||||
<view class="u-flex u-row-between">
|
||||
<view class="label-title">上架</view>
|
||||
<my-switch disabled :openDisabledClass="false" @click="isGroundingChange"
|
||||
v-model="FormData.isGrounding"></my-switch>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<uni-forms-item label="">
|
||||
<view class="u-flex u-row-between">
|
||||
|
|
@ -401,6 +416,21 @@
|
|||
</view>
|
||||
<view class="color-999 u-m-t-16 u-font-24">注:关闭则不计算出入库数据</view>
|
||||
</uni-forms-item>
|
||||
<template v-if="FormData.isStock">
|
||||
<uni-forms-item label="库存数量">
|
||||
<uni-easyinput :paddingNone="inputPaddingNone"
|
||||
:disabled="disabledStock"
|
||||
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
v-model="FormData.stockNumber" type="digit" placeholder="请输入库存数量" />
|
||||
</uni-forms-item>
|
||||
</template>
|
||||
|
||||
<uni-forms-item label="">
|
||||
<view class="u-flex u-row-between">
|
||||
<view class="label-title">设为推荐</view>
|
||||
<my-switch v-model="FormData.isHot"></my-switch>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="">
|
||||
<view class="u-flex u-row-between">
|
||||
<view class="label-title">标签打印</view>
|
||||
|
|
@ -414,12 +444,12 @@
|
|||
:inputBorder="inputBorder" v-model="FormData.packFee" type="digit"
|
||||
placeholder="请输入打包费" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="虚拟销量">
|
||||
<!-- <uni-forms-item label="虚拟销量">
|
||||
<uni-easyinput @blur="priceFormat(FormData,'baseSalesNumber')"
|
||||
:paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||
:inputBorder="inputBorder" v-model="FormData.baseSalesNumber" type="digit"
|
||||
placeholder="请输入虚拟销量" />
|
||||
</uni-forms-item>
|
||||
</uni-forms-item> -->
|
||||
<template v-if="option.type==='edit'">
|
||||
<uni-forms-item label="排序">
|
||||
<uni-easyinput @blur="priceFormat(FormData,'sort')"
|
||||
|
|
@ -448,7 +478,8 @@
|
|||
</template>
|
||||
|
||||
<template v-if="tabsCurrent===1">
|
||||
<edit-haocai @updateGoods="updateGoodsDetail" :goods="FormData" @cancel="changeTabsCurrent(0)"></edit-haocai>
|
||||
<edit-haocai @updateGoods="updateGoodsDetail" :goods="FormData"
|
||||
@cancel="changeTabsCurrent(0)"></edit-haocai>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
|
|
@ -489,17 +520,15 @@
|
|||
import go from '@/commons/utils/go.js';
|
||||
import color from '@/commons/color.js';
|
||||
|
||||
import myModel from '@/components/my-components/my-model'
|
||||
import chooseGoods from './components/choose-goods'
|
||||
import editHaocai from './components/edit-haocai.vue'
|
||||
import chooseGroupCategory from './components/choose-coupon-category'
|
||||
import myRadio from '@/components/my-components/my-radio'
|
||||
import myUploadFile from '@/components/my-components/my-upload-file'
|
||||
import myTabs from '@/components/my-components/my-tabs'
|
||||
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 {
|
||||
hasPermission
|
||||
} from '@/commons/utils/hasPermission.js';
|
||||
|
||||
import {
|
||||
$types,
|
||||
$defaultSku
|
||||
|
|
@ -513,7 +542,10 @@
|
|||
$delProduct,
|
||||
$productSpec,
|
||||
$updateProductStatus,
|
||||
$updateGrounding
|
||||
$updateGrounding,
|
||||
$goodsIsHot,
|
||||
$tbProskuConV2,
|
||||
$updateProductData
|
||||
} from '@/http/yskApi/goods.js'
|
||||
|
||||
import {
|
||||
|
|
@ -535,6 +567,50 @@
|
|||
nextTick
|
||||
} from 'vue';
|
||||
|
||||
async function upDateGoods(par) {
|
||||
const res = await $updateProductData([{
|
||||
id: FormData.id,
|
||||
isSku: 0,
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
...par
|
||||
}])
|
||||
uni.showToast({
|
||||
title: '修改成功',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
async function isPauseSaleChange(e) {
|
||||
if (option.type == 'add') {
|
||||
FormData.isPauseSale = FormData.isPauseSale ? 0 : 1
|
||||
return
|
||||
}
|
||||
const res = await hasPermission('允许售罄商品')
|
||||
if (!res) {
|
||||
return
|
||||
}
|
||||
await upDateGoods({
|
||||
key: 'pauseSale',
|
||||
value: FormData.isPauseSale ? 0 : 1
|
||||
})
|
||||
FormData.isPauseSale = FormData.isPauseSale ? 0 : 1
|
||||
}
|
||||
|
||||
async function isGroundingChange(e) {
|
||||
if (option.type == 'add') {
|
||||
FormData.isGrounding = FormData.isGrounding ? 0 : 1
|
||||
return
|
||||
}
|
||||
const res = await hasPermission('允许上下架商品')
|
||||
if (!res) {
|
||||
return
|
||||
}
|
||||
await upDateGoods({
|
||||
key: 'grounding',
|
||||
value: FormData.isGrounding ? 0 : 1
|
||||
})
|
||||
FormData.isGrounding = FormData.isGrounding ? 0 : 1
|
||||
}
|
||||
|
||||
function toRecoders() {
|
||||
go.to('PAGES_PRODUCT_INVOICING_LIST', {
|
||||
productId: FormData.id
|
||||
|
|
@ -932,9 +1008,11 @@
|
|||
isShowMall: 1,
|
||||
isShowCash: 1,
|
||||
isStock: 0,
|
||||
isStock: 0,
|
||||
isHot: 0,
|
||||
packFee: 0,
|
||||
specId: "",
|
||||
baseSalesNumber: 0,
|
||||
// baseSalesNumber: 0,
|
||||
sort: 0,
|
||||
groupSnap: [],
|
||||
specInfo: [],
|
||||
|
|
@ -942,6 +1020,8 @@
|
|||
specTableHeaders: [],
|
||||
skuSnap: "",
|
||||
groupCategoryId: [],
|
||||
isGrounding: 1,
|
||||
stockNumber: 0,
|
||||
notices: {
|
||||
availableTime: "",
|
||||
bookingType: "",
|
||||
|
|
@ -1001,14 +1081,14 @@
|
|||
url: v
|
||||
}
|
||||
})
|
||||
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')){
|
||||
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]
|
||||
} else {
|
||||
item.haoCaiList = [con]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1054,7 +1134,7 @@
|
|||
},
|
||||
names,
|
||||
specSnap: v.specSnap,
|
||||
coverImg:v.coverImg
|
||||
coverImg: v.coverImg
|
||||
}
|
||||
}),
|
||||
specList: [],
|
||||
|
|
@ -1161,9 +1241,10 @@
|
|||
pageData.skuList = res
|
||||
})
|
||||
}
|
||||
function updateGoodsDetail(){
|
||||
|
||||
function updateGoodsDetail() {
|
||||
getGoodsDetail()
|
||||
getProductSku()
|
||||
// getProductSku()
|
||||
}
|
||||
onLoad((params) => {
|
||||
if (isEmpty(params)) {
|
||||
|
|
@ -1173,14 +1254,13 @@
|
|||
// getGoodsDetail()
|
||||
// getProductSku()
|
||||
}
|
||||
|
||||
console.log(option.type);
|
||||
canEditGoodsCategory()
|
||||
uni.setNavigationBarTitle({
|
||||
title: option.type === 'add' ? '添加商品' : '编辑商品'
|
||||
})
|
||||
if (option.type === 'edit') {
|
||||
getGoodsDetail()
|
||||
getProductSku()
|
||||
// getProductSku()
|
||||
}
|
||||
defaultValueInit()
|
||||
getCategory()
|
||||
|
|
@ -1212,12 +1292,18 @@
|
|||
function settimeoutBack(time) {
|
||||
clearTimeout(timer)
|
||||
timer = setTimeout(() => {
|
||||
uni.$emit('update:productIndex')
|
||||
uni.navigateBack()
|
||||
}, time)
|
||||
}
|
||||
|
||||
//保存
|
||||
function save() {
|
||||
async function save() {
|
||||
const bol = await hasPermission('允许修改商品')
|
||||
if (!bol) {
|
||||
return
|
||||
}
|
||||
|
||||
Forms.value.validate().then(res => {
|
||||
const {
|
||||
typeEnum,
|
||||
|
|
@ -1226,12 +1312,12 @@
|
|||
if (typeEnum === 'group' && !groupCategoryId.length) {
|
||||
return infoBox.showToast('请选择团购券分类')
|
||||
}
|
||||
|
||||
|
||||
// if(typeEnum==='sku'){
|
||||
// return infoBox.showErrorToast('请选择规格')
|
||||
// }
|
||||
const images = refFile.value.getFileList()
|
||||
if(images.length<=0){
|
||||
if (images.length <= 0) {
|
||||
return infoBox.showToast('请上传商品图片')
|
||||
}
|
||||
const skuSnap = []
|
||||
|
|
@ -1239,8 +1325,8 @@
|
|||
...$defaultSku,
|
||||
barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()}`
|
||||
}];
|
||||
if(typeEnum=='normal'){
|
||||
submitSkuList=skuList.list ;
|
||||
if (typeEnum == 'normal') {
|
||||
submitSkuList = skuList.list;
|
||||
}
|
||||
console.log(submitSkuList);
|
||||
if (FormData.specificationsGroup) {
|
||||
|
|
@ -1253,6 +1339,16 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
console.log(FormData.specificationsGroup);
|
||||
const selectSpec = FormData.typeEnum != 'sku' ? '' : JSON.stringify(FormData.specificationsGroup
|
||||
.selectSpec.map(spe => {
|
||||
return {
|
||||
...spe,
|
||||
value: spe.value.map(v => {
|
||||
return typeof v === 'string' ? v : v.text || v.value
|
||||
})
|
||||
}
|
||||
}))
|
||||
const submitData = {
|
||||
...FormData,
|
||||
images: images,
|
||||
|
|
@ -1261,13 +1357,7 @@
|
|||
specInfo: JSON.stringify(submitSkuList),
|
||||
lowPrice: submitSkuList[0].salePrice,
|
||||
specificationsGroup: undefined,
|
||||
selectSpec: JSON.stringify(FormData.specificationsGroup.selectSpec.map(spe=>{
|
||||
return {
|
||||
...spe,value:spe.value.map(v=>{
|
||||
return typeof v==='string'?v:v.text||v.value
|
||||
})
|
||||
}
|
||||
})),
|
||||
selectSpec,
|
||||
skuSnap: JSON.stringify(skuSnap)
|
||||
}
|
||||
//编辑
|
||||
|
|
@ -1420,15 +1510,46 @@
|
|||
}
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* 权限start
|
||||
*/
|
||||
|
||||
// 允许修改商品库存
|
||||
let disabledStock=ref(false)
|
||||
async function canEditGoodsStock() {
|
||||
if (option.type === 'edit') {
|
||||
const res=await hasPermission({text:'允许修改商品库存',tips:false})
|
||||
disabledStock.value=!res
|
||||
}
|
||||
}
|
||||
watch(() => FormData.isStock, (newval) => {
|
||||
if (newval) {
|
||||
canEditGoodsStock()
|
||||
}
|
||||
})
|
||||
// 允许修改商品分类
|
||||
let disabledChangeCategory=ref(false)
|
||||
async function canEditGoodsCategory(tips=false) {
|
||||
if (option.type === 'edit') {
|
||||
const res=await hasPermission({text:'允许修改分类',tips})
|
||||
disabledChangeCategory.value=!res
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 权限end
|
||||
*/
|
||||
|
||||
|
||||
watch(() => pageData.types, (newval) => {
|
||||
Forms.value.setRules(rules)
|
||||
})
|
||||
onShow(() => {
|
||||
watchSpecificationsSave()
|
||||
})
|
||||
onReady(() => {
|
||||
Forms.value && Forms.value.setRules(rules)
|
||||
})
|
||||
watch(() => pageData.types, (newval) => {
|
||||
Forms.value.setRules(rules)
|
||||
})
|
||||
</script>
|
||||
<style scoped>
|
||||
page {
|
||||
|
|
|
|||
|
|
@ -26,8 +26,7 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-32 color-666">
|
||||
<view class="u-m-t-24" v-for="(item,haocaiIndex) in sku.haoCaiList"
|
||||
:key="haocaiIndex">
|
||||
<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">
|
||||
|
|
@ -42,8 +41,8 @@
|
|||
</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>
|
||||
<up-icon @click="delGuigeHaocao(index,haocaiIndex)" color="#EB4F4F"
|
||||
:size="16" name="minus-circle-fill"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -178,7 +177,13 @@
|
|||
import {
|
||||
$tbProskuConV2
|
||||
} from '@/http/yskApi/goods.js'
|
||||
import { cloneWith } from 'lodash';
|
||||
import {
|
||||
cloneWith
|
||||
} from 'lodash';
|
||||
|
||||
import {
|
||||
hasPermission
|
||||
} from '@/commons/utils/hasPermission.js';
|
||||
const emits = defineEmits(['cancel', 'updateGoods'])
|
||||
|
||||
function cancel() {
|
||||
|
|
@ -276,7 +281,7 @@ import { cloneWith } from 'lodash';
|
|||
content: '是否删除该耗材',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
if (item&&item.id) {
|
||||
if (item && item.id) {
|
||||
deletetbProskuCon([item.id]).then(res1 => {
|
||||
skuList.value[guigeIndex].haoCaiList.splice(haocaiIndex, 1)
|
||||
})
|
||||
|
|
@ -297,25 +302,31 @@ import { cloneWith } from 'lodash';
|
|||
watch(() => props.goods.typeEnum, (newval) => {
|
||||
isBindGuige.value = isSku.value
|
||||
})
|
||||
|
||||
|
||||
|
||||
async function save() {
|
||||
const bol = await hasPermission('允许修改商品')
|
||||
if (!bol) {
|
||||
return
|
||||
}
|
||||
console.log('save');
|
||||
let isPas=false
|
||||
if(!isBindGuige.value){
|
||||
let isPas = false
|
||||
if (!isBindGuige.value) {
|
||||
//绑定至商品
|
||||
isPas = conInfos.value.every(v => {
|
||||
isPas = conInfos.value.every(v => {
|
||||
return v.conInfoId && v.conUnit && v.surplusStock > 0
|
||||
})
|
||||
}else{
|
||||
} else {
|
||||
//绑定至规格
|
||||
isPas = skuList.value.filter(v=>v.haoCaiList&&v.haoCaiList.length).every(sku => {
|
||||
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
|
||||
return sku.haoCaiList.every(v => {
|
||||
return v.conInfoId && v.conUnit && v.surplusStock > 0
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
if (!isPas) {
|
||||
return infoBox.showToast('请填写全部耗材选项值')
|
||||
}
|
||||
|
|
@ -337,10 +348,10 @@ import { cloneWith } from 'lodash';
|
|||
}
|
||||
})
|
||||
} else {
|
||||
for(let i in skuList.value){
|
||||
const haocaiList=skuList.value[i].haoCaiList||[]
|
||||
for(let k in haocaiList){
|
||||
const v=haocaiList[k]
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -548,7 +548,7 @@
|
|||
}
|
||||
|
||||
.box {
|
||||
margin-top: 70rpx;
|
||||
// margin-top: 70rpx;
|
||||
font-size: 28rpx;
|
||||
|
||||
.block {
|
||||
|
|
|
|||
|
|
@ -87,11 +87,11 @@
|
|||
<view class="u-flex">
|
||||
<view class="u-flex">
|
||||
<view class="u-m-r-18 color-999">售罄</view>
|
||||
<my-switch v-model="isPauseSale" @change="isPauseSaleChange"></my-switch>
|
||||
<my-switch disabled v-model="isPauseSale" :openDisabledClass="false" @click="isPauseSaleChange"></my-switch>
|
||||
</view>
|
||||
<view class="u-flex u-m-l-30">
|
||||
<view class="u-m-r-18 color-999">{{data.isGrounding?'下架产品':'上架产品' }}</view>
|
||||
<my-switch v-model="isGrounding" @change="isGroundingChange"></my-switch>
|
||||
<my-switch disabled v-model="isGrounding" :openDisabledClass="false" @click="isGroundingChange"></my-switch>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
|
|
@ -117,8 +117,8 @@
|
|||
$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 {hasPermission} from '@/commons/utils/hasPermission.js';
|
||||
import {
|
||||
ColorMain
|
||||
} from '@/commons/color.js'
|
||||
|
|
@ -171,17 +171,24 @@
|
|||
isGrounding.value=newval
|
||||
})
|
||||
|
||||
function isPauseSaleChange(e) {
|
||||
async function isPauseSaleChange(e) {
|
||||
const res=await hasPermission('允许售罄商品')
|
||||
if(!res){
|
||||
return
|
||||
}
|
||||
upDateGoods({
|
||||
key: 'pauseSale',
|
||||
value: e
|
||||
value: isPauseSale.value?0:1
|
||||
})
|
||||
}
|
||||
|
||||
function isGroundingChange(e) {
|
||||
async function isGroundingChange(e) {
|
||||
const res=await hasPermission('允许上下架商品')
|
||||
if(!res){
|
||||
return
|
||||
}
|
||||
upDateGoods({
|
||||
key: 'grounding',
|
||||
value: e
|
||||
value: isGrounding.value?0:1
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -208,7 +215,11 @@
|
|||
emits('del', props.index)
|
||||
}
|
||||
|
||||
function changePrice() {
|
||||
async function changePrice() {
|
||||
const res=await hasPermission('允许修改商品')
|
||||
if(!res){
|
||||
return
|
||||
}
|
||||
emits('changePrice', props.index)
|
||||
}
|
||||
|
||||
|
|
@ -225,10 +236,11 @@
|
|||
}
|
||||
//携带参数type edit跳转到商品添加页面,编辑与添加同一页面,根据type值来判断
|
||||
function toEdit() {
|
||||
go.to('PAGES_PRODUCT_ADD', {
|
||||
type: 'edit',
|
||||
productId: props.data.id
|
||||
})
|
||||
emits('edit', props.data.id)
|
||||
// go.to('PAGES_PRODUCT_ADD', {
|
||||
// type: 'edit',
|
||||
// productId: props.data.id
|
||||
// })
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
<template v-if="pageData.goodsList.length">
|
||||
<view class="u-m-b-32" v-for="(item,index) in pageData.goodsList" :key="index">
|
||||
<my-goods :key="item.id" @update="getGoodsList" @changePrice="changePriceShow" @changeClick="goodsChangeClick"
|
||||
@edit="toGoodsDetail"
|
||||
@editStock="changeStockShow" @guigeClick="editGuigeShow" @baosun="baosunShow"
|
||||
@radioClick="goodsRadioClick" :index="index" :data="item" @del="goodsDel"
|
||||
:showChecked="showChecked" :showDetail="pageData.showGoodsDetail"></my-goods>
|
||||
|
|
@ -149,6 +150,7 @@
|
|||
watch
|
||||
} from 'vue';
|
||||
import go from '@/commons/utils/go.js';
|
||||
import {hasPermission} from '@/commons/utils/hasPermission.js';
|
||||
import myGoods from './components/goods.vue'
|
||||
import myControl from './components/control.vue'
|
||||
import myCategory from './components/category.vue'
|
||||
|
|
@ -285,7 +287,11 @@
|
|||
|
||||
|
||||
// 修改库存弹窗展示
|
||||
function changeStockShow(index) {
|
||||
async function changeStockShow(index) {
|
||||
const res= await hasPermission('允许修改商品库存')
|
||||
if(!res){
|
||||
return
|
||||
}
|
||||
pageData.selGoodsIndex = index
|
||||
const goods = pageData.goodsList[index]
|
||||
goods.skuList = goods.skuList.map(v => {
|
||||
|
|
@ -387,8 +393,15 @@
|
|||
pageData.totalElements = res.totalElements
|
||||
})
|
||||
}
|
||||
function watchEmitInit(){
|
||||
uni.$off('update:productIndex')
|
||||
uni.$on('update:productIndex',(data)=>{
|
||||
getGoodsList()
|
||||
})
|
||||
}
|
||||
onShow(() => {
|
||||
// getGoodsList()
|
||||
watchEmitInit()
|
||||
})
|
||||
onLoad(() => {
|
||||
getGoodsList()
|
||||
|
|
@ -484,7 +497,18 @@
|
|||
pageData.totalElements=0;
|
||||
pageData.query.page=0;
|
||||
}
|
||||
|
||||
|
||||
async function toGoodsDetail(id){
|
||||
const res= await hasPermission('允许修改商品')
|
||||
if(!res){
|
||||
return
|
||||
}
|
||||
go.to('PAGES_PRODUCT_ADD', {
|
||||
type: 'edit',
|
||||
productId: id
|
||||
})
|
||||
}
|
||||
|
||||
function statesTableClick(index) {
|
||||
pageData.stateCurrent = index;
|
||||
resetQuery()
|
||||
|
|
|
|||
|
|
@ -13,8 +13,21 @@
|
|||
|
||||
<!-- 不需要label, 需要修改: label-width="0" -->
|
||||
<uni-forms ref="loginFormRef" label-width="0" :model="vdata.formData" :rules="rules">
|
||||
|
||||
<view class="u-p-b-30">
|
||||
<my-tabs size="large" @change="accountTypeChange" v-model="accountType.sel" :list="accountType.list" textKey="label"></my-tabs>
|
||||
</view>
|
||||
<view v-if="vdata.loginType == 'pwd' ">
|
||||
<template v-if="accountType.sel==1">
|
||||
<uni-forms-item name="merchantName">
|
||||
<uni-easyinput class='jeepay-easyinput' placeholder="请输入商户号"
|
||||
v-model="vdata.formData.merchantName" :clearable="false">
|
||||
<template #prefixIcon>
|
||||
<image src="@/static/login/icon-user.svg" class="input-icon" />
|
||||
</template>
|
||||
</uni-easyinput>
|
||||
</uni-forms-item>
|
||||
</template>
|
||||
|
||||
<uni-forms-item name="username">
|
||||
<uni-easyinput class='jeepay-easyinput' placeholder="请输入登录名/手机号"
|
||||
v-model="vdata.formData.username" :clearable="false">
|
||||
|
|
@ -159,6 +172,15 @@
|
|||
login,
|
||||
getCodeImg
|
||||
} from '@/http/yskApi/login.js';
|
||||
|
||||
const accountType=reactive({
|
||||
list:[
|
||||
{label:'商户',value:'merchant'},
|
||||
{label:'员工',value:'staff'},
|
||||
],
|
||||
sel:0
|
||||
})
|
||||
|
||||
const loginFormRef = ref()
|
||||
const envChangeTipsRef = ref()
|
||||
const refAgr = ref()
|
||||
|
|
@ -169,6 +191,9 @@
|
|||
} from "@/commons/utils/pushmsg/wxTextToSpeach.js"
|
||||
// #endif
|
||||
const rules = {
|
||||
merchantName:{
|
||||
rules: [formUtil.rules.requiredInputShowToast('商户号')],
|
||||
},
|
||||
username: {
|
||||
rules: [formUtil.rules.requiredInputShowToast('用户名')],
|
||||
},
|
||||
|
|
@ -223,6 +248,14 @@
|
|||
vdata.formData.pwd = 'qwer1234'
|
||||
// #endif
|
||||
|
||||
function accountTypeChange(e){
|
||||
// #ifdef H5
|
||||
if(e==1){
|
||||
vdata.formData.merchantName = '18049104914'
|
||||
vdata.formData.username = '13666666666'
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
|
||||
const getCode = () => {
|
||||
getCodeImg().then(res => {
|
||||
|
|
@ -268,7 +301,7 @@
|
|||
code: vdata.formData.code,
|
||||
uuid: vdata.formData.uuid,
|
||||
merchantName: vdata.formData.merchantName,
|
||||
loginType: vdata.formData.loginType
|
||||
loginType: accountType.list[accountType.sel].value
|
||||
})
|
||||
|
||||
} else if (vdata.loginType == 'sms') { // 短信验证码登录
|
||||
|
|
@ -308,11 +341,12 @@
|
|||
}
|
||||
// 封装登录成功后的操作
|
||||
async function loginFinishFunc(loginBizData) {
|
||||
|
||||
|
||||
// 保存 token
|
||||
storageManage.setLogin(loginBizData)
|
||||
storageManage.token(loginBizData.token)
|
||||
storageManage.shopId(loginBizData.shopId)
|
||||
storageManage.shopUserId(loginBizData.user.user.id)
|
||||
storageManage.userInfo(loginBizData)
|
||||
// 跳转到首页
|
||||
go.to("PAGES_INDEX", {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@
|
|||
<view class="u-p-30">
|
||||
<view class="u-m-t-10">
|
||||
<my-button @tap="confirm" shape="circle" showShadow>确认</my-button>
|
||||
<my-button type="cancel" bgColor="#fff" @tap="confirm">取消</my-button>
|
||||
<view class="u-m-t-10">
|
||||
<my-button type="cancel" bgColor="#fff" @tap="confirm">取消</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
|
@ -31,9 +33,6 @@
|
|||
nextTick,
|
||||
ref
|
||||
} from 'vue';
|
||||
import myModel from '@/components/my-components/my-model.vue'
|
||||
import myButton from '@/components/my-components/my-button.vue'
|
||||
import myTabs from '@/components/my-components/my-tabs.vue'
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
|
|
@ -47,7 +46,7 @@
|
|||
|
||||
|
||||
function changeCauses(item) {
|
||||
let prve=form.remark.length?',':''
|
||||
let prve=form.remark?',':''
|
||||
form.remark +=prve+item.name
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +87,8 @@
|
|||
|
||||
const model = ref(null)
|
||||
|
||||
function open() {
|
||||
function open(data) {
|
||||
Object.assign(form,data)
|
||||
model.value.open()
|
||||
}
|
||||
|
||||
|
|
@ -100,11 +100,12 @@
|
|||
function confirm() {
|
||||
const {remark
|
||||
} = form
|
||||
close()
|
||||
emits('confirm', {
|
||||
name,
|
||||
price
|
||||
remark
|
||||
})
|
||||
console.log(remark);
|
||||
close()
|
||||
|
||||
}
|
||||
defineExpose({
|
||||
open,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@
|
|||
</view> -->
|
||||
<view class="u-m-l-20">{{user.nickName}}</view>
|
||||
<view class="color-main u-m-l-10 u-font-24">{{user.isVip?'会员':'' }}</view>
|
||||
<view class="u-font-24 u-m-l-30"><text>余额:</text><text class="color-main">{{user.amount}}</text>
|
||||
<view class="u-font-24 u-m-l-30"><text>余额:</text><text
|
||||
class="color-main">{{user.amount}}</text>
|
||||
</view>
|
||||
<view class="u-font-24 u-m-l-30"><text>积分:</text><text
|
||||
class="color-main">{{user.totalScore}}</text></view>
|
||||
|
|
@ -33,7 +34,7 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class=" " @tap="chooseTable">
|
||||
<view>选择桌码</view>
|
||||
<view class="u-m-t-24 u-flex u-row-between ">
|
||||
|
|
@ -44,9 +45,9 @@
|
|||
<uni-icons type="right" color="#999" size="16"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
<template v-if="user">
|
||||
<view class="block">
|
||||
<view class="">
|
||||
|
|
@ -80,7 +81,8 @@
|
|||
<view class="block">
|
||||
<view class=" ">
|
||||
<view>用餐人数(人)</view>
|
||||
<picker @change="userNumberChange" :value="userNumbers.defaultCateIndex" :range="userNumbers.list">
|
||||
<picker @change="userNumberChange" :value="userNumbers.defaultCateIndex"
|
||||
:range="userNumbers.list">
|
||||
<view class="u-m-t-24 u-flex u-row-between ">
|
||||
<view class="color-333">{{userNumbers.defaultCateIndex||''}}</view>
|
||||
<uni-icons type="right" color="#999" size="16"></uni-icons>
|
||||
|
|
@ -147,7 +149,11 @@
|
|||
<view class="color-999 u-text-right u-font-24 u-m-t-12">×{{item.number}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<template v-if="item.note">
|
||||
<view class="u-p-20 bg-gray u-m-t-10">
|
||||
{{item.note}}
|
||||
</view>
|
||||
</template>
|
||||
<scroll-view scroll-x="true" v-if="index==goods.sel">
|
||||
<view class="u-m-t-32 u-flex no-wrap u-p-b-12">
|
||||
<!-- <view class="u-flex u-m-r-20 u-m-b-20">
|
||||
|
|
@ -167,7 +173,8 @@
|
|||
@tap="toggleWait(item)">{{item.isWait?'取消等叫':'等叫'}}</button>
|
||||
</view> -->
|
||||
<view class="u-flex u-m-r-20 u-m-b-20">
|
||||
<button class="tag" hover-class="hover-class" @tap="showModel('remark')">单品备注</button>
|
||||
<button class="tag" hover-class="hover-class"
|
||||
@tap="showModel('remark',index)">单品备注</button>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
|
@ -214,7 +221,7 @@
|
|||
|
||||
<model-discount title="菜品打折/减免" :ref="setModel" name="discount" :price="allPrice"></model-discount>
|
||||
<give-food title="赠菜" :ref="setModel" name="giveFood"></give-food>
|
||||
<my-remark title="单品备注" :ref="setModel" name="remark"></my-remark>
|
||||
<my-remark @confirm="goodsOneRemarkConfirm" title="单品备注" :ref="setModel" name="remark"></my-remark>
|
||||
<edit-discount title="优惠金额" :ref="setModel" name="editMoney" :price="allPrice"></edit-discount>
|
||||
</view>
|
||||
|
||||
|
|
@ -252,6 +259,10 @@
|
|||
getNowCart
|
||||
} from '@/pagesCreateOrder/util.js'
|
||||
const models = new Map();
|
||||
const modelData = reactive({
|
||||
data: {},
|
||||
selIndex: -1
|
||||
})
|
||||
//备注
|
||||
let note = ref('')
|
||||
|
||||
|
|
@ -261,9 +272,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
function showModel(key) {
|
||||
function showModel(key, index) {
|
||||
modelData.data =goods.list[index]
|
||||
modelData.selIndex =index
|
||||
const model = models.get(key)
|
||||
model && model.open()
|
||||
model && model.open({remark:modelData.data.note})
|
||||
}
|
||||
|
||||
function formatPrice(n) {
|
||||
|
|
@ -401,7 +414,7 @@
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
const goods = reactive({
|
||||
list: [],
|
||||
sel: 0
|
||||
|
|
@ -468,7 +481,7 @@
|
|||
console.log(res);
|
||||
return res
|
||||
}
|
||||
|
||||
|
||||
// 创建订单
|
||||
async function createOrder(par = {
|
||||
masterId: option.masterId,
|
||||
|
|
@ -497,7 +510,9 @@
|
|||
})
|
||||
} else {
|
||||
//后付
|
||||
uni.navigateBack({delta:2})
|
||||
uni.navigateBack({
|
||||
delta: 2
|
||||
})
|
||||
// return go.to('PAGES_ORDER_DETAIL', {
|
||||
// id: res.id
|
||||
// })
|
||||
|
|
@ -513,11 +528,25 @@
|
|||
// })
|
||||
// }, 500)
|
||||
}
|
||||
|
||||
function init(){
|
||||
|
||||
|
||||
//单品备注确认
|
||||
async function goodsOneRemarkConfirm(e) {
|
||||
const cart=goods.list[modelData.selIndex]
|
||||
await Api.$updateCart({
|
||||
cartId: cart.id,
|
||||
productId: cart.productId,
|
||||
skuId: cart.skuId,
|
||||
tableId: option.tableId,
|
||||
note: e.remark,
|
||||
num: cart.number // 0会删除此商品
|
||||
})
|
||||
cart.note= e.remark
|
||||
}
|
||||
|
||||
|
||||
function init() {
|
||||
|
||||
}
|
||||
|
||||
onLoad((opt) => {
|
||||
console.log('opt');
|
||||
console.log(opt);
|
||||
|
|
@ -548,7 +577,7 @@
|
|||
useType = `dine-in-${isPayAfter? "after" : "before"}`;
|
||||
uni.setStorageSync("useType", useType);
|
||||
}
|
||||
const tableId = useType=='takeout'?undefined: table.value.tableId;
|
||||
const tableId = useType == 'takeout' ? undefined : table.value.tableId;
|
||||
const res = await Api.$changeUseType({
|
||||
useType,
|
||||
tableId,
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@
|
|||
import tuicaiVue from './components/tuicai.vue';
|
||||
import go from '@/commons/utils/go.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import {$hasPermission} from '@/http/yskApi/shop.js'
|
||||
import {hasPermission} from '@/commons/utils/hasPermission.js'
|
||||
import {
|
||||
onLoad,
|
||||
onShow,
|
||||
|
|
@ -70,9 +72,18 @@
|
|||
tuicai.isSeatFee = seatFee
|
||||
tuicai.selGoods = seatFee
|
||||
}
|
||||
|
||||
function onSeatFeeTuiKuan(seatFee) {
|
||||
//是否有允许退款权限
|
||||
async function hasTuiKuan(){
|
||||
const isHas=await hasPermission('允许退款')
|
||||
return isHas
|
||||
}
|
||||
|
||||
async function onSeatFeeTuiKuan(seatFee) {
|
||||
console.log(seatFee);
|
||||
const canTuikuan=await hasTuiKuan()
|
||||
if(!canTuikuan){
|
||||
return
|
||||
}
|
||||
const {
|
||||
id,
|
||||
productId,
|
||||
|
|
@ -138,8 +149,13 @@
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
function onTuikuan(goods, index) {
|
||||
|
||||
|
||||
async function onTuikuan(goods, index) {
|
||||
const canTuikuan=await hasTuiKuan()
|
||||
if(!canTuikuan){
|
||||
return
|
||||
}
|
||||
const {
|
||||
id,
|
||||
productId,
|
||||
|
|
@ -147,6 +163,7 @@
|
|||
productName,
|
||||
productSkuName,
|
||||
cartId,
|
||||
orderId,
|
||||
num,
|
||||
priceAmount,
|
||||
price
|
||||
|
|
@ -154,6 +171,7 @@
|
|||
go.to('PAGES_ORDER_TUIKUAN', {
|
||||
id,
|
||||
cartId,
|
||||
orderId,
|
||||
productId,
|
||||
productSkuId,
|
||||
productName,
|
||||
|
|
|
|||
|
|
@ -49,7 +49,8 @@
|
|||
<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">
|
||||
<view class="tag" @click="changeTuiKuanSel(index)" :class="{active:index==tuikuan.sel}"
|
||||
v-for="(item,index) in tuikuan.list" :key="index">
|
||||
{{item}}
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -60,7 +61,8 @@
|
|||
|
||||
<view style="height: 200rpx;"></view>
|
||||
<view class="fixed-b">
|
||||
<up-button text="确认退款" shape="circle" type="primary" size="large" :color="color.ColorMain"></up-button>
|
||||
<up-button text="确认退款" @click="tuikuanConfirm" shape="circle" type="primary" size="large"
|
||||
:color="color.ColorMain"></up-button>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
|
@ -68,7 +70,12 @@
|
|||
|
||||
<script setup>
|
||||
import color from '@/commons/color.js';
|
||||
import infoBox from '@/commons/utils/infoBox.js';
|
||||
import * as orderApi from '@/http/yskApi/order.js'
|
||||
import {hasPermission} from '@/commons/utils/hasPermission.js'
|
||||
import {
|
||||
$returnOrder
|
||||
} from '@/http/yskApi/Instead.js'
|
||||
import {
|
||||
onLoad,
|
||||
onShow,
|
||||
|
|
@ -84,7 +91,7 @@
|
|||
let note = ref('')
|
||||
const tuikuan = reactive({
|
||||
list: ['点错', '数量点错', '客人要求', '协商退费'],
|
||||
sel: 0
|
||||
sel: -1
|
||||
})
|
||||
|
||||
function changeTuiKuanSel(i) {
|
||||
|
|
@ -97,41 +104,80 @@
|
|||
totalAmount: 0
|
||||
}
|
||||
})
|
||||
|
||||
watch(()=>allTui.value,(newval)=>{
|
||||
orderDetail.goodsList.map(v=>{
|
||||
v.number=newval?v.num:0
|
||||
|
||||
watch(() => allTui.value, (newval) => {
|
||||
orderDetail.goodsList.map(v => {
|
||||
v.number = newval ? v.num : 0
|
||||
})
|
||||
})
|
||||
|
||||
const totalNumber = computed(() => {
|
||||
return orderDetail.goodsList.reduce((prve, cur) => {
|
||||
return prve + cur.num * 1
|
||||
}, 0)
|
||||
})
|
||||
const tuikuanNumber = computed(() => {
|
||||
return orderDetail.goodsList.reduce((prve, cur) => {
|
||||
return prve + cur.number * 1
|
||||
}, 0)
|
||||
})
|
||||
|
||||
const totalPrice = computed(() => {
|
||||
return orderDetail.goodsList.reduce((prve, cur) => {
|
||||
return prve+cur.priceAmount*1
|
||||
return prve + cur.priceAmount * 1
|
||||
}, 0)
|
||||
})
|
||||
const tuikuanPrice = computed(() => {
|
||||
return orderDetail.goodsList.reduce((prve, cur) => {
|
||||
return prve+cur.number*cur.price
|
||||
return prve + cur.number * cur.price
|
||||
}, 0)
|
||||
})
|
||||
|
||||
|
||||
function to2(n){
|
||||
return Number(n).toFixed(2)
|
||||
|
||||
|
||||
function to2(n) {
|
||||
return Number(n).toFixed(2);
|
||||
}
|
||||
|
||||
function changeItem(item, step) {
|
||||
console.log(item);
|
||||
let newval = item.number * 1 + step * 1
|
||||
let newval = item.number * 1 + step * 1;
|
||||
if (newval <= 0) {
|
||||
newval = 0
|
||||
newval = 0;
|
||||
}
|
||||
if (newval >= item.num) {
|
||||
newval = item.num
|
||||
newval = item.num;
|
||||
}
|
||||
item.number = newval
|
||||
item.number = newval;
|
||||
allTui.value = totalNumber.value == tuikuanNumber.value ? true : false;
|
||||
}
|
||||
|
||||
async function tuikuanConfirm() {
|
||||
const canTuikuan=await hasPermission('允许退款')
|
||||
if(!canTuikuan){
|
||||
return infoBox.showToast('您没有退款权限')
|
||||
}
|
||||
if (tuikuanNumber.value <= 0) {
|
||||
return infoBox.showToast('退款商品数量不能为0!')
|
||||
}
|
||||
const selTag=tuikuan.list[tuikuan.sel]
|
||||
await $returnOrder({
|
||||
"orderId": option.orderId,
|
||||
"note":`${selTag?selTag:''}${note.value?(','+note.value):''}` ,
|
||||
"orderDetails":orderDetail.goodsList.filter(v=>v.number*1).map(v=>{
|
||||
return {
|
||||
id:v.id,
|
||||
num:v.number*1
|
||||
}
|
||||
})
|
||||
})
|
||||
infoBox.showToast('退款请求提交成功')
|
||||
setTimeout(()=>{
|
||||
uni.navigateBack({delta:1})
|
||||
},500)
|
||||
}
|
||||
const option=reactive({})
|
||||
onLoad((opt) => {
|
||||
Object.assign(option,opt)
|
||||
if (Array.isArray(opt)) {
|
||||
orderDetail.goodsList = opt
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue