Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b8e8815cca | |||
| 2c5b47ad8b | |||
| f265c47617 | |||
| d40ded92b0 | |||
| 2fac00ceeb | |||
| f7b26cfc70 | |||
| 273986578f | |||
| c28509474d | |||
| e37cab4692 | |||
| 21c667312f | |||
| 68993a05de | |||
| fbe170b254 | |||
| 448effd296 | |||
| 15a2429323 | |||
| 396e00db7d | |||
| 244396bfcd | |||
| e8e474d971 | |||
| 8826b206df | |||
| a20379890e | |||
| 7322bc0d0d | |||
| b6d4715655 | |||
| ade25a0880 | |||
| d075a346b8 | |||
| a0f5a41690 | |||
| 48c08abbb6 | |||
| f954bbd145 | |||
| 214026e859 |
@@ -1,78 +1,96 @@
|
|||||||
<template>
|
<template>
|
||||||
<view
|
<view class="fixed-wrap" :style="{ '--num': `${numValue}px` }">
|
||||||
class="fixed-wrap"
|
<view class="fixed-btn" :class="[type]" id="targetRef">
|
||||||
:style="{ '--num': showCancel ? '63px' : '0px' }"
|
<div class="btn">
|
||||||
v-if="isShow"
|
<u-button type="primary" :color="confirmColor" :shape="shape" size="large" @click="emits('confirm')">{{ confirmText }}</u-button>
|
||||||
>
|
</div>
|
||||||
<view class="fixed-btn" id="targetRef">
|
<div class="btn" v-if="showCancel">
|
||||||
<div class="btn">
|
<u-button :shape="shape" size="large" @click="emits('cancel')">取消</u-button>
|
||||||
<u-button
|
</div>
|
||||||
type="primary"
|
</view>
|
||||||
:shape="shape"
|
</view>
|
||||||
size="large"
|
|
||||||
@click="emits('confirm')"
|
|
||||||
>{{ confirmText }}</u-button
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
<div class="btn" v-if="showCancel">
|
|
||||||
<u-button :shape="shape" size="large" @click="emits('cancel')"
|
|
||||||
>取消</u-button
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, nextTick, getCurrentInstance ,computed} from "vue";
|
import { ref, onMounted, nextTick, getCurrentInstance, computed } from 'vue';
|
||||||
import { isMainShop } from "@/store/account.js";
|
// import { isMainShop } from '@/store/account.js';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
isOpenPermission: {
|
type: {
|
||||||
type: Boolean,
|
type: String,
|
||||||
default: true,
|
default: 'vertical' // horizontal横向 vertical竖向
|
||||||
},
|
},
|
||||||
confirmText: {
|
isOpenPermission: {
|
||||||
type: String,
|
type: Boolean,
|
||||||
default: "保存",
|
default: true
|
||||||
},
|
},
|
||||||
showCancel: {
|
confirmText: {
|
||||||
type: Boolean,
|
type: String,
|
||||||
default: false,
|
default: '保存'
|
||||||
},
|
},
|
||||||
shape: {
|
confirmColor: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "circle", // squre circle
|
default: '#3C9CFF'
|
||||||
},
|
},
|
||||||
|
showCancel: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
shape: {
|
||||||
|
type: String,
|
||||||
|
default: 'circle' // squre circle
|
||||||
|
}
|
||||||
});
|
});
|
||||||
const isShow = computed(() => {
|
|
||||||
if (props.isOpenPermission) {
|
// const isShow = computed(() => {
|
||||||
return isMainShop();
|
// if (props.isOpenPermission) {
|
||||||
}
|
// return isMainShop();
|
||||||
return true;
|
// }
|
||||||
|
// return true;
|
||||||
|
// });
|
||||||
|
|
||||||
|
const numValue = computed(() => {
|
||||||
|
let num = 0;
|
||||||
|
if (props.type == 'vertical' && props.showCancel) {
|
||||||
|
num = 63;
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
if (props.type == 'horizontal') {
|
||||||
|
num = 0;
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
return num;
|
||||||
});
|
});
|
||||||
const emits = defineEmits(["confirm", "cancel"]);
|
|
||||||
|
const emits = defineEmits(['confirm', 'cancel']);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.fixed-wrap {
|
.fixed-wrap {
|
||||||
--height: calc(83px + var(--num) + env(safe-area-inset-bottom) / 2);
|
--height: calc(83px + var(--num) + env(safe-area-inset-bottom) / 2);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: var(--height);
|
height: var(--height);
|
||||||
.fixed-btn {
|
.fixed-btn {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: var(--height);
|
height: var(--height);
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
z-index: 99;
|
z-index: 999;
|
||||||
padding: 10px 14px calc(20px + env(safe-area-inset-bottom) / 2) 10px;
|
padding: 10px 14px calc(20px + env(safe-area-inset-bottom) / 2) 10px;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
.btn {
|
&.horizontal {
|
||||||
&:first-child {
|
display: flex;
|
||||||
margin-bottom: 14px;
|
gap: 28upx;
|
||||||
}
|
.btn {
|
||||||
}
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
.btn {
|
||||||
|
&:first-child {
|
||||||
|
margin-bottom: 14px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -15,7 +15,8 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="right" v-if="showSwitch">
|
<view class="right" v-if="showSwitch">
|
||||||
<u-switch :active-value="1" :inactive-value="0" v-model="isOpen" @change="defineEmits(['update:isOpen'])"></u-switch>
|
<!-- 关键修复:删掉错误的 @change 绑定,defineModel 已自动处理双向绑定 -->
|
||||||
|
<u-switch :active-value="1" :inactive-value="0" v-model="isOpen"></u-switch>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -27,11 +28,12 @@ import { ref, onMounted, nextTick } from 'vue';
|
|||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
options: {
|
options: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: {
|
default: () => ({
|
||||||
|
// 注意:对象/数组默认值推荐用函数,避免引用共享
|
||||||
name: '标题',
|
name: '标题',
|
||||||
intro: '说明',
|
intro: '说明',
|
||||||
icon: 'xszk'
|
icon: 'xszk'
|
||||||
}
|
})
|
||||||
},
|
},
|
||||||
showSwitch: {
|
showSwitch: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@@ -41,11 +43,13 @@ const props = defineProps({
|
|||||||
|
|
||||||
const headHeight = ref(70);
|
const headHeight = ref(70);
|
||||||
|
|
||||||
|
// defineModel 是 Vue3.4+ 语法糖,自动实现 v-model:isOpen 的双向绑定
|
||||||
const isOpen = defineModel('isOpen', {
|
const isOpen = defineModel('isOpen', {
|
||||||
type: [Boolean, String, Number],
|
type: [Boolean, String, Number],
|
||||||
default: 0
|
default: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 声明自定义 emit 事件(仅在 script setup 内使用)
|
||||||
const emits = defineEmits(['load']);
|
const emits = defineEmits(['load']);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@@ -83,6 +87,7 @@ onMounted(() => {
|
|||||||
padding-left: 20upx;
|
padding-left: 20upx;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
.title {
|
.title {
|
||||||
|
margin-top: -4upx;
|
||||||
.t {
|
.t {
|
||||||
font-size: 28upx;
|
font-size: 28upx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|||||||
@@ -1,118 +1,110 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<up-radio-group v-model="useTimeType" placement="row">
|
<up-radio-group v-model="useTimeType" placement="row" v-if="showType">
|
||||||
<up-radio
|
<up-radio v-for="item in useTimeTypeList" :key="item.value" :value="item.value" :name="item.value" :label="item.label" :customStyle="customStyle"></up-radio>
|
||||||
v-for="item in useTimeTypeList"
|
</up-radio-group>
|
||||||
:key="item.value"
|
<view class="container" v-if="useTimeType == 'custom' || !showType">
|
||||||
:value="item.value"
|
<view class="u-flex u-m-t-30 box">
|
||||||
:name="item.value"
|
<view class="u-flex u-flex-1">
|
||||||
:label="item.label"
|
<view class="item" @click="pirckerShow(startValue, 'startValue')">
|
||||||
:customStyle="customStyle"
|
<text class="u-m-r-12" v-if="!startValue">开始时间</text>
|
||||||
></up-radio>
|
<text class="u-m-r-12" v-else>{{ startValue }}</text>
|
||||||
</up-radio-group>
|
</view>
|
||||||
<view class="container" v-if="useTimeType == 'custom'">
|
<view class="u-m-l-8 u-m-r-8" style="padding: 0 30rpx">—</view>
|
||||||
<view class="u-flex u-m-t-30 box" >
|
<view class="item" @click="pirckerShow(endValue, 'endValue')">
|
||||||
<view class="u-flex u-flex-1">
|
<text class="u-m-r-12" v-if="!endValue">结束时间</text>
|
||||||
<view class="item" @click="pirckerShow(startValue, 'startValue')">
|
<text class="u-m-r-12" v-else>{{ endValue }}</text>
|
||||||
<text class="u-m-r-12" v-if="!startValue">开始时间</text>
|
</view>
|
||||||
<text class="u-m-r-12" v-else>{{ startValue }}</text>
|
</view>
|
||||||
</view>
|
<up-icon name="clock"></up-icon>
|
||||||
<view class="u-m-l-8 u-m-r-8" style="padding: 0 30rpx">—</view>
|
</view>
|
||||||
<view class="item" @click="pirckerShow(endValue, 'endValue')">
|
</view>
|
||||||
<text class="u-m-r-12" v-if="!endValue">结束时间</text>
|
|
||||||
<text class="u-m-r-12" v-else>{{ endValue }}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<up-icon name="clock"></up-icon>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<up-datetime-picker
|
<up-datetime-picker :show="show" v-model="value1" closeOnClickOverlay @close="close" @cancel="close" @confirm="confirm" mode="time"></up-datetime-picker>
|
||||||
:show="show"
|
</view>
|
||||||
v-model="value1"
|
|
||||||
closeOnClickOverlay
|
|
||||||
@close="close"
|
|
||||||
@cancel="close"
|
|
||||||
@confirm="confirm"
|
|
||||||
mode="time"
|
|
||||||
></up-datetime-picker>
|
|
||||||
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref } from "vue";
|
import { computed, ref } from 'vue';
|
||||||
function cancel(){
|
|
||||||
union.navigateBack()
|
const props = defineProps({
|
||||||
}
|
showType: {
|
||||||
const customStyle = ref({
|
type: Boolean,
|
||||||
marginRight: "15px",
|
default: true
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const useTimeType = defineModel("useTimeType", {
|
function cancel() {
|
||||||
type: String,
|
union.navigateBack();
|
||||||
default: "all",
|
}
|
||||||
|
const customStyle = ref({
|
||||||
|
marginRight: '15px'
|
||||||
|
});
|
||||||
|
|
||||||
|
const useTimeType = defineModel('useTimeType', {
|
||||||
|
type: String,
|
||||||
|
default: 'all'
|
||||||
});
|
});
|
||||||
const useTimeTypeList = [
|
const useTimeTypeList = [
|
||||||
{
|
{
|
||||||
value: "all",
|
value: 'all',
|
||||||
label: "全时段可用",
|
label: '全时段可用'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "custom",
|
value: 'custom',
|
||||||
label: "指定时间段可用",
|
label: '指定时间段可用'
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
import dayjs from "dayjs";
|
import dayjs from 'dayjs';
|
||||||
const startValue = defineModel("startValue", {
|
const startValue = defineModel('startValue', {
|
||||||
type: String,
|
type: String,
|
||||||
default: "",
|
default: ''
|
||||||
});
|
});
|
||||||
const endValue = defineModel("endValue", {
|
const endValue = defineModel('endValue', {
|
||||||
type: String,
|
type: String,
|
||||||
default: "",
|
default: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
function close() {
|
function close() {
|
||||||
show.value = false;
|
show.value = false;
|
||||||
}
|
}
|
||||||
const value1 = ref("");
|
const value1 = ref('');
|
||||||
const show = ref(false);
|
const show = ref(false);
|
||||||
const nowKey = ref("");
|
const nowKey = ref('');
|
||||||
|
|
||||||
function pirckerShow(date, key) {
|
function pirckerShow(date, key) {
|
||||||
nowKey.value = key;
|
nowKey.value = key;
|
||||||
show.value = true;
|
show.value = true;
|
||||||
value1.value = date || "";
|
value1.value = date || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function confirm(e) {
|
function confirm(e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
|
|
||||||
if (nowKey.value == "startValue") {
|
if (nowKey.value == 'startValue') {
|
||||||
startValue.value = e.value;
|
startValue.value = e.value;
|
||||||
} else if (nowKey.value == "endValue") {
|
} else if (nowKey.value == 'endValue') {
|
||||||
endValue.value = e.value;
|
endValue.value = e.value;
|
||||||
}
|
}
|
||||||
value1.value = e.value;
|
value1.value = e.value;
|
||||||
show.value = false;
|
show.value = false;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.item {
|
.item {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
line-height: 48rpx;
|
line-height: 48rpx;
|
||||||
padding: 0 12rpx;
|
padding: 0 12rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
.box {
|
.box {
|
||||||
border: 2rpx solid #dddfe6;
|
border: 2rpx solid #dddfe6;
|
||||||
padding: 16rpx 30rpx;
|
padding: 16rpx 30rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
width: 564rpx;
|
width: 564rpx;
|
||||||
border-radius: 4rpx;
|
border-radius: 4rpx;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<view @click="show = true">
|
<view @click="show = true">
|
||||||
<slot v-if="$slots.default"></slot>
|
<slot v-if="$slots.default"></slot>
|
||||||
<view v-else class="choose-goods u-flex u-row-between">
|
<view v-else class="choose-goods u-flex u-row-between">
|
||||||
<text class="color-999" v-if="!modelValue">请选择商品</text>
|
<text class="color-999" v-if="!modelValue">请选择优惠券</text>
|
||||||
<text class="color-333 u-m-r-32 u-line-1" v-else>{{ goodsName }}</text>
|
<text class="color-333 u-m-r-32 u-line-1" v-else>{{ goodsName }}</text>
|
||||||
<up-icon size="14" name="arrow-down"></up-icon>
|
<up-icon size="14" name="arrow-down"></up-icon>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -1,89 +1,89 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="upload-file" @click="chooseImage">
|
<view class="upload-file" @click="chooseImage">
|
||||||
<slot v-if="$slots.default"></slot>
|
<slot v-if="$slots.default"></slot>
|
||||||
<view class="icon" v-if="!modelValue"> + </view>
|
<view class="icon" v-if="!modelValue">+</view>
|
||||||
<image class="img" v-else :src="modelValue"></image>
|
<image class="img" v-else :src="modelValue"></image>
|
||||||
|
|
||||||
<view class="close" @click.stop="()=>{}" v-if="modelValue">
|
<view class="close" @click.stop="() => {}" v-if="modelValue">
|
||||||
<up-icon name="close-circle" color="#333" size="14" @click="clearImg" ></up-icon>
|
<up-icon name="close-circle" color="#333" size="14" @click="clearImg"></up-icon>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { uploadFile } from "@/http/api/index.js";
|
import { uploadFile } from '@/http/api/index.js';
|
||||||
|
|
||||||
import { reactive, ref, watch } from "vue";
|
import { reactive, ref, watch } from 'vue';
|
||||||
|
|
||||||
const modelValue = defineModel({
|
const modelValue = defineModel({
|
||||||
type: String,
|
type: String,
|
||||||
default: "",
|
default: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
function chooseImage() {
|
function chooseImage() {
|
||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: 1, //默认9
|
count: 1, //默认9
|
||||||
sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
||||||
sourceType: ["album", "camera "],
|
sourceType: ['album', 'camera'],
|
||||||
success: async function (res) {
|
success: async function (res) {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: "上传中",
|
title: '上传中'
|
||||||
});
|
});
|
||||||
console.log(res);
|
console.log(res);
|
||||||
const fileRes = await uploadFile(res.tempFiles[0]);
|
const fileRes = await uploadFile(res.tempFiles[0]);
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
if (fileRes) {
|
if (fileRes) {
|
||||||
modelValue.value = fileRes;
|
modelValue.value = fileRes;
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "上传失败",
|
title: '上传失败',
|
||||||
icon: "none",
|
icon: 'none'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearImg(){
|
function clearImg() {
|
||||||
modelValue.value=""
|
modelValue.value = '';
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.upload-file {
|
.upload-file {
|
||||||
$size: 128rpx;
|
$size: 128rpx;
|
||||||
width: $size;
|
width: $size;
|
||||||
height: $size;
|
height: $size;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border: 1px dashed #d9d9d9;
|
border: 1px dashed #d9d9d9;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
position: relative;
|
position: relative;
|
||||||
.close{
|
.close {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: -10rpx;
|
right: -10rpx;
|
||||||
top: -10rpx;
|
top: -10rpx;
|
||||||
}
|
}
|
||||||
.img {
|
.img {
|
||||||
width: $size;
|
width: $size;
|
||||||
height: $size;
|
height: $size;
|
||||||
}
|
}
|
||||||
.icon {
|
.icon {
|
||||||
width: 36rpx;
|
width: 36rpx;
|
||||||
height: 36rpx;
|
height: 36rpx;
|
||||||
border: 4rpx solid #999;
|
border: 4rpx solid #999;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #999;
|
color: #999;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
181
components/my-components/my-upload-imgs.vue
Normal file
181
components/my-components/my-upload-imgs.vue
Normal file
@@ -0,0 +1,181 @@
|
|||||||
|
<template>
|
||||||
|
<view class="upload-file-wrap">
|
||||||
|
<!-- 多图展示区域 -->
|
||||||
|
<view class="upload-file-item" v-for="(img, index) in modelValue" :key="index">
|
||||||
|
<image class="img" :src="img" mode="aspectFill" @click="previewImage(index)"></image>
|
||||||
|
<view class="close" @click.stop="removeImg(index)">
|
||||||
|
<up-icon name="close-circle" color="#333" size="14"></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 上传按钮(未达上限时显示) -->
|
||||||
|
<view class="upload-file-btn" @click="chooseImage" v-if="modelValue.length < props.maxCount">
|
||||||
|
<slot v-if="$slots.default"></slot>
|
||||||
|
<view class="icon" v-else>+</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { uploadFile } from '@/http/api/index.js';
|
||||||
|
import { ref, watch, defineProps, defineEmits } from 'vue';
|
||||||
|
|
||||||
|
// 1. 定义Props(扩展配置项)
|
||||||
|
const props = defineProps({
|
||||||
|
// 最大上传数量(默认9,可外部传参)
|
||||||
|
maxCount: {
|
||||||
|
type: Number,
|
||||||
|
default: 9
|
||||||
|
},
|
||||||
|
// 是否压缩(默认开启)
|
||||||
|
isCompressed: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
// 图片来源(相册/相机,默认都支持)
|
||||||
|
sourceType: {
|
||||||
|
type: Array,
|
||||||
|
default: () => ['album', 'camera']
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 2. 双向绑定多图列表(Array类型)
|
||||||
|
const modelValue = defineModel({
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
});
|
||||||
|
|
||||||
|
// 3. 选择图片(支持多图)
|
||||||
|
async function chooseImage() {
|
||||||
|
// 计算剩余可上传数量
|
||||||
|
const remainCount = props.maxCount - modelValue.value.length;
|
||||||
|
if (remainCount <= 0) {
|
||||||
|
uni.showToast({ title: `最多只能上传${props.maxCount}张图片`, icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uni.chooseImage({
|
||||||
|
count: remainCount, // 仅能选择剩余数量的图片
|
||||||
|
sizeType: props.isCompressed ? ['compressed'] : ['original', 'compressed'],
|
||||||
|
sourceType: props.sourceType,
|
||||||
|
success: async function (res) {
|
||||||
|
uni.showLoading({ title: '上传中' });
|
||||||
|
try {
|
||||||
|
// 批量上传选中的图片
|
||||||
|
const uploadPromises = res.tempFiles.map((file) => uploadFile(file));
|
||||||
|
const fileResList = await Promise.all(uploadPromises);
|
||||||
|
|
||||||
|
// 过滤上传失败的图片,仅保留成功的URL
|
||||||
|
const successUrls = fileResList.filter((url) => !!url);
|
||||||
|
if (successUrls.length > 0) {
|
||||||
|
modelValue.value = [...modelValue.value, ...successUrls]; // 追加到列表
|
||||||
|
uni.showToast({ title: `成功上传${successUrls.length}张图片`, icon: 'success' });
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
uni.showToast({ title: '部分图片上传失败', icon: 'none' });
|
||||||
|
console.error('图片上传失败:', error);
|
||||||
|
} finally {
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
uni.showToast({ title: '取消选择图片', icon: 'none' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 删除单张图片
|
||||||
|
function removeImg(index) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '确定要删除这张图片吗?',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
modelValue.value.splice(index, 1); // 删除对应索引的图片
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. 预览图片(支持左右滑动)
|
||||||
|
function previewImage(currentIndex) {
|
||||||
|
uni.previewImage({
|
||||||
|
urls: modelValue.value, // 所有已上传的图片列表
|
||||||
|
current: modelValue.value[currentIndex], // 当前预览的图片
|
||||||
|
loop: true // 支持循环预览
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6. 扩展:批量清空图片(可暴露给父组件调用)
|
||||||
|
const clearAllImg = () => {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '确定要清空所有图片吗?',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
modelValue.value = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 暴露方法给父组件
|
||||||
|
defineExpose({ clearAllImg });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.upload-file-wrap {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 20rpx; // 图片之间的间距
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-file-item {
|
||||||
|
$size: 128rpx;
|
||||||
|
width: $size;
|
||||||
|
height: $size;
|
||||||
|
border: 1px dashed #d9d9d9;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close {
|
||||||
|
position: absolute;
|
||||||
|
right: -10rpx;
|
||||||
|
top: -10rpx;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 50%;
|
||||||
|
padding: 2rpx;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-file-btn {
|
||||||
|
$size: 128rpx;
|
||||||
|
width: $size;
|
||||||
|
height: $size;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
border: 1px dashed #d9d9d9;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
width: 36rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
border: 4rpx solid #999;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #999;
|
||||||
|
font-size: 32rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,63 +1,57 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<up-checkbox-group v-model="selectedWeek" :options="week">
|
<up-checkbox-group v-model="selectedWeek" :options="week">
|
||||||
<up-checkbox
|
<up-checkbox :customStyle="customStyle" :shape="shape" v-for="item in week" :key="item.value" :value="item.value" :name="item.value" :label="item.value">
|
||||||
:customStyle="customStyle"
|
{{ item.name }}
|
||||||
:shape="shape"
|
</up-checkbox>
|
||||||
v-for="item in week"
|
</up-checkbox-group>
|
||||||
:key="item.value"
|
</view>
|
||||||
:value="item.value"
|
|
||||||
:name="item.value"
|
|
||||||
:label="item.value"
|
|
||||||
>{{ item.name }}</up-checkbox>
|
|
||||||
</up-checkbox-group>
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from "vue";
|
import { ref } from 'vue';
|
||||||
|
|
||||||
const customStyle={
|
const customStyle = {
|
||||||
marginRight: '40rpx',
|
marginRight: '40rpx',
|
||||||
marginBottom: '16rpx',
|
marginBottom: '16rpx'
|
||||||
}
|
};
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
shape: {
|
shape: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'square' // circle
|
default: 'square' // circle
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
const selectedWeek=defineModel({
|
const selectedWeek = defineModel({
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => [],
|
default: () => []
|
||||||
});
|
});
|
||||||
const week = ref([
|
const week = ref([
|
||||||
{
|
{
|
||||||
name: "周一",
|
name: '周一',
|
||||||
value:"周一",
|
value: '周一'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "周二",
|
name: '周二',
|
||||||
value:"周二",
|
value: '周二'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "周三",
|
name: '周三',
|
||||||
value:"周三",
|
value: '周三'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "周四",
|
name: '周四',
|
||||||
value:"周四",
|
value: '周四'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "周五",
|
name: '周五',
|
||||||
value:"周五",
|
value: '周五'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "周六",
|
name: '周六',
|
||||||
value:"周六",
|
value: '周六'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "周日",
|
name: '周日',
|
||||||
value:"周日",
|
value: '周日'
|
||||||
},
|
}
|
||||||
]);
|
]);
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
145
http/api/market/point.js
Normal file
145
http/api/market/point.js
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
import http from '@/http/http.js'
|
||||||
|
const request = http.request
|
||||||
|
const MARKET_URL = 'market'
|
||||||
|
const ORDER_URL = 'order'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 积分:配置:新增/更新
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function pointsConfigPost(data) {
|
||||||
|
return request({
|
||||||
|
url: `${MARKET_URL}/admin/points/config`,
|
||||||
|
method: "POST",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 积分:配置:详情
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function pointsConfigGet() {
|
||||||
|
return request({
|
||||||
|
url: `${MARKET_URL}/admin/points/config`,
|
||||||
|
method: "GET"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 积分:商品:列表
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function pointsGoodsPage(data) {
|
||||||
|
return request({
|
||||||
|
url: `${MARKET_URL}/admin/pointsGoods/page`,
|
||||||
|
method: "GET",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 积分:商品:新增/修改
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function pointsGoodsPost(data) {
|
||||||
|
return request({
|
||||||
|
url: `${MARKET_URL}/admin/pointsGoods`,
|
||||||
|
method: "POST",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 积分-商品-删除
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function pointsGoodsDel(id) {
|
||||||
|
return request({
|
||||||
|
url: `${MARKET_URL}/admin/pointsGoods/${id}`,
|
||||||
|
method: "DELETE"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 积分:商品:详情
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function pointsGoodsDetail(id) {
|
||||||
|
return request({
|
||||||
|
url: `${MARKET_URL}/admin/pointsGoods/${id}`,
|
||||||
|
method: "GET"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 积分:积分商品:兑换记录
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function goodsRecordPage(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/points/goodsRecord/page`,
|
||||||
|
method: "GET",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 积分:积分商品:商家核销
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function goodsRecordCkecout(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/points/goodsRecord/checkout`,
|
||||||
|
method: "post",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 积分:积分商品:同意退单
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function goodsRecordAgreeRefund(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/points/goodsRecord/agreeRefund`,
|
||||||
|
method: "post",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 积分:积分商品:驳回退单
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function goodsRecordRejectRefund(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/points/goodsRecord/rejectRefund`,
|
||||||
|
method: "post",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 积分:获取用户所有门店下积分列表
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function pointUserPage(data) {
|
||||||
|
return request({
|
||||||
|
url: `${MARKET_URL}/admin/points/userPage`,
|
||||||
|
method: "GET",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 积分:积分详情
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function pointUserRecord(data) {
|
||||||
|
return request({
|
||||||
|
url: `${MARKET_URL}/admin/points/userRecord`,
|
||||||
|
method: "GET",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@ const request = http.request
|
|||||||
* 获取商品分页
|
* 获取商品分页
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function getProductPage(data, urlType = 'product' ,showLoading) {
|
export function getProductPage(data, urlType = 'product', showLoading) {
|
||||||
return request({
|
return request({
|
||||||
url: `${urlType}/admin/product/page`,
|
url: `${urlType}/admin/product/page`,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
@@ -20,7 +20,7 @@ export function getProductPage(data, urlType = 'product' ,showLoading) {
|
|||||||
* 获取商品列表
|
* 获取商品列表
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function getProductList(data, urlType = 'product' ,showLoading) {
|
export function getProductList(data, urlType = 'product', showLoading) {
|
||||||
return request({
|
return request({
|
||||||
url: `${urlType}/admin/product/list`,
|
url: `${urlType}/admin/product/list`,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
@@ -36,11 +36,11 @@ export function getProductList(data, urlType = 'product' ,showLoading) {
|
|||||||
* 获取商品详情
|
* 获取商品详情
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function getProductDetail (id, urlType = 'product') {
|
export function getProductDetail(id, urlType = 'product') {
|
||||||
return request({
|
return request({
|
||||||
url: `${urlType}/admin/product/${id}`,
|
url: `${urlType}/admin/product/${id}`,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ export function delProduct(id, urlType = 'product') {
|
|||||||
* 商品上下架
|
* 商品上下架
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function productOnOff (data, urlType = 'product') {
|
export function productOnOff(data, urlType = 'product') {
|
||||||
return request({
|
return request({
|
||||||
url: `${urlType}/admin/product/onOff`,
|
url: `${urlType}/admin/product/onOff`,
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -87,7 +87,7 @@ export function productOnOff (data, urlType = 'product') {
|
|||||||
* 商品售罄
|
* 商品售罄
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function productMarkIsSoldOut (data, urlType = 'product') {
|
export function productMarkIsSoldOut(data, urlType = 'product') {
|
||||||
return request({
|
return request({
|
||||||
url: `${urlType}/admin/product/markIsSoldOut`,
|
url: `${urlType}/admin/product/markIsSoldOut`,
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -262,7 +262,7 @@ export function delSpec(id, urlType = 'product') {
|
|||||||
return request({
|
return request({
|
||||||
url: `${urlType}/admin/prod/spec/${id}`,
|
url: `${urlType}/admin/prod/spec/${id}`,
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -343,4 +343,28 @@ export function delProdGroup(id, urlType = 'product') {
|
|||||||
url: `${urlType}/admin/prod/group/${id}`,
|
url: `${urlType}/admin/prod/group/${id}`,
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库单识别
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function stockOcr(data, urlType = 'product') {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/product/stock/ocr`,
|
||||||
|
method: "post",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ocr识别结果
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function ocrResult(data, urlType = 'product') {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/product/stock/ocrResult`,
|
||||||
|
method: "get",
|
||||||
|
data
|
||||||
|
})
|
||||||
}
|
}
|
||||||
7
http/api/product/stick.js
Normal file
7
http/api/product/stick.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import http from "@/http/http.js";
|
||||||
|
const request = http.request;
|
||||||
|
const urlType = "product";
|
||||||
|
|
||||||
|
export function stickCount(file, data) {
|
||||||
|
return http.upload(`${urlType}/admin/stick/count`,data,file)
|
||||||
|
}
|
||||||
@@ -15,6 +15,18 @@ export function getVendorPage(data, urlType = 'product') {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取供应商列表/无分页
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function getVendorList(urlType = 'product') {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/product/vendor/list`,
|
||||||
|
method: "GET"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加供应商
|
* 添加供应商
|
||||||
* @returns
|
* @returns
|
||||||
@@ -52,5 +64,4 @@ export function delVendor(id, urlType = 'product') {
|
|||||||
url: `${urlType}/admin/product/vendor/${id}`,
|
url: `${urlType}/admin/product/vendor/${id}`,
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
303
http/api/ware.js
Normal file
303
http/api/ware.js
Normal file
@@ -0,0 +1,303 @@
|
|||||||
|
import http from '@/http/http.js'
|
||||||
|
const request = http.request
|
||||||
|
const ORDER_URL = 'order'
|
||||||
|
const Market_BaseUrl = 'market'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团商品-列表
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function getGbWarePage(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/ware/getGbWarePage`,
|
||||||
|
method: "GET",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团商品-新增
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function addGbWare(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/ware/addGbWare`,
|
||||||
|
method: "post",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团商品-列表
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function updateGbWareById(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/ware/updateGbWareById`,
|
||||||
|
method: "post",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团商品-修改状态
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function editOnlineStatus(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/ware/editOnlineStatus`,
|
||||||
|
method: "post",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团商品-删除
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function deleteGbWare(id) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/ware/deleteGbWare/${id}`,
|
||||||
|
method: "DELETE"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团商品:订单列表
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function gbOrderPage(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/gbOrder/page`,
|
||||||
|
method: "GET",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团商品-活动开关
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function upShopConfig(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/ware/upShopConfig`,
|
||||||
|
method: "POST",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团订单-退单/同意退单
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function agreeRefund(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/gbOrder/agreeRefund`,
|
||||||
|
method: "POST",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团订单-驳回退单
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function rejectRefund(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/gbOrder/rejectRefund`,
|
||||||
|
method: "POST",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团商品:核销
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function checkout(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/gbOrder/checkout`,
|
||||||
|
method: "POST",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团商品:拼团商品详情
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function wareDetail(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/ware/ware/detail`,
|
||||||
|
method: "get",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:添加套餐
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageAddEdit(data) {
|
||||||
|
return request({
|
||||||
|
url: `${Market_BaseUrl}/admin/package`,
|
||||||
|
method: data.id ? 'put' : 'post',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:获取套餐列表
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageGet(params) {
|
||||||
|
return request({
|
||||||
|
url: `${Market_BaseUrl}/admin/package`,
|
||||||
|
method: 'get',
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:获取套餐推广开关
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageSwitchGet() {
|
||||||
|
return request({
|
||||||
|
url: `${Market_BaseUrl}/admin/package/switch`,
|
||||||
|
method: 'get'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:修改套餐推广开关
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageSwitchPut(data) {
|
||||||
|
return request({
|
||||||
|
url: `${Market_BaseUrl}/admin/package/switch`,
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:删除套餐
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageDel(id) {
|
||||||
|
return request({
|
||||||
|
url: `${Market_BaseUrl}/admin/package/${id}`,
|
||||||
|
method: 'DELETE'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:确认删除套餐
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageSureDel(id) {
|
||||||
|
return request({
|
||||||
|
url: `${Market_BaseUrl}/admin/package/sure/${id}`,
|
||||||
|
method: 'DELETE'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:修改套餐推广开关
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageOnline(data) {
|
||||||
|
return request({
|
||||||
|
url: `${Market_BaseUrl}/admin/package/online`,
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:获取套餐推广订单列表
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageOrder(params) {
|
||||||
|
return request({
|
||||||
|
url: `${Market_BaseUrl}/admin/package/order`,
|
||||||
|
method: 'GET',
|
||||||
|
params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:订单统计
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageOrderStat(params) {
|
||||||
|
return request({
|
||||||
|
url: `${Market_BaseUrl}/admin/package/order/stat`,
|
||||||
|
method: 'GET',
|
||||||
|
params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:确认退单
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageConfirmRefund(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/ppOrder/confirmRefund`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:驳回退单
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageRejectRefund(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/ppOrder/rejectRefund`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:核销
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageCheckout(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/ppOrder/checkout`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:获取套餐详情
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageDetail(data) {
|
||||||
|
return request({
|
||||||
|
url: `${Market_BaseUrl}/admin/package/detail/${data.id}`,
|
||||||
|
method: 'GET',
|
||||||
|
data: {
|
||||||
|
shopId: data.shopId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -15,8 +15,8 @@ import infoBox from "@/commons/utils/infoBox.js";
|
|||||||
import go from "@/commons/utils/go.js";
|
import go from "@/commons/utils/go.js";
|
||||||
import { reject } from "lodash";
|
import { reject } from "lodash";
|
||||||
// 设置node环境
|
// 设置node环境
|
||||||
envConfig.changeEnv(storageManage.env('production')) //正式
|
// envConfig.changeEnv(storageManage.env('production')) //正式
|
||||||
// envConfig.changeEnv(storageManage.env("development")); //测试
|
envConfig.changeEnv(storageManage.env("development")); //测试
|
||||||
|
|
||||||
// 测试服
|
// 测试服
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ import infoBox from "@/commons/utils/infoBox.js"
|
|||||||
import go from '@/commons/utils/go.js';
|
import go from '@/commons/utils/go.js';
|
||||||
import { reject } from 'lodash';
|
import { reject } from 'lodash';
|
||||||
// 设置node环境
|
// 设置node环境
|
||||||
envConfig.changeEnv(storageManage.env('production'))
|
// envConfig.changeEnv(storageManage.env('production'))
|
||||||
// envConfig.changeEnv(storageManage.env('development'))
|
|
||||||
|
|
||||||
// 测试服
|
// 测试服
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
"pinia-plugin-unistorage": "^0.1.2",
|
"pinia-plugin-unistorage": "^0.1.2",
|
||||||
"to-arraybuffer": "^1.0.1",
|
"to-arraybuffer": "^1.0.1",
|
||||||
"uview-plus": "^3.3.32",
|
"uview-plus": "^3.3.32",
|
||||||
"ysk-utils": "^1.0.78"
|
"ysk-utils": "^1.0.82"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"copy-webpack-plugin": "^12.0.2",
|
"copy-webpack-plugin": "^12.0.2",
|
||||||
|
|||||||
@@ -1,188 +1,288 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="topTitle">
|
<view class="topTitle">耗材信息</view>
|
||||||
耗材信息
|
|
||||||
</view>
|
|
||||||
<view class="addConsumables">
|
<view class="addConsumables">
|
||||||
<view>
|
<view>
|
||||||
<view>
|
<view>
|
||||||
<view> 单位 </view>
|
<view>单位</view>
|
||||||
<view> <input type="text" placeholder="请输入单位" v-model="datas.form.conUnit" name="" id=""> </view>
|
<view><input type="text" placeholder="请输入单位" v-model="datas.form.conUnit" name="" id="" /></view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view> 耗材名称 </view>
|
<view>耗材名称</view>
|
||||||
<view> <input type="text" placeholder="请输入耗材名称" v-model="datas.form.conName" name="" id=""> </view>
|
<view><input type="text" placeholder="请输入耗材名称" v-model="datas.form.conName" name="" id="" /></view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view> 耗材价格 </view>
|
<view>耗材价格</view>
|
||||||
<view> <input class="uni-input" placeholder="请输入耗材价格" type="digit" v-model="datas.form.price" > </view>
|
<view><input class="uni-input" placeholder="请输入耗材价格" type="digit" v-model="datas.form.price" /></view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view> 预警值 </view>
|
<view>预警值</view>
|
||||||
<view> <input type="number" placeholder="请输入预警值" v-model="datas.form.conWarning" name="" id=""> </view>
|
<view><input type="number" placeholder="请输入预警值" v-model="datas.form.conWarning" name="" id="" /></view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="!datas.form.id" style="justify-content: space-between;">
|
<view v-if="!datas.form.id" style="justify-content: space-between">
|
||||||
<view> 耗材类型 </view>
|
<view>耗材类型</view>
|
||||||
<view style="width: 54%;" @tap="datas.show = !datas.show">
|
<view style="width: 54%" @tap="datas.show = !datas.show">
|
||||||
{{datas.consGroupName||'请选择耗材类型'}}
|
{{ datas.consGroupName || '请选择耗材类型' }}
|
||||||
</view>
|
</view>
|
||||||
<uni-icons type="bottom" size="16"></uni-icons>
|
<uni-icons type="bottom" size="16"></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<template v-if="datas.form.id">
|
||||||
|
<view class="tips-wrap">
|
||||||
|
<view class="content">
|
||||||
|
<u-icon name="error-circle-fill" color="#e6a23c" size="30"></u-icon>
|
||||||
|
<view class="info">
|
||||||
|
<text class="t1">提示</text>
|
||||||
|
<text class="t2">换算值为第二单位*第二单位转换数量=第一单位</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="form-wrap">
|
||||||
|
<view class="form">
|
||||||
|
<view class="row">
|
||||||
|
<view class="label">第二单位</view>
|
||||||
|
<view class="ipt">
|
||||||
|
<u-input placeholder="请输入第二单位" v-model="datas.form.conUnitTwo"></u-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="row">
|
||||||
|
<view class="label">第二单位转换数量</view>
|
||||||
|
<view class="ipt">
|
||||||
|
<u-input placeholder="请输入第二单位转换数量" v-model="datas.form.conUnitTwoConvert"></u-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="row">
|
||||||
|
<view class="label">默认入库单位</view>
|
||||||
|
<view class="ipt">
|
||||||
|
<u-radio-group v-model="datas.form.defaultUnit">
|
||||||
|
<u-radio :name="item" :label="item" v-for="(item, index) in unitList" :key="index"></u-radio>
|
||||||
|
</u-radio-group>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
<view class="bottombutton">
|
<view class="bottombutton">
|
||||||
<up-button type="primary" style="background-color: #318AFE;color: #fff;" @tap="sumbit" :plain="true"
|
<up-button type="primary" style="background-color: #318afe; color: #fff" @tap="sumbit" :plain="true" text="保存"></up-button>
|
||||||
text="保存"></up-button>
|
|
||||||
</view>
|
</view>
|
||||||
<up-picker :show="datas.show" :columns="datas.typeList" keyName="name" @cancel="datas.show=false" @confirm="confirmConsGroup" ></up-picker>
|
<up-picker :show="datas.show" :columns="datas.typeList" keyName="name" @cancel="datas.show = false" @confirm="confirmConsGroup"></up-picker>
|
||||||
<!-- 消息提示 -->
|
<!-- 消息提示 -->
|
||||||
<up-toast ref="uToastRef"></up-toast>
|
<up-toast ref="uToastRef"></up-toast>
|
||||||
|
<u-picker :show="unitShow" :columns="unitList"></u-picker>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive } from 'vue';
|
import { ref, reactive } from 'vue';
|
||||||
import { onLoad } from '@dcloudio/uni-app';
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
|
|
||||||
import { getConsGrpupList, addCons, editCons } from '@/http/api/cons.js';
|
|
||||||
|
|
||||||
let datas = reactive({
|
|
||||||
show: false,
|
|
||||||
form: {
|
|
||||||
conUnit: '',
|
|
||||||
conName: '',
|
|
||||||
price: '',
|
|
||||||
conWarning: 999,
|
|
||||||
consGroupId: null,
|
|
||||||
},
|
|
||||||
consGroupName: '',
|
|
||||||
typeList: [],
|
|
||||||
})
|
|
||||||
|
|
||||||
onLoad((options) => {
|
|
||||||
if( options && options.item ) {
|
|
||||||
let obj = JSON.parse(options.item)
|
|
||||||
datas.form = obj
|
|
||||||
} else {
|
|
||||||
gettbConsTypeList()
|
|
||||||
}
|
|
||||||
uni.setNavigationBarTitle({
|
|
||||||
title: !datas.form.id ? '添加耗材' : '编辑耗材'
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取耗材类别
|
|
||||||
*/
|
|
||||||
let gettbConsTypeList = () => {
|
|
||||||
getConsGrpupList({
|
|
||||||
page: 1,
|
|
||||||
size: 30,
|
|
||||||
}).then(res => {
|
|
||||||
datas.typeList = [res]
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function confirmConsGroup(e){
|
import { getConsGrpupList, addCons, editCons } from '@/http/api/cons.js';
|
||||||
datas.show = false
|
|
||||||
datas.form.consGroupId = e.value[0].id
|
|
||||||
datas.consGroupName = e.value[0].name
|
|
||||||
}
|
|
||||||
|
|
||||||
let sumbit = async () => {
|
let datas = reactive({
|
||||||
let conUnitdata = datas.form.conUnit.replace(/(^\s*)|(\s*$)/g, "")
|
show: false,
|
||||||
if (!conUnitdata) {
|
form: {
|
||||||
uni.$utils.showToast('单位不能为空')
|
conUnit: '',
|
||||||
return
|
conName: '',
|
||||||
}
|
price: '',
|
||||||
if (!datas.form.price) {
|
conWarning: 999,
|
||||||
uni.$utils.showToast('价格不能为空')
|
consGroupId: null,
|
||||||
return
|
conUnitTwo: '', // 第二单位
|
||||||
}
|
conUnitTwoConvert: '', // 第二单位转换数量
|
||||||
if (!datas.form.consGroupId) {
|
defaultUnit: 2
|
||||||
uni.$utils.showToast('耗材类型不能为空')
|
},
|
||||||
return
|
consGroupName: '',
|
||||||
}
|
typeList: []
|
||||||
if ( !datas.form.id) {
|
});
|
||||||
await addCons({...datas.form})
|
|
||||||
} else {
|
|
||||||
await editCons({...datas.form})
|
|
||||||
}
|
|
||||||
uni.navigateBack()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
onLoad((options) => {
|
||||||
|
if (options && options.item) {
|
||||||
|
let obj = JSON.parse(decodeURIComponent(options.item));
|
||||||
|
datas.form = obj;
|
||||||
|
|
||||||
|
unitList.value = [];
|
||||||
|
if (datas.form.conUnit !== '') {
|
||||||
|
unitList.value.push(datas.form.conUnit);
|
||||||
|
}
|
||||||
|
if (datas.form.conUnitTwo !== '') {
|
||||||
|
unitList.value.push(datas.form.conUnitTwo);
|
||||||
|
}
|
||||||
|
console.log('datas.form', datas.form);
|
||||||
|
console.log('unitList.value', unitList.value);
|
||||||
|
} else {
|
||||||
|
gettbConsTypeList();
|
||||||
|
}
|
||||||
|
uni.setNavigationBarTitle({
|
||||||
|
title: !datas.form.id ? '添加耗材' : '编辑耗材'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取耗材类别
|
||||||
|
*/
|
||||||
|
let gettbConsTypeList = () => {
|
||||||
|
getConsGrpupList({
|
||||||
|
page: 1,
|
||||||
|
size: 30
|
||||||
|
}).then((res) => {
|
||||||
|
datas.typeList = [res];
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
function confirmConsGroup(e) {
|
||||||
|
datas.show = false;
|
||||||
|
datas.form.consGroupId = e.value[0].id;
|
||||||
|
datas.consGroupName = e.value[0].name;
|
||||||
|
}
|
||||||
|
|
||||||
|
let sumbit = async () => {
|
||||||
|
let conUnitdata = datas.form.conUnit.replace(/(^\s*)|(\s*$)/g, '');
|
||||||
|
if (!conUnitdata) {
|
||||||
|
uni.$utils.showToast('单位不能为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!datas.form.price) {
|
||||||
|
uni.$utils.showToast('价格不能为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!datas.form.consGroupId) {
|
||||||
|
uni.$utils.showToast('耗材类型不能为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!datas.form.id) {
|
||||||
|
await addCons({ ...datas.form });
|
||||||
|
} else {
|
||||||
|
await editCons({ ...datas.form });
|
||||||
|
}
|
||||||
|
uni.navigateBack();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 显示选择单位
|
||||||
|
const unitShow = ref(false);
|
||||||
|
// 单位列表
|
||||||
|
const unitList = ref([]);
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
page {
|
page {
|
||||||
background-color: #f9f9f9;
|
background-color: #f9f9f9;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
.topTitle {
|
.topTitle {
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
margin: 32rpx 28rpx;
|
margin: 32rpx 28rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.addConsumables {
|
.addConsumables {
|
||||||
width: 694rpx;
|
width: 694rpx;
|
||||||
height: 640rpx;
|
background: #ffffff;
|
||||||
background: #FFFFFF;
|
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
margin: 32rpx;
|
||||||
margin: 32rpx;
|
padding: 24rpx;
|
||||||
padding: 1rpx 24rpx;
|
box-sizing: border-box;
|
||||||
box-sizing: border-box;
|
|
||||||
|
|
||||||
>view {
|
> view {
|
||||||
>view {
|
> view {
|
||||||
width: 646rpx;
|
width: 646rpx;
|
||||||
|
height: 84rpx;
|
||||||
|
background: #fcfcfc;
|
||||||
|
border: 2rpx solid #f9f9f9;
|
||||||
|
margin-top: 32rpx;
|
||||||
|
.df;
|
||||||
|
|
||||||
|
> view:first-child {
|
||||||
|
width: 190rpx;
|
||||||
height: 84rpx;
|
height: 84rpx;
|
||||||
background: #fcfcfc;
|
line-height: 84rpx;
|
||||||
border: 2rpx solid #F9F9F9;
|
// text-align: left;
|
||||||
margin-top: 32rpx;
|
padding-left: 24rpx;
|
||||||
.df;
|
background: #f9f9f9;
|
||||||
|
border-radius: 8rpx 0rpx 0rpx 8rpx;
|
||||||
>view:first-child {
|
border: 2rpx solid #f9f9f9;
|
||||||
width: 190rpx;
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
height: 84rpx;
|
font-weight: 400;
|
||||||
line-height: 84rpx;
|
font-size: 32rpx;
|
||||||
// text-align: left;
|
color: #333333;
|
||||||
padding-left: 24rpx;
|
|
||||||
background: #F9F9F9;
|
|
||||||
border-radius: 8rpx 0rpx 0rpx 8rpx;
|
|
||||||
border: 2rpx solid #F9F9F9;
|
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 32rpx;
|
|
||||||
color: #333333;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.bottombutton {
|
.bottombutton {
|
||||||
margin-top: 84rpx;
|
margin-top: 84rpx;
|
||||||
padding: 0 24rpx;
|
padding: 0 24rpx;
|
||||||
|
|
||||||
>button {
|
> button {
|
||||||
width: 530rpx;
|
width: 530rpx;
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
border-radius: 56rpx 56rpx 56rpx 56rpx;
|
border-radius: 56rpx 56rpx 56rpx 56rpx;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.status {
|
.status {
|
||||||
margin: 0 32rpx;
|
margin: 0 32rpx;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
// top: 100%;
|
// top: 100%;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.df() {
|
.df() {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.tips-wrap {
|
||||||
|
--pColor: #e6a23c;
|
||||||
|
--iColor: #fdf6ec;
|
||||||
|
padding: 0 28upx;
|
||||||
|
.content {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
padding: 28upx;
|
||||||
|
background-color: var(--iColor);
|
||||||
|
|
||||||
|
.info {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding-left: 10px;
|
||||||
|
gap: 8upx;
|
||||||
|
.t1 {
|
||||||
|
font-size: 32upx;
|
||||||
|
color: var(--pColor);
|
||||||
|
}
|
||||||
|
.t2 {
|
||||||
|
font-size: 24upx;
|
||||||
|
color: var(--pColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
}
|
||||||
|
.form-wrap {
|
||||||
|
padding: 28upx 28upx 0;
|
||||||
|
.form {
|
||||||
|
padding: 28upx;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 16upx;
|
||||||
|
}
|
||||||
|
.row {
|
||||||
|
height: 84upx;
|
||||||
|
display: flex;
|
||||||
|
gap: 20upx;
|
||||||
|
align-items: center;
|
||||||
|
background-color: #fcfcfc;
|
||||||
|
padding: 0 20upx;
|
||||||
|
&:not(:last-child) {
|
||||||
|
margin-bottom: 28upx;
|
||||||
|
}
|
||||||
|
.label {
|
||||||
|
font-size: 32upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.ipt {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
773
pageConsumables/batch_in.vue
Normal file
773
pageConsumables/batch_in.vue
Normal file
@@ -0,0 +1,773 @@
|
|||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<u-form ref="formRef" :model="form" :rules="rules" label-position="top">
|
||||||
|
<view class="card">
|
||||||
|
<u-form-item>
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">第一步:上传图片</text>
|
||||||
|
<view class="btn">
|
||||||
|
<u-button type="primary" :disabled="!img" shape="circle" text="开始解析" @click="startCheckOcrRes"></u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<my-upload-img v-model="img"></my-upload-img>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
</view>
|
||||||
|
<view class="card" v-if="form.bodyList">
|
||||||
|
<u-form-item>
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">第二步:编辑信息</text>
|
||||||
|
</view>
|
||||||
|
<view class="top" style="margin-top: 10px">
|
||||||
|
<text class="t">供应商信息</text>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<view style="flex: 1">
|
||||||
|
<selectVendor v-model="form.vendorId" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item>
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">耗材信息</text>
|
||||||
|
<view class="btn">
|
||||||
|
<u-button type="primary" shape="circle" text="选择耗材" @click="openSelectCons" v-if="!stockInStatus"></u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<view class="list-wrap">
|
||||||
|
<view class="top-tips">
|
||||||
|
<text class="tb">共{{ form.bodyList.length }}种耗材,</text>
|
||||||
|
<text class="tb">
|
||||||
|
金额合计:¥{{
|
||||||
|
multiplyAndFormat(
|
||||||
|
form.bodyList.reduce((sum, item) => sum + (item.purchasePrice || 0) * (item.inOutNumber || 0), 0),
|
||||||
|
1
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
<view class="item" v-for="(item, index) in form.bodyList" :key="index">
|
||||||
|
<view class="name">
|
||||||
|
<text class="t">{{ item.conName }}</text>
|
||||||
|
<view class="error-text" v-if="stockInStatus">
|
||||||
|
<u-text type="success" v-if="item.conId" text="入库成功" size="12"></u-text>
|
||||||
|
<u-text v-else type="error" :text="`入库失败:${item.failReason}`" size="12"></u-text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="content">
|
||||||
|
<view class="ctt-item">
|
||||||
|
<text class="t1">单价</text>
|
||||||
|
<text class="t2">{{ item.purchasePrice }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="ctt-item">
|
||||||
|
<text class="t1">单位</text>
|
||||||
|
<text class="t2">{{ item.unitName }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="ctt-item">
|
||||||
|
<text class="t1">数量</text>
|
||||||
|
<text class="t2">{{ item.inOutNumber }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="ctt-item">
|
||||||
|
<text class="t1">小计</text>
|
||||||
|
<text class="t2">{{ multiplyAndFormat(item.purchasePrice || 0, item.inOutNumber || 0) }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="footer-btn-wrap">
|
||||||
|
<view>
|
||||||
|
<u-text type="primary" text="编辑" @click="editorFormHandle(item, index)"></u-text>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
<u-text type="error" text="删除" @click="form.bodyList.splice(index, 1)"></u-text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item>
|
||||||
|
<view class="result_wrap" v-if="stockInStatus">
|
||||||
|
上传完成 共{{ form.bodyList.length }}条数据,其中成功
|
||||||
|
<u-text type="success" :text="form.bodyList.filter((item) => item.conId).length"></u-text>
|
||||||
|
条,失败
|
||||||
|
<u-text type="error" :text="form.bodyList.filter((item) => !item.conId).length"></u-text>
|
||||||
|
条
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
</view>
|
||||||
|
</u-form>
|
||||||
|
<u-popup :show="showEditorPopup" round="20" closeable @close="showEditorPopup = false">
|
||||||
|
<view class="editor-popup" v-if="form.bodyList && form.bodyList.length">
|
||||||
|
<view class="title">
|
||||||
|
<text class="t">{{ form.bodyList[editorIndex].conName }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="form">
|
||||||
|
<u-form ref="editorFormRef" :model="editorForm" :rules="editorFormRules" label-width="60px">
|
||||||
|
<u-form-item label="名称" prop="conName" required>
|
||||||
|
<u-input v-model="editorForm.conName" :maxlength="50" placeholder="请输入耗材名称"></u-input>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="单价" prop="purchasePrice" required>
|
||||||
|
<u-input
|
||||||
|
v-model="editorForm.purchasePrice"
|
||||||
|
placeholder="请输入耗材单价"
|
||||||
|
:maxlength="8"
|
||||||
|
@change="
|
||||||
|
(e) =>
|
||||||
|
mySetTimeout(() => {
|
||||||
|
editorForm.purchasePrice = filterNumberInput(e);
|
||||||
|
}, 50)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<template #suffix>
|
||||||
|
<text>元</text>
|
||||||
|
</template>
|
||||||
|
</u-input>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="单位" prop="unitName" required>
|
||||||
|
<u-input v-model="editorForm.unitName" :maxlength="20" placeholder="请选择耗材单位"></u-input>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="数量" prop="inOutNumber" required>
|
||||||
|
<u-input
|
||||||
|
v-model="editorForm.inOutNumber"
|
||||||
|
placeholder="请输入耗材数量"
|
||||||
|
:maxlength="8"
|
||||||
|
@change="
|
||||||
|
(e) =>
|
||||||
|
mySetTimeout(() => {
|
||||||
|
editorForm.inOutNumber = filterNumberInput(e, 1);
|
||||||
|
}, 50)
|
||||||
|
"
|
||||||
|
></u-input>
|
||||||
|
</u-form-item>
|
||||||
|
</u-form>
|
||||||
|
</view>
|
||||||
|
<view class="footer">
|
||||||
|
<view class="btn">
|
||||||
|
<u-button style="width: 100%" shape="circle" @click="showEditorPopup = false">取消</u-button>
|
||||||
|
</view>
|
||||||
|
<view class="btn">
|
||||||
|
<u-button type="primary" style="width: 100%" shape="circle" @click="editorFormSubmitHandle">确认</u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
<my-footer-btn type="horizontal" showCancel @confirm="submitHandle" @cancel="backHandle"></my-footer-btn>
|
||||||
|
<!-- 选择耗材 -->
|
||||||
|
<selectCons ref="selectConsRef" @success="selectConsSuccess" />
|
||||||
|
<view class="loading-page" v-if="checkLoading">
|
||||||
|
<view class="loader"></view>
|
||||||
|
<text class="t">{{ loadingText }}</text>
|
||||||
|
<view class="btn">
|
||||||
|
<u-button type="primary" @click="closeCheckOcrHandle">取消查询</u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import _ from 'lodash';
|
||||||
|
import { ref, computed } from 'vue';
|
||||||
|
import { multiplyAndFormat, filterNumberInput } from '@/utils/index.js';
|
||||||
|
import { stockOcr, ocrResult } from '@/http/api/product.js';
|
||||||
|
import { consStockIn } from '@/http/api/cons.js';
|
||||||
|
import selectVendor from './components/select-vendor.vue';
|
||||||
|
import selectCons from './components/select-cons.vue';
|
||||||
|
|
||||||
|
const selectConsRef = ref(null);
|
||||||
|
function selectConsSuccess(e) {
|
||||||
|
console.log('selectVendorHandle===', e);
|
||||||
|
let arr = e.map((item) => ({
|
||||||
|
id: item.id,
|
||||||
|
conId: item.id,
|
||||||
|
conName: item.conName,
|
||||||
|
purchasePrice: item.price,
|
||||||
|
unitName: item.conUnit,
|
||||||
|
inOutNumber: 1
|
||||||
|
}));
|
||||||
|
form.value.bodyList.push(...arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
function openSelectCons() {
|
||||||
|
const comp = selectConsRef.value;
|
||||||
|
if (comp && typeof comp.show === 'function') {
|
||||||
|
comp.show();
|
||||||
|
} else {
|
||||||
|
console.warn('selectConsRef not ready or show() not available', comp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 封装全局定时器,适配多端
|
||||||
|
const mySetTimeout = (fn, delay) => {
|
||||||
|
if (typeof uni !== 'undefined') {
|
||||||
|
return setTimeout(fn, delay); // 小程序
|
||||||
|
} else {
|
||||||
|
return window.setTimeout(fn, delay); // H5
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 编辑耗材 start
|
||||||
|
const showEditorPopup = ref(false);
|
||||||
|
const editorFormRef = ref(null);
|
||||||
|
const editorIndex = ref(0);
|
||||||
|
const editorForm = ref({
|
||||||
|
conName: '',
|
||||||
|
purchasePrice: '',
|
||||||
|
unitName: '',
|
||||||
|
inOutNumber: ''
|
||||||
|
});
|
||||||
|
const editorFormRules = ref({
|
||||||
|
conName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (editorForm.value.conName === '') {
|
||||||
|
return callback(new Error('请输入耗材名称'));
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
purchasePrice: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (editorForm.value.purchasePrice === '') {
|
||||||
|
return callback(new Error('请输入耗材单价'));
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
unitName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (editorForm.value.unitName === '') {
|
||||||
|
return callback(new Error('请选择耗材单位'));
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
inOutNumber: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (editorForm.value.inOutNumber === '') {
|
||||||
|
return callback(new Error('请输入耗材数量'));
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
// 显示编辑
|
||||||
|
function editorFormHandle(item, index) {
|
||||||
|
editorForm.value = _.cloneDeep(item);
|
||||||
|
editorIndex.value = index;
|
||||||
|
showEditorPopup.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function editorFormSubmitHandle() {
|
||||||
|
editorFormRef.value
|
||||||
|
.validate()
|
||||||
|
.then(() => {
|
||||||
|
form.value.bodyList[editorIndex.value] = _.cloneDeep(editorForm.value);
|
||||||
|
showEditorPopup.value = false;
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
}
|
||||||
|
// 编辑耗材 end
|
||||||
|
|
||||||
|
const resId = ref(null);
|
||||||
|
const img = ref('');
|
||||||
|
const stockInStatus = ref(false);
|
||||||
|
const form = ref({});
|
||||||
|
// const form = ref({
|
||||||
|
// actualPaymentAmount: null,
|
||||||
|
// amountPayable: 1680,
|
||||||
|
// batchNo: 'XS25110410003',
|
||||||
|
// bodyList: [
|
||||||
|
// { conId: '', conName: '哈根达斯-小杯(草莓)', failReason: '', inOutNumber: 24, purchasePrice: 35, subTotal: 840, unitName: '杯' },
|
||||||
|
// { conId: '', conName: '哈根达斯-小杯(香草)', failReason: '', inOutNumber: 24, purchasePrice: 35, subTotal: 840, unitName: '杯' },
|
||||||
|
// { conId: '', conName: '哈根达斯-小杯(比利时巧克力)', failReason: '', inOutNumber: 12, purchasePrice: 0, subTotal: 0, unitName: '杯' },
|
||||||
|
// { conId: '', conName: '哈根达斯-小杯(夏威夷果仁)', failReason: '', inOutNumber: 12, purchasePrice: 0, subTotal: 0, unitName: '杯' }
|
||||||
|
// ],
|
||||||
|
// inOutDate: '2025-11-04',
|
||||||
|
// ocrSaleOrder: {
|
||||||
|
// customerName: '大客河景餐厅',
|
||||||
|
// date: '2025-11-04',
|
||||||
|
// documentType: '销售单',
|
||||||
|
// items: [
|
||||||
|
// { conName: '哈根达斯-小杯(草莓)', inOutNumber: '24', purchasePrice: '35', spec: '81g', subTotal: '840', unitName: '杯' },
|
||||||
|
// { conName: '哈根达斯-小杯(香草)', inOutNumber: '24', purchasePrice: '35', spec: '81g', subTotal: '840', unitName: '杯' },
|
||||||
|
// { conName: '哈根达斯-小杯(比利时巧克力)', inOutNumber: '12', purchasePrice: '0', spec: '81g', subTotal: '0', unitName: '杯' },
|
||||||
|
// { conName: '哈根达斯-小杯(夏威夷果仁)', inOutNumber: '12', purchasePrice: '0', spec: '81g', subTotal: '0', unitName: '杯' }
|
||||||
|
// ],
|
||||||
|
// operator: '陈钦楠',
|
||||||
|
// orderNumber: 'XS25110410003',
|
||||||
|
// remark: '',
|
||||||
|
// totalAmount: '1680'
|
||||||
|
// },
|
||||||
|
// paymentDate: null,
|
||||||
|
// remark: '',
|
||||||
|
// unInCons: [],
|
||||||
|
// vendorId: null
|
||||||
|
// });
|
||||||
|
|
||||||
|
const rules = ref({});
|
||||||
|
|
||||||
|
// 查询OCR结果
|
||||||
|
async function startCheckOcrRes() {
|
||||||
|
try {
|
||||||
|
resId.value = await stockOcr({ url: img.value });
|
||||||
|
stockInStatus.value = false;
|
||||||
|
startQueryInterval()
|
||||||
|
.then((res) => {
|
||||||
|
// console.log('查询成功', JSON.stringify(res));
|
||||||
|
form.value = res;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('查询失败', error);
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开始查询ocr结果
|
||||||
|
// 启动查询方法,每5秒查询一次,五分钟后超时停止查询
|
||||||
|
const checkLoading = ref(false);
|
||||||
|
const speed = 10000; // 查询间隔时间,单位毫秒
|
||||||
|
const timeout = 300000; // 超时时间,单位毫秒
|
||||||
|
// const timeout = 15000; // 超时时间,单位毫秒
|
||||||
|
const interval = ref(null);
|
||||||
|
const checkNumber = ref(0);
|
||||||
|
const loadingText = computed(() => `每${speed / 1000}秒查询1次,已查询:${checkNumber.value}次`);
|
||||||
|
function startQueryInterval() {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (!resId.value) {
|
||||||
|
reject(new Error('无效的 resId,无法查询'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置计数并显示 loading
|
||||||
|
checkNumber.value = 0;
|
||||||
|
checkLoading.value = true;
|
||||||
|
|
||||||
|
const startTime = Date.now();
|
||||||
|
interval.value = null;
|
||||||
|
|
||||||
|
async function checkOnce() {
|
||||||
|
try {
|
||||||
|
checkNumber.value++;
|
||||||
|
console.log('ocr checkNumber:', checkNumber.value);
|
||||||
|
checkLoading.value = true;
|
||||||
|
const res = await ocrResult({ id: resId.value });
|
||||||
|
if (res && res.batchNo) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '查询成功',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
checkLoading.value = false;
|
||||||
|
}, 1000);
|
||||||
|
clearInterval(interval.value);
|
||||||
|
resolve(res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果还未超时,则继续等待下一轮查询
|
||||||
|
if (Date.now() - startTime >= timeout) {
|
||||||
|
setTimeout(() => {
|
||||||
|
checkLoading.value = false;
|
||||||
|
}, 1000);
|
||||||
|
uni.showToast({
|
||||||
|
title: '查询超时',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
clearInterval(interval.value);
|
||||||
|
reject(new Error('查询超时'));
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '查询失败',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
checkLoading.value = false;
|
||||||
|
}, 1000);
|
||||||
|
clearInterval(interval.value);
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 立即执行一次查询,然后按间隔继续查询
|
||||||
|
checkOnce();
|
||||||
|
interval.value = setInterval(checkOnce, speed);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消查询
|
||||||
|
function closeCheckOcrHandle() {
|
||||||
|
checkLoading.value = false;
|
||||||
|
clearInterval(interval.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交批量入库
|
||||||
|
async function submitHandle() {
|
||||||
|
try {
|
||||||
|
console.log('submitHandle', form.value);
|
||||||
|
uni.showLoading({
|
||||||
|
title: '提交中...',
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
const res = await consStockIn(form.value);
|
||||||
|
form.value = res;
|
||||||
|
stockInStatus.value = true;
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '提交成功',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}, 100);
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回
|
||||||
|
function backHandle() {
|
||||||
|
uni.navigateBack();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
page {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.container {
|
||||||
|
padding: 28upx;
|
||||||
|
}
|
||||||
|
.card {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 20px;
|
||||||
|
padding: 28upx;
|
||||||
|
&:not(:last-child) {
|
||||||
|
margin-bottom: 28upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.switch-wrap {
|
||||||
|
flex: 1;
|
||||||
|
width: 100%;
|
||||||
|
.top {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
&.column {
|
||||||
|
align-items: flex-start;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.two {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding-right: 28upx;
|
||||||
|
}
|
||||||
|
.t {
|
||||||
|
font-size: 32upx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.tips {
|
||||||
|
font-size: 24upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.info {
|
||||||
|
padding-top: 16upx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16upx;
|
||||||
|
.i {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.ipt {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.t {
|
||||||
|
font-size: 24upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.list-wrap {
|
||||||
|
flex: 1;
|
||||||
|
.top-tips {
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.item {
|
||||||
|
margin-top: 28upx;
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
border-radius: 12upx;
|
||||||
|
padding: 20upx;
|
||||||
|
.name {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.error-text {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.content {
|
||||||
|
display: flex;
|
||||||
|
padding: 28upx 0;
|
||||||
|
|
||||||
|
.ctt-item {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
&:last-child {
|
||||||
|
align-items: flex-end;
|
||||||
|
}
|
||||||
|
.t1 {
|
||||||
|
color: #666;
|
||||||
|
font-size: 28upx;
|
||||||
|
}
|
||||||
|
.t2 {
|
||||||
|
color: #333;
|
||||||
|
font-size: 28upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.footer-btn-wrap {
|
||||||
|
display: flex;
|
||||||
|
gap: 28upx;
|
||||||
|
justify-content: flex-end;
|
||||||
|
.btn {
|
||||||
|
width: 160upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.package-wrap {
|
||||||
|
flex: 1;
|
||||||
|
.list {
|
||||||
|
.item {
|
||||||
|
border: 1px solid #ececec;
|
||||||
|
border-radius: 12upx;
|
||||||
|
padding: 20upx;
|
||||||
|
&:not(:first-child) {
|
||||||
|
margin-top: 28upx;
|
||||||
|
}
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding-bottom: 20upx;
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.del {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.input-wrap {
|
||||||
|
display: flex;
|
||||||
|
gap: 20upx;
|
||||||
|
padding-bottom: 20upx;
|
||||||
|
.btn {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12upx;
|
||||||
|
.t {
|
||||||
|
color: #318afe;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.table-wrap {
|
||||||
|
padding-bottom: 20upx;
|
||||||
|
margin-bottom: 20upx;
|
||||||
|
.tab-head {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
.tr {
|
||||||
|
display: flex;
|
||||||
|
gap: 12upx;
|
||||||
|
padding: 20upx;
|
||||||
|
border-bottom: 1px solid #ececec;
|
||||||
|
.td {
|
||||||
|
flex: 1;
|
||||||
|
&:nth-child(1) {
|
||||||
|
flex: 2;
|
||||||
|
}
|
||||||
|
&:last-child {
|
||||||
|
flex: 0.5;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.del {
|
||||||
|
color: red;
|
||||||
|
font-size: 28upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.select_num_wrap {
|
||||||
|
padding-bottom: 28upx;
|
||||||
|
.label {
|
||||||
|
padding-bottom: 20upx;
|
||||||
|
.t {
|
||||||
|
color: #333;
|
||||||
|
font-size: 32upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.package-wrap-btn {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
padding-top: 28upx;
|
||||||
|
.btn {
|
||||||
|
display: flex;
|
||||||
|
gap: 8upx;
|
||||||
|
align-items: center;
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #318afe;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.step-wrap {
|
||||||
|
flex: 1;
|
||||||
|
.table-wrap {
|
||||||
|
padding-bottom: 20upx;
|
||||||
|
margin-bottom: 20upx;
|
||||||
|
.tab-head {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
.tr {
|
||||||
|
display: flex;
|
||||||
|
gap: 12upx;
|
||||||
|
padding: 20upx;
|
||||||
|
border-bottom: 1px solid #ececec;
|
||||||
|
.td {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
gap: 20upx;
|
||||||
|
align-items: center;
|
||||||
|
&:last-child {
|
||||||
|
flex: 0.6;
|
||||||
|
}
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.edit {
|
||||||
|
color: #318afe;
|
||||||
|
font-size: 28upx;
|
||||||
|
}
|
||||||
|
.del {
|
||||||
|
color: red;
|
||||||
|
font-size: 28upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.editor-popup {
|
||||||
|
padding: 0 28upx;
|
||||||
|
.title {
|
||||||
|
padding: 28upx 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
.t {
|
||||||
|
font-size: 32upx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.form {
|
||||||
|
padding: 28upx;
|
||||||
|
}
|
||||||
|
.footer {
|
||||||
|
display: flex;
|
||||||
|
gap: 28upx;
|
||||||
|
.btn {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.result_wrap {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
.loading-page {
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
gap: 20upx;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background-color: #fff;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 999;
|
||||||
|
padding-bottom: 10vh;
|
||||||
|
.loader {
|
||||||
|
width: 50px;
|
||||||
|
aspect-ratio: 1;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: radial-gradient(farthest-side, #ffa516 94%, #0000) top/8px 8px no-repeat, conic-gradient(#0000 30%, #ffa516);
|
||||||
|
-webkit-mask: radial-gradient(farthest-side, #0000 calc(100% - 8px), #000 0);
|
||||||
|
animation: l13 1s infinite linear;
|
||||||
|
}
|
||||||
|
@keyframes l13 {
|
||||||
|
100% {
|
||||||
|
transform: rotate(1turn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.btn {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 10%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
52
pageConsumables/components/select-cons.vue
Normal file
52
pageConsumables/components/select-cons.vue
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
<template>
|
||||||
|
<u-picker
|
||||||
|
title="选择耗材"
|
||||||
|
:show="visable"
|
||||||
|
:columns="columns"
|
||||||
|
keyName="conName"
|
||||||
|
@close="visable = false"
|
||||||
|
closeOnClickOverlay
|
||||||
|
@cancel="visable = false"
|
||||||
|
@confirm="confirmHandle"
|
||||||
|
></u-picker>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, onMounted } from 'vue';
|
||||||
|
import { getConsList } from '@/http/api/cons.js';
|
||||||
|
|
||||||
|
const visable = ref(false);
|
||||||
|
|
||||||
|
const columns = ref([]);
|
||||||
|
|
||||||
|
const emits = defineEmits(['success']);
|
||||||
|
|
||||||
|
function confirmHandle(e) {
|
||||||
|
emits('success', e.value);
|
||||||
|
visable.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取耗材列表
|
||||||
|
async function getConsListAjax() {
|
||||||
|
try {
|
||||||
|
const res = await getConsList();
|
||||||
|
columns.value = [res];
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function show() {
|
||||||
|
visable.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
show
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getConsListAjax();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss"></style>
|
||||||
56
pageConsumables/components/select-vendor.vue
Normal file
56
pageConsumables/components/select-vendor.vue
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<!-- 选择供应商 -->
|
||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<view @click="show = true">
|
||||||
|
<u-input v-model="vendorName" readonly suffixIcon="arrow-down" placeholder="请选择供应商"></u-input>
|
||||||
|
</view>
|
||||||
|
<u-picker
|
||||||
|
title="选择供应商"
|
||||||
|
:show="show"
|
||||||
|
:columns="columns"
|
||||||
|
keyName="name"
|
||||||
|
@close="show = false"
|
||||||
|
closeOnClickOverlay
|
||||||
|
@cancel="show = false"
|
||||||
|
@confirm="confirmHandle"
|
||||||
|
></u-picker>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, onMounted } from 'vue';
|
||||||
|
import { getVendorList } from '@/http/api/vendor.js';
|
||||||
|
|
||||||
|
const vendorName = ref('');
|
||||||
|
|
||||||
|
const vendorId = defineModel({
|
||||||
|
type: [String, Number],
|
||||||
|
default: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
const show = ref(false);
|
||||||
|
const columns = ref([]);
|
||||||
|
|
||||||
|
function confirmHandle(e) {
|
||||||
|
let data = e.value[0];
|
||||||
|
vendorId.value = data.id;
|
||||||
|
vendorName.value = data.name;
|
||||||
|
show.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取供应商列表
|
||||||
|
async function getVendorListAjax() {
|
||||||
|
try {
|
||||||
|
const res = await getVendorList();
|
||||||
|
columns.value = [res];
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getVendorListAjax();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss"></style>
|
||||||
@@ -1,453 +1,479 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="ConsumablesTop">
|
<view class="ConsumablesTop">
|
||||||
<view @tap="pageData.show = !pageData.show" style="display: flex;align-items: center;">
|
<view @tap="pageData.show = !pageData.show" style="display: flex; align-items: center">
|
||||||
{{pageData.title}}<up-icon name="arrow-down" size="12"></up-icon>
|
{{ pageData.title }}
|
||||||
|
<up-icon name="arrow-down" size="12"></up-icon>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<input v-model="pageData.query.conName" @input="inputEvent" type="text" placeholder="请输入耗材名称" />
|
<input v-model="pageData.query.conName" @input="inputEvent" type="text" placeholder="请输入耗材名称" />
|
||||||
</view>
|
</view>
|
||||||
<view @tap="toUrl('PAGES_ADD_TYPE') ">
|
<view @tap="toUrl('PAGES_ADD_TYPE')">新增类别</view>
|
||||||
新增类别
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="ConsumablesConent" v-if="pageData.list.length">
|
<view class="ConsumablesConent" v-if="pageData.list.length">
|
||||||
<view v-for="(item,index) in pageData.list" :key="index">
|
<view v-for="(item, index) in pageData.list" :key="index">
|
||||||
<view> {{item.conName}}
|
<view>
|
||||||
<view> {{item.consGroupName}} </view>
|
{{ item.conName }}
|
||||||
|
<view>{{ item.consGroupName }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view>
|
<view>
|
||||||
<view style="color: #333333;"> {{item.conUnit}} </view>
|
<view style="color: #333333">{{ item.conUnit }}</view>
|
||||||
<view> 耗材单位 </view>
|
<view>耗材单位</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view style="color: #318AFE;"> {{item.stockNumber}} </view>
|
<view style="color: #318afe">{{ item.stockNumber }}</view>
|
||||||
<view> 剩余库存 </view>
|
<view>剩余库存</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view style="background-color: #fff;" @tap="show=true;showData = filtersSproductId(item.productList)">
|
<view
|
||||||
|
style="background-color: #fff"
|
||||||
|
@tap="
|
||||||
|
show = true;
|
||||||
|
showData = filtersSproductId(item.productList);
|
||||||
|
"
|
||||||
|
>
|
||||||
所属商品:
|
所属商品:
|
||||||
{{ filtersSproductId(item.productList).length>7?filtersSproductId(item.productList).substring(0,6)+'...':filtersSproductId(item.productList)}}
|
{{ filtersSproductId(item.productList).length > 7 ? filtersSproductId(item.productList).substring(0, 6) + '...' : filtersSproductId(item.productList) }}
|
||||||
</view>
|
</view>
|
||||||
<view class="">
|
<view class="">
|
||||||
<up-button shape="circle" type="primary" size="mini" color="#999"
|
<up-button
|
||||||
@tap="toUrl('PAGES_VIEWRECORDS',{item:JSON.stringify(item)})" :plain="true"
|
shape="circle"
|
||||||
text="查看记录"></up-button>
|
type="primary"
|
||||||
<up-button type="primary" shape="circle" size="mini" @click="toggle(item)" :plain="true"
|
size="mini"
|
||||||
text="更多操作"></up-button>
|
color="#999"
|
||||||
|
@tap="toUrl('PAGES_VIEWRECORDS', { item: JSON.stringify(item) })"
|
||||||
|
:plain="true"
|
||||||
|
text="查看记录"
|
||||||
|
></up-button>
|
||||||
|
|
||||||
|
<up-button type="primary" shape="circle" size="mini" @click="toggle(item)" :plain="true" text="更多操作"></up-button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view style="background-color: rgba(0,0,0,0); height: 200rpx;"></view>
|
<view style="background-color: rgba(0, 0, 0, 0); height: 200rpx"></view>
|
||||||
</view>
|
</view>
|
||||||
<view v-else style="text-align: center;">
|
<view v-else style="text-align: center">
|
||||||
<image src="./bg.png" style="width: 325rpx;height: 335rpx;" mode=""></image>
|
<image src="./bg.png" style="width: 325rpx; height: 335rpx" mode=""></image>
|
||||||
<view style="font-size: 28rpx;color: #999;">暂无数据</view>
|
<view style="font-size: 28rpx; color: #999">暂无数据</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="ConsumablesBottom">
|
<view class="ConsumablesBottom">
|
||||||
<view @tap="toUrl('PAGES_ADD_CONSUMABLES')"> 新增耗材 </view>
|
<view @tap="toUrl('PAGES_ADD_CONSUMABLES')">新增耗材</view>
|
||||||
<view @tap="toUrl('PAGES_SUPPLIER')"> 供应商管理 </view>
|
<view @tap="toUrl('PAGES_SUPPLIER')">供应商管理</view>
|
||||||
</view>
|
</view>
|
||||||
<my-reportDamage ref="reportDamage" title="耗材报损" :item="report.data" @affirm="affirm"></my-reportDamage>
|
<my-reportDamage ref="reportDamage" title="耗材报损" :item="report.data" @affirm="affirm"></my-reportDamage>
|
||||||
|
<up-popup :show="show" :round="18" mode="center">
|
||||||
<up-popup :show="show" :round="18" mode="center" >
|
|
||||||
<view class="zhezhaopop">
|
<view class="zhezhaopop">
|
||||||
<view class="">
|
<view class="">
|
||||||
<span></span>
|
<span></span>
|
||||||
<span></span>
|
<span></span>
|
||||||
<up-icon @tap="show=false" name="close-circle-fill"></up-icon>
|
<up-icon @tap="show = false" name="close-circle-fill"></up-icon>
|
||||||
</view>
|
</view>
|
||||||
<view class="">
|
<view class="">
|
||||||
{{showData}}
|
{{ showData }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</up-popup>
|
</up-popup>
|
||||||
<up-action-sheet :round="10" @select="actionSelect" @close="actions.show = false" cancelText="取消" :actions="actions.list"
|
<up-action-sheet :round="10" @select="actionSelect" @close="actions.show = false" cancelText="取消" :actions="actions.list" :show="actions.show"></up-action-sheet>
|
||||||
:show="actions.show"></up-action-sheet>
|
<up-picker :show="pageData.show" :columns="pageData.typeList" keyName="name" @cancel="pageData.show = false" @confirm="confirmConsGroup"></up-picker>
|
||||||
<up-picker :show="pageData.show" :columns="pageData.typeList" keyName="name" @cancel="pageData.show=false" @confirm="confirmConsGroup" ></up-picker>
|
<!-- 批量入库悬浮按钮 -->
|
||||||
|
<view class="fixed-in-btn" @click="toBatchPage">
|
||||||
|
<image class="img" src="https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/bd8cde310fc247f6855ad39fbda4d75d.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onShow, onLoad } from '@dcloudio/uni-app'
|
import { onShow, onLoad } from '@dcloudio/uni-app';
|
||||||
import { ref, reactive, computed } from 'vue';
|
import { ref, reactive, computed } from 'vue';
|
||||||
import myReportDamage from './components/my-reportDamage';
|
import myReportDamage from './components/my-reportDamage';
|
||||||
|
|
||||||
import go from '@/commons/utils/go.js';
|
import go from '@/commons/utils/go.js';
|
||||||
import { hasPermission } from '@/commons/utils/hasPermission.js';
|
import { hasPermission } from '@/commons/utils/hasPermission.js';
|
||||||
import { getConsPage,getConsGrpupList } from '@/http/api/cons.js';
|
import { getConsPage, getConsGrpupList } from '@/http/api/cons.js';
|
||||||
|
|
||||||
let reportDamage = ref(null)
|
|
||||||
let show = ref(false)
|
|
||||||
let showData = ref()
|
|
||||||
const report = reactive({
|
|
||||||
data: {
|
|
||||||
name: "美式咖啡",
|
|
||||||
unit: "杯",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
let pageData = reactive({
|
|
||||||
show: false,
|
|
||||||
query: {
|
|
||||||
conName: '',
|
|
||||||
consGroupId: '',
|
|
||||||
size: 100,
|
|
||||||
page: 1
|
|
||||||
},
|
|
||||||
list: [],
|
|
||||||
// 类型列表
|
|
||||||
typeList: [],
|
|
||||||
title: '耗材类型'
|
|
||||||
})
|
|
||||||
|
|
||||||
/**
|
let reportDamage = ref(null);
|
||||||
* 更多操作列表
|
let show = ref(false);
|
||||||
*/
|
let showData = ref();
|
||||||
const actions = reactive({
|
const report = reactive({
|
||||||
list: [
|
data: {
|
||||||
{ name: '报损', color: 'red', fontSize: '16' },
|
name: '美式咖啡',
|
||||||
{ name: '编辑', color: '#333', fontSize: '16' },
|
unit: '杯'
|
||||||
{ name: '清点', color: '#333', fontSize: '16' },
|
}
|
||||||
{ name: '入库', color: '#333', fontSize: '16' },
|
});
|
||||||
{ name: '出库', color: '#333', fontSize: '16' },
|
let pageData = reactive({
|
||||||
],
|
show: false,
|
||||||
data: null,
|
query: {
|
||||||
show: false,
|
conName: '',
|
||||||
})
|
consGroupId: '',
|
||||||
|
size: 100,
|
||||||
|
page: 1
|
||||||
|
},
|
||||||
|
list: [],
|
||||||
|
// 类型列表
|
||||||
|
typeList: [],
|
||||||
|
title: '耗材类型'
|
||||||
|
});
|
||||||
|
|
||||||
onShow(() => {
|
/**
|
||||||
getList()
|
* 更多操作列表
|
||||||
gettbConsTypeList()
|
*/
|
||||||
})
|
const actions = reactive({
|
||||||
|
list: [
|
||||||
|
{ name: '报损', color: 'red', fontSize: '16' },
|
||||||
|
{ name: '编辑', color: '#333', fontSize: '16' },
|
||||||
|
{ name: '清点', color: '#333', fontSize: '16' },
|
||||||
|
{ name: '入库', color: '#333', fontSize: '16' },
|
||||||
|
{ name: '出库', color: '#333', fontSize: '16' }
|
||||||
|
],
|
||||||
|
data: null,
|
||||||
|
show: false
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
onShow(() => {
|
||||||
* 获取耗材列表
|
getList();
|
||||||
*/
|
gettbConsTypeList();
|
||||||
async function getList() {
|
});
|
||||||
getConsPage(pageData.query).then(res => {
|
|
||||||
pageData.list = res.records
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取耗材类别
|
|
||||||
*/
|
|
||||||
let gettbConsTypeList = () => {
|
|
||||||
getConsGrpupList({
|
|
||||||
page: 1,
|
|
||||||
size: 30,
|
|
||||||
}).then(res => {
|
|
||||||
pageData.typeList = [[{name:'全部',id:''},...res]]
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function confirmConsGroup(e){
|
|
||||||
pageData.show = false
|
|
||||||
pageData.query.consGroupId = e.value[0].id
|
|
||||||
pageData.title = e.value[0].name
|
|
||||||
getList()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
// 跳转去批量入库
|
||||||
* 报损确认
|
function toBatchPage() {
|
||||||
*/
|
uni.navigateTo({
|
||||||
function affirm() {
|
url: '/pageConsumables/batch_in'
|
||||||
uni.showToast({
|
});
|
||||||
title:'操作成功',
|
}
|
||||||
icon:'none'
|
|
||||||
})
|
|
||||||
getList()
|
|
||||||
// 获取分类列表
|
|
||||||
gettbConsTypeList()
|
|
||||||
}
|
|
||||||
|
|
||||||
let toggle = (d) => {
|
/**
|
||||||
// refMoreSheet.value.open()
|
* 获取耗材列表
|
||||||
actions.show = true;
|
*/
|
||||||
actions.actions = d
|
async function getList() {
|
||||||
report.data.consId = d.id
|
getConsPage(pageData.query).then((res) => {
|
||||||
}
|
pageData.list = res.records;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let actionSelect = ( e ) => {
|
/**
|
||||||
if ( e.name == '报损' ) {
|
* 获取耗材类别
|
||||||
// 权限
|
*/
|
||||||
hasPermission('允许提交报损').then(ele => {
|
let gettbConsTypeList = () => {
|
||||||
if (ele) {
|
getConsGrpupList({
|
||||||
//打开报损弹窗
|
page: 1,
|
||||||
reportDamage.value.open(actions.actions.id);
|
size: 30
|
||||||
report.data.name = actions.actions.conName
|
}).then((res) => {
|
||||||
report.data.unit = actions.actions.conUnit
|
pageData.typeList = [[{ name: '全部', id: '' }, ...res]];
|
||||||
}
|
});
|
||||||
})
|
};
|
||||||
} else if ( e.name == '编辑' ) {
|
|
||||||
toUrl('PAGES_ADD_CONSUMABLES', {
|
|
||||||
item: JSON.stringify(actions.actions)
|
|
||||||
})
|
|
||||||
} else if ( e.name == '清点' ) {
|
|
||||||
hasPermission('允许耗材盘点').then(ele => {
|
|
||||||
if (ele) {
|
|
||||||
toUrl('PAGES_SALES_INVENTORYCHECK', {
|
|
||||||
item: JSON.stringify(actions.actions)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else if ( e.name == '入库' ) {
|
|
||||||
hasPermission('允许耗材入库').then(ele => {
|
|
||||||
if (ele) {
|
|
||||||
toUrl('PAGES_SALES_WAREHOUSEENTRY', {
|
|
||||||
consId: actions.actions.id,
|
|
||||||
item: JSON.stringify(actions.actions)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else if ( e.name == '出库' ) {
|
|
||||||
hasPermission('允许耗材出库').then(ele => {
|
|
||||||
if (ele) {
|
|
||||||
toUrl('PAGES_SALES_OUTBOUND', {
|
|
||||||
consId: actions.actions.id,
|
|
||||||
item: JSON.stringify(actions.actions)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function inputEvent(d) {
|
|
||||||
pageData.query.conName = d.detail.value.replace(/\s*/g, "");
|
|
||||||
getList()
|
|
||||||
}
|
|
||||||
|
|
||||||
function filtersSproductId(d) {
|
function confirmConsGroup(e) {
|
||||||
if (!d) return ''
|
pageData.show = false;
|
||||||
// const dataArr = d.split(',')
|
pageData.query.consGroupId = e.value[0].id;
|
||||||
let str = ''
|
pageData.title = e.value[0].name;
|
||||||
d.forEach(ele => {
|
getList();
|
||||||
// str += ele.name
|
}
|
||||||
// const startIndex = ele.indexOf('_')
|
|
||||||
// const productId = ele.slice(0, startIndex)
|
/**
|
||||||
// const productName = ele.slice(startIndex + 1, ele.length)
|
* 报损确认
|
||||||
str = ele.name + ',' + str
|
*/
|
||||||
})
|
function affirm() {
|
||||||
return str
|
uni.showToast({
|
||||||
}
|
title: '操作成功',
|
||||||
let toUrl = (url, d) => {
|
icon: 'none'
|
||||||
go.to(url, d)
|
});
|
||||||
|
getList();
|
||||||
|
// 获取分类列表
|
||||||
|
gettbConsTypeList();
|
||||||
|
}
|
||||||
|
|
||||||
|
let toggle = (d) => {
|
||||||
|
// refMoreSheet.value.open()
|
||||||
|
actions.show = true;
|
||||||
|
actions.actions = d;
|
||||||
|
report.data.consId = d.id;
|
||||||
|
};
|
||||||
|
|
||||||
|
let actionSelect = (e) => {
|
||||||
|
if (e.name == '报损') {
|
||||||
|
// 权限
|
||||||
|
hasPermission('允许提交报损').then((ele) => {
|
||||||
|
if (ele) {
|
||||||
|
//打开报损弹窗
|
||||||
|
reportDamage.value.open(actions.actions.id);
|
||||||
|
report.data.name = actions.actions.conName;
|
||||||
|
report.data.unit = actions.actions.conUnit;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (e.name == '编辑') {
|
||||||
|
toUrl('PAGES_ADD_CONSUMABLES', {
|
||||||
|
item: JSON.stringify(actions.actions)
|
||||||
|
});
|
||||||
|
} else if (e.name == '清点') {
|
||||||
|
hasPermission('允许耗材盘点').then((ele) => {
|
||||||
|
if (ele) {
|
||||||
|
toUrl('PAGES_SALES_INVENTORYCHECK', {
|
||||||
|
item: JSON.stringify(actions.actions)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (e.name == '入库') {
|
||||||
|
hasPermission('允许耗材入库').then((ele) => {
|
||||||
|
if (ele) {
|
||||||
|
toUrl('PAGES_SALES_WAREHOUSEENTRY', {
|
||||||
|
consId: actions.actions.id,
|
||||||
|
item: JSON.stringify(actions.actions)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (e.name == '出库') {
|
||||||
|
hasPermission('允许耗材出库').then((ele) => {
|
||||||
|
if (ele) {
|
||||||
|
toUrl('PAGES_SALES_OUTBOUND', {
|
||||||
|
consId: actions.actions.id,
|
||||||
|
item: JSON.stringify(actions.actions)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function inputEvent(d) {
|
||||||
|
pageData.query.conName = d.detail.value.replace(/\s*/g, '');
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
function filtersSproductId(d) {
|
||||||
|
if (!d) return '';
|
||||||
|
// const dataArr = d.split(',')
|
||||||
|
let str = '';
|
||||||
|
d.forEach((ele) => {
|
||||||
|
// str += ele.name
|
||||||
|
// const startIndex = ele.indexOf('_')
|
||||||
|
// const productId = ele.slice(0, startIndex)
|
||||||
|
// const productName = ele.slice(startIndex + 1, ele.length)
|
||||||
|
str = ele.name + ',' + str;
|
||||||
|
});
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
let toUrl = (url, d) => {
|
||||||
|
go.to(url, d);
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
page {
|
page {
|
||||||
background-color: #f9f9f9;
|
background-color: #f9f9f9;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
ul,
|
ul,
|
||||||
li {
|
li {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ConsumablesTop {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
align-items: center;
|
||||||
|
padding-bottom: 22rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
|
||||||
|
> view:first-child,
|
||||||
|
> view:last-child {
|
||||||
|
font-size: 24rpx;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #333333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ConsumablesTop {
|
> view:last-child {
|
||||||
display: flex;
|
color: #318afe;
|
||||||
justify-content: space-around;
|
}
|
||||||
align-items: center;
|
|
||||||
padding-bottom: 22rpx;
|
|
||||||
background-color: #fff;
|
|
||||||
|
|
||||||
>view:first-child,
|
> view:nth-child(2) {
|
||||||
>view:last-child {
|
width: 414rpx;
|
||||||
font-size: 24rpx;
|
height: 60rpx;
|
||||||
|
line-height: 60rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
background: #f9f9f9;
|
||||||
|
border-radius: 32rpx 32rpx 32rpx 32rpx;
|
||||||
|
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ConsumablesConent {
|
||||||
|
min-height: 80vh;
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
padding-top: 1rpx;
|
||||||
|
|
||||||
|
> view {
|
||||||
|
width: 694rpx;
|
||||||
|
height: 332rpx;
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||||||
|
padding: 32rpx 16rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 32rpx auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
> view:first-child {
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
font-size: 24rpx;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
}
|
.df;
|
||||||
|
|
||||||
>view:last-child {
|
> view {
|
||||||
color: #318AFE;
|
// width: 90rpx;
|
||||||
}
|
padding: 2rpx 10rpx;
|
||||||
|
height: 36rpx;
|
||||||
>view:nth-child(2) {
|
line-height: 36rpx;
|
||||||
width: 414rpx;
|
background: #ebf4fc;
|
||||||
height: 60rpx;
|
border-radius: 4rpx 4rpx 4rpx 4rpx;
|
||||||
line-height: 60rpx;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
background: #F9F9F9;
|
|
||||||
border-radius: 32rpx 32rpx 32rpx 32rpx;
|
|
||||||
|
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #999999;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.ConsumablesConent {
|
|
||||||
min-height: 80vh;
|
|
||||||
background-color: #f9f9f9;
|
|
||||||
padding-top: 1rpx;
|
|
||||||
|
|
||||||
>view {
|
|
||||||
width: 694rpx;
|
|
||||||
height: 332rpx;
|
|
||||||
background: #FFFFFF;
|
|
||||||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
|
||||||
padding: 32rpx 16rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
margin: 32rpx auto;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: space-between;
|
|
||||||
|
|
||||||
>view:first-child {
|
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
|
||||||
font-weight: 500;
|
|
||||||
font-size: 24rpx;
|
|
||||||
color: #333333;
|
|
||||||
.df;
|
|
||||||
|
|
||||||
>view {
|
|
||||||
// width: 90rpx;
|
|
||||||
padding: 2rpx 10rpx;
|
|
||||||
height: 36rpx;
|
|
||||||
line-height: 36rpx;
|
|
||||||
background: #EBF4FC;
|
|
||||||
border-radius: 4rpx 4rpx 4rpx 4rpx;
|
|
||||||
text-align: center;
|
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 24rpx;
|
|
||||||
color: #318AFE;
|
|
||||||
margin-left: 12rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
>view:nth-child(2) {
|
|
||||||
width: 662rpx;
|
|
||||||
height: 128rpx;
|
|
||||||
background: #F9F9F9;
|
|
||||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
|
||||||
.df;
|
|
||||||
justify-content: space-around;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #666666;
|
color: #318afe;
|
||||||
|
margin-left: 12rpx;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
>view:last-child {
|
> view:nth-child(2) {
|
||||||
|
width: 662rpx;
|
||||||
|
height: 128rpx;
|
||||||
|
background: #f9f9f9;
|
||||||
|
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||||
|
.df;
|
||||||
|
justify-content: space-around;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #666666;
|
||||||
|
}
|
||||||
|
|
||||||
|
> view:last-child {
|
||||||
|
.df;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
> view:last-child {
|
||||||
.df;
|
.df;
|
||||||
justify-content: space-between;
|
|
||||||
|
|
||||||
>view:last-child {
|
> button {
|
||||||
.df;
|
width: 128rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
background: #ffffff;
|
||||||
|
// border-radius: 28rpx 28rpx 28rpx 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
>button {
|
> button:last-child {
|
||||||
width: 128rpx;
|
margin-left: 24rpx;
|
||||||
height: 48rpx;
|
|
||||||
background: #FFFFFF;
|
|
||||||
// border-radius: 28rpx 28rpx 28rpx 28rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
>button:last-child {
|
|
||||||
margin-left: 24rpx;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.ConsumablesBottom {
|
.ConsumablesBottom {
|
||||||
.df;
|
.df;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 20rpx;
|
bottom: 20rpx;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
transform: translateX(-50%);
|
transform: translateX(-50%);
|
||||||
|
|
||||||
>view {
|
> view {
|
||||||
width: 346rpx;
|
width: 346rpx;
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
line-height: 80rpx;
|
line-height: 80rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border: 2rpx solid #318AFE;
|
border: 2rpx solid #318afe;
|
||||||
|
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
}
|
|
||||||
|
|
||||||
>view:first-child {
|
|
||||||
border-radius: 56rpx 0rpx 0rpx 56rpx;
|
|
||||||
color: #318AFE;
|
|
||||||
background-color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
>view:last-child {
|
|
||||||
border-radius: 0 56rpx 56rpx 0;
|
|
||||||
background-color: #318AFE;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.popup-content {
|
> view:first-child {
|
||||||
padding: 15px;
|
border-radius: 56rpx 0rpx 0rpx 56rpx;
|
||||||
|
color: #318afe;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
margin: 0 auto;
|
}
|
||||||
|
|
||||||
>view {
|
> view:last-child {
|
||||||
|
border-radius: 0 56rpx 56rpx 0;
|
||||||
|
background-color: #318afe;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-content {
|
||||||
|
padding: 15px;
|
||||||
|
background-color: #fff;
|
||||||
|
margin: 0 auto;
|
||||||
|
|
||||||
|
> view {
|
||||||
|
height: 88rpx;
|
||||||
|
line-height: 88rpx;
|
||||||
|
width: 660rpx;
|
||||||
|
border-top: 10rpx solid #f9f9f9;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.operate {
|
||||||
|
> view {
|
||||||
height: 88rpx;
|
height: 88rpx;
|
||||||
line-height: 88rpx;
|
line-height: 88rpx;
|
||||||
width: 660rpx;
|
|
||||||
border-top: 10rpx solid #f9f9f9;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
width: 660rpx;
|
||||||
|
border-bottom: 2rpx solid #e5e5e5;
|
||||||
.operate {
|
|
||||||
>view {
|
|
||||||
height: 88rpx;
|
|
||||||
line-height: 88rpx;
|
|
||||||
text-align: center;
|
|
||||||
width: 660rpx;
|
|
||||||
border-bottom: 2rpx solid #E5E5E5;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.status {
|
.status {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
// top: 100%;
|
// top: 100%;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.zhezhaopop {
|
.zhezhaopop {
|
||||||
padding: 34rpx 32rpx;
|
padding: 34rpx 32rpx;
|
||||||
width: 594rpx;
|
width: 594rpx;
|
||||||
|
|
||||||
>view:first-child {
|
> view:first-child {
|
||||||
|
.df;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
.df;
|
> span:nth-child(2) {
|
||||||
justify-content: space-between;
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: bold;
|
||||||
>span:nth-child(2) {
|
font-size: 32rpx;
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
color: #333333;
|
||||||
font-weight: bold;
|
|
||||||
font-size: 32rpx;
|
|
||||||
color: #333333;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.df() {
|
.df() {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
}
|
||||||
|
.fixed-in-btn {
|
||||||
|
position: fixed;
|
||||||
|
right: 20upx;
|
||||||
|
bottom: 20%;
|
||||||
|
z-index: 999;
|
||||||
|
.img {
|
||||||
|
width: 120upx;
|
||||||
}
|
}
|
||||||
</style>
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -1,366 +1,432 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="boxconstant min-page">
|
<view class="boxconstant min-page">
|
||||||
<view class="bg-fff u-flex u-m-b-32 top">
|
<view class="bg-fff u-flex u-m-b-32 top">
|
||||||
<image
|
<image style="width: 60rpx; height: 60rpx" src="/pageMarket/static/images/cost.png"></image>
|
||||||
style="width: 60rpx; height: 60rpx"
|
<view class="u-flex-1 u-flex u-p-l-24">
|
||||||
src="/pageMarket/static/images/cost.png"
|
<view class="u-font-28 u-flex-1 u-p-r-4">
|
||||||
></image>
|
<view class="color-333 font-bold">私域引流</view>
|
||||||
<view class="u-flex-1 u-flex u-p-l-24">
|
<view class="color-666 u-m-t-4 u-font-24">可设置用户下单后展示的群二维码</view>
|
||||||
<view class="u-font-28 u-flex-1 u-p-r-4">
|
</view>
|
||||||
<view class="color-333 font-bold">私域引流</view>
|
<!-- <up-switch v-model="form.isEnable" size="18" :active-value="1" :inactive-value="0"></up-switch> -->
|
||||||
<view class="color-666 u-m-t-4 u-font-24"
|
</view>
|
||||||
>可设置用户下单后展示的群二维码</view
|
</view>
|
||||||
>
|
<view class="boxconstantbox" style="padding: 32rpx 0">
|
||||||
</view>
|
<view class="u-flex u-row-between x-padding">
|
||||||
<up-switch
|
<view class="boxconstantbox_one">群二维码</view>
|
||||||
v-model="form.isEnable"
|
<button class="upload" @click="uploadImage">上传</button>
|
||||||
size="18"
|
</view>
|
||||||
:active-value="1"
|
<view class="u-m-t-24 u-flex u-row-center">
|
||||||
:inactive-value="0"
|
<view class="code" @click="uploadImage">
|
||||||
></up-switch>
|
<up-icon name="plus" v-if="!form.qrCode" size="20" color="#999"></up-icon>
|
||||||
</view>
|
<image v-else style="width: 260rpx; height: 260rpx" :src="form.qrCode" mode="scaleToFill" />
|
||||||
</view>
|
</view>
|
||||||
<view class="boxconstantbox">
|
</view>
|
||||||
<view class="boxconstantbox_one"> 可使用类型 </view>
|
<view class="u-m-t-32">
|
||||||
<view class="u-m-t-16">
|
<up-line></up-line>
|
||||||
<my-dine-types v-model="form.useType"></my-dine-types>
|
</view>
|
||||||
</view>
|
<view class="u-m-t-32 u-font-28 x-padding">
|
||||||
</view>
|
<view class="boxconstantbox_one u-m-b-24">模块标题</view>
|
||||||
|
<up-input placeholderClass="u-font-28" v-model="form.title" :maxlength="20" placeholder="请输入模块标题"></up-input>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<up-line></up-line>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32 u-font-28 x-padding">
|
||||||
|
<view class="boxconstantbox_one u-m-b-24">模块提示语</view>
|
||||||
|
<up-input placeholderClass="u-font-28" v-model="defaultNote" :maxlength="20" placeholder="请输入模块提示语" disabled></up-input>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<up-line></up-line>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32 u-font-28 x-padding">
|
||||||
|
<view class="boxconstantbox_one u-m-b-24">模块内容</view>
|
||||||
|
<up-textarea type="textarea" :maxlength="50" placeholderClass="u-font-28" v-model="form.content" placeholder="请输入模块内容"></up-textarea>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<up-line></up-line>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32 u-font-28 x-padding">
|
||||||
|
<view class="boxconstantbox_one u-m-b-24">支付完成弹窗</view>
|
||||||
|
<u-switch :active-value="1" :inactive-value="0" v-model="form.orderEnable"></u-switch>
|
||||||
|
</view>
|
||||||
|
<view class="boxconstantbox">
|
||||||
|
<view class="boxconstantbox_one">可使用类型</view>
|
||||||
|
<view class="u-m-t-16">
|
||||||
|
<my-dine-types v-model="form.orderType"></my-dine-types>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32 u-font-28 x-padding">
|
||||||
|
<view class="boxconstantbox_one u-m-b-24">首页弹窗</view>
|
||||||
|
<u-switch :active-value="1" :inactive-value="0" v-model="form.homeEnable"></u-switch>
|
||||||
|
</view>
|
||||||
|
<view class="boxconstantbox">
|
||||||
|
<view class="boxconstantbox_one">可使用类型</view>
|
||||||
|
<view class="u-m-t-16">
|
||||||
|
<u-radio-group v-model="form.homeType">
|
||||||
|
<u-radio name="only" label="仅显示1次"></u-radio>
|
||||||
|
<u-radio name="day" label="每天显示1次"></u-radio>
|
||||||
|
<u-radio name="every" label="每次达成触发条件都显示"></u-radio>
|
||||||
|
</u-radio-group>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="x-padding u-m-t-32">
|
||||||
|
<button class="preview" @click="showPreview = true">预览</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<up-popup :show="showPreview" mode="center" round="16rpx" closeOnClickOverlay @close="showPreview = false" :safeAreaInsetBottom="false">
|
||||||
|
<!-- <view class="preview-box">
|
||||||
|
<view class="u-flex" style="align-items: stretch">
|
||||||
|
<view class="u-flex-1 u-p-r-24 u-flex u-flex-col" style="align-items: start; justify-content: space-between">
|
||||||
|
<view>
|
||||||
|
<view class="u-font-28 font-bold color-333">{{ form.title }}</view>
|
||||||
|
<view class="u-m-t-16 u-font-24 color-666">{{ form.content }}</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class="boxconstantbox" style="padding: 32rpx 0">
|
<view class="color-999 u-font-24 u-m-t-16">{{ form.note }}</view>
|
||||||
<view class="u-flex u-row-between x-padding">
|
</view>
|
||||||
<view class="boxconstantbox_one"> 群二维码</view>
|
<image :src="form.qrCode" style="width: 240rpx; height: 240rpx" mode="scaleToFill"></image>
|
||||||
<button class="upload" @click="uploadImage">上传</button>
|
</view>
|
||||||
</view>
|
</view> -->
|
||||||
<view class="u-m-t-24 u-flex u-row-center">
|
<view class="new_preview">
|
||||||
<view class="code" @click="uploadImage">
|
<view class="header">{{ shopInfo.shopName }}</view>
|
||||||
<up-icon
|
<view class="content">
|
||||||
name="plus"
|
<view class="title">{{ form.title }}</view>
|
||||||
v-if="!form.qrCode"
|
<view class="img_wrap">
|
||||||
size="20"
|
<image class="img" :src="form.qrCode"></image>
|
||||||
color="#999"
|
</view>
|
||||||
></up-icon>
|
<view class="intro">
|
||||||
<image
|
{{ form.content }}
|
||||||
v-else
|
</view>
|
||||||
style="width: 260rpx; height: 260rpx"
|
<view class="foot">
|
||||||
:src="form.qrCode"
|
{{ form.note }}
|
||||||
mode="scaleToFill"
|
</view>
|
||||||
/>
|
</view>
|
||||||
</view>
|
<view class="close" @click="showPreview = false">
|
||||||
</view>
|
<u-icon name="close" color="#fff" size="14"></u-icon>
|
||||||
<view class="u-m-t-32">
|
</view>
|
||||||
<up-line ></up-line>
|
</view>
|
||||||
</view>
|
</up-popup>
|
||||||
<view class="u-m-t-32 u-font-28 x-padding">
|
<my-bottom-btn-group @cancel="cancel" @save="editFreeDing"></my-bottom-btn-group>
|
||||||
<view class="boxconstantbox_one u-m-b-24"> 模块标题 </view>
|
</view>
|
||||||
<up-input
|
|
||||||
placeholderClass="u-font-28"
|
|
||||||
v-model="form.title"
|
|
||||||
:maxlength="20"
|
|
||||||
|
|
||||||
placeholder="请输入模块标题"
|
|
||||||
></up-input>
|
|
||||||
</view>
|
|
||||||
<view class="u-m-t-32">
|
|
||||||
<up-line ></up-line>
|
|
||||||
</view>
|
|
||||||
<view class="u-m-t-32 u-font-28 x-padding">
|
|
||||||
<view class="boxconstantbox_one u-m-b-24"> 模块提示语</view>
|
|
||||||
<up-input
|
|
||||||
placeholderClass="u-font-28"
|
|
||||||
v-model="form.note"
|
|
||||||
:maxlength="20"
|
|
||||||
placeholder="请输入模块提示语"
|
|
||||||
></up-input>
|
|
||||||
</view>
|
|
||||||
<view class="u-m-t-32">
|
|
||||||
<up-line ></up-line>
|
|
||||||
</view>
|
|
||||||
<view class="u-m-t-32 u-font-28 x-padding">
|
|
||||||
<view class="boxconstantbox_one u-m-b-24"> 模块内容</view>
|
|
||||||
<up-textarea
|
|
||||||
type="textarea"
|
|
||||||
:maxlength="50"
|
|
||||||
placeholderClass="u-font-28"
|
|
||||||
v-model="form.content"
|
|
||||||
placeholder="请输入模块内容"
|
|
||||||
></up-textarea>
|
|
||||||
</view>
|
|
||||||
<view class="u-m-t-32">
|
|
||||||
<up-line ></up-line>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="x-padding u-m-t-32">
|
|
||||||
<button class="preview" @click="showPreview = true">预览</button>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<up-popup
|
|
||||||
:show="showPreview"
|
|
||||||
mode="center"
|
|
||||||
round="16rpx"
|
|
||||||
closeOnClickOverlay
|
|
||||||
@close="showPreview = false"
|
|
||||||
:safeAreaInsetBottom="false"
|
|
||||||
>
|
|
||||||
<view class="preview-box">
|
|
||||||
<view class="u-flex" style="align-items: stretch">
|
|
||||||
<view
|
|
||||||
class="u-flex-1 u-p-r-24 u-flex u-flex-col"
|
|
||||||
style="align-items: start; justify-content: space-between"
|
|
||||||
>
|
|
||||||
<view>
|
|
||||||
<view class="u-font-28 font-bold color-333">{{
|
|
||||||
form.title
|
|
||||||
}}</view>
|
|
||||||
<view class="u-m-t-16 u-font-24 color-666">{{
|
|
||||||
form.content
|
|
||||||
}}</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="color-999 u-font-24 u-m-t-16">{{ form.note }}</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<image
|
|
||||||
:src="form.qrCode"
|
|
||||||
style="width: 240rpx; height: 240rpx"
|
|
||||||
mode="scaleToFill"
|
|
||||||
></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</up-popup>
|
|
||||||
|
|
||||||
<my-bottom-btn-group
|
|
||||||
@cancel="cancel"
|
|
||||||
@save="editFreeDing"
|
|
||||||
></my-bottom-btn-group>
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onShow, onLoad } from "@dcloudio/uni-app";
|
import { onShow, onLoad } from '@dcloudio/uni-app';
|
||||||
import { reactive, ref, watch } from "vue";
|
import { reactive, ref, watch } from 'vue';
|
||||||
import { uploadFile } from "@/http/api/index.js";
|
import { uploadFile } from '@/http/api/index.js';
|
||||||
|
import { getConfig, update } from '@/http/api/market/drainageConfig.js';
|
||||||
|
const shopInfo = ref('');
|
||||||
|
|
||||||
import { getConfig, update } from "@/http/api/market/drainageConfig.js";
|
|
||||||
const showPreview = ref(false);
|
const showPreview = ref(false);
|
||||||
|
const defaultNote = ref('如果长按不能识别,可截图或保存二维码图片至相册,通过微信扫码入群');
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
content: "",
|
id: '',
|
||||||
isEnable: 0,
|
orderType: [], // 订单页显示类型: 堂食 dine-in 外带 take-out 外卖 take-away
|
||||||
note: "长按识别,微信内扫一扫加好友",
|
homeType: '', // 首页显示类型:only 仅显示 1 次,day 每天显示一次,every 每次进入小程序
|
||||||
qrCode: "",
|
qrCode: '',
|
||||||
title: "扫码进取,优惠多多",
|
title: '',
|
||||||
useType: [],
|
content: '', //
|
||||||
});
|
note: defaultNote.value,
|
||||||
onLoad(() => {
|
orderEnable: 1, // 订单页是否开启
|
||||||
// uni.$utils.inputReg.bind()()
|
homeEnable: 1 // 首页是否开启
|
||||||
});
|
|
||||||
onShow(() => {
|
|
||||||
getlist();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取配置信息
|
* 获取配置信息
|
||||||
*/
|
*/
|
||||||
const getlist = async () => {
|
const getConfigAjax = async () => {
|
||||||
let res = await getConfig();
|
let res = await getConfig();
|
||||||
res.useType = res.useType || [];
|
res.useType = res.useType || [];
|
||||||
res.note=res.note||"长按识别,微信内扫一扫加好友"
|
res.note = res.note || '长按识别,微信内扫一扫加好友';
|
||||||
res.title=res.title||"扫码进取,优惠多多"
|
res.title = res.title || '扫码进取,优惠多多';
|
||||||
Object.assign(form, res);
|
Object.assign(form, res);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改配置信息
|
* 修改配置信息
|
||||||
*/
|
*/
|
||||||
const editFreeDing = async () => {
|
const editFreeDing = async () => {
|
||||||
if(form.useType.length == 0){
|
if (form.orderEnable == 1 && form.orderType.length == 0) {
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
title: "请选择可使用类型",
|
title: '请选择可使用类型'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!form.qrCode) {
|
if (!form.qrCode) {
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
title: "请上传群二维码",
|
title: '请上传群二维码'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!form.title) {
|
if (!form.title) {
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
title: "请输入模块标题",
|
title: '请输入模块标题'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (form.homeEnable == 1 && form.homeType.length == 0) {
|
||||||
let res = await update(form);
|
return uni.showToast({
|
||||||
uni.showToast({
|
icon: 'none',
|
||||||
title: "保存成功",
|
title: '请选择首页显示类型'
|
||||||
});
|
});
|
||||||
Object.assign(form, res);
|
}
|
||||||
setTimeout(() => {
|
form.note = defaultNote.value;
|
||||||
uni.navigateBack();
|
let res = await update(form);
|
||||||
}, 1500);
|
uni.showToast({
|
||||||
|
title: '保存成功'
|
||||||
|
});
|
||||||
|
Object.assign(form, res);
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateBack();
|
||||||
|
}, 1500);
|
||||||
};
|
};
|
||||||
|
|
||||||
function uploadImage() {
|
function uploadImage() {
|
||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: 1,
|
count: 1,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
uploadFile(res.tempFiles[0]).then((res) => {
|
uploadFile(res.tempFiles[0]).then((res) => {
|
||||||
if (res) {
|
if (res) {
|
||||||
form.qrCode = res;
|
form.qrCode = res;
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
title: "上传失败",
|
title: '上传失败'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancel() {
|
function cancel() {
|
||||||
uni.navigateBack();
|
uni.navigateBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onLoad(() => {
|
||||||
|
shopInfo.value = uni.getStorageSync('shopInfo');
|
||||||
|
// uni.$utils.inputReg.bind()()
|
||||||
|
});
|
||||||
|
|
||||||
|
onShow(() => {
|
||||||
|
getConfigAjax();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
.x-padding {
|
.x-padding {
|
||||||
padding-left: 28rpx;
|
padding-left: 28rpx;
|
||||||
padding-right: 28rpx;
|
padding-right: 28rpx;
|
||||||
}
|
}
|
||||||
.boxconstant {
|
.boxconstant {
|
||||||
padding: 32rpx 28rpx;
|
padding: 32rpx 28rpx;
|
||||||
background: #f7f7f7;
|
background: #f7f7f7;
|
||||||
.boxconstantbox {
|
.boxconstantbox {
|
||||||
padding: 32rpx 24rpx;
|
padding: 32rpx 24rpx;
|
||||||
border-radius: 16rpx;
|
border-radius: 16rpx;
|
||||||
margin-top: 32rpx;
|
margin-top: 32rpx;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
|
|
||||||
.boxconstantbox_one {
|
.boxconstantbox_one {
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.boxconstantbox_tow {
|
.boxconstantbox_tow {
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
// display: flex;
|
// display: flex;
|
||||||
// justify-content: flex-start;
|
// justify-content: flex-start;
|
||||||
// align-items: center;
|
// align-items: center;
|
||||||
// flex-wrap: wrap;
|
// flex-wrap: wrap;
|
||||||
// align-content: flex-start;
|
// align-content: flex-start;
|
||||||
.text {
|
.text {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin: 0 12rpx;
|
margin: 0 12rpx;
|
||||||
width: 118rpx;
|
width: 118rpx;
|
||||||
height: 48rpx;
|
height: 48rpx;
|
||||||
line-height: 48rpx;
|
line-height: 48rpx;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||||
border: 2rpx solid #e5e5e5;
|
border: 2rpx solid #e5e5e5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.oneboxconstant {
|
.oneboxconstant {
|
||||||
margin-top: 32rpx;
|
margin-top: 32rpx;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
padding: 32rpx 24rpx;
|
padding: 32rpx 24rpx;
|
||||||
|
|
||||||
.oneboxconstant_one {
|
.oneboxconstant_one {
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.save {
|
.save {
|
||||||
margin: 100rpx auto 50rpx auto;
|
margin: 100rpx auto 50rpx auto;
|
||||||
width: 530rpx;
|
width: 530rpx;
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
background: #318afe;
|
background: #318afe;
|
||||||
border-radius: 56rpx 56rpx 56rpx 56rpx;
|
border-radius: 56rpx 56rpx 56rpx 56rpx;
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
line-height: 80rpx;
|
line-height: 80rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.top {
|
.top {
|
||||||
padding: 24rpx 20rpx 28rpx 28rpx;
|
padding: 24rpx 20rpx 28rpx 28rpx;
|
||||||
}
|
}
|
||||||
.number-box {
|
.number-box {
|
||||||
width: 260rpx;
|
width: 260rpx;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
padding: 10rpx 26rpx;
|
padding: 10rpx 26rpx;
|
||||||
border-radius: 6rpx 0 0 6rpx;
|
border-radius: 6rpx 0 0 6rpx;
|
||||||
border-top: 2rpx solid #d9d9d9;
|
border-top: 2rpx solid #d9d9d9;
|
||||||
border-bottom: 2rpx solid #d9d9d9;
|
border-bottom: 2rpx solid #d9d9d9;
|
||||||
border-left: 2rpx solid #d9d9d9;
|
border-left: 2rpx solid #d9d9d9;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
.bei {
|
.bei {
|
||||||
display: flex;
|
display: flex;
|
||||||
padding: 10rpx 38rpx;
|
padding: 10rpx 38rpx;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border-radius: 0 6rpx 6rpx 0;
|
border-radius: 0 6rpx 6rpx 0;
|
||||||
border: 2rpx solid #d9d9d9;
|
border: 2rpx solid #d9d9d9;
|
||||||
background: #f7f7fa;
|
background: #f7f7fa;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #999999;
|
color: #999999;
|
||||||
}
|
}
|
||||||
.upload {
|
.upload {
|
||||||
padding: 8rpx 32rpx;
|
padding: 8rpx 32rpx;
|
||||||
border-radius: 60rpx;
|
border-radius: 60rpx;
|
||||||
background: $my-main-color;
|
background: $my-main-color;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
line-height: 40rpx;
|
line-height: 40rpx;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
.code {
|
.code {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 264rpx;
|
width: 264rpx;
|
||||||
height: 264rpx;
|
height: 264rpx;
|
||||||
padding: 108rpx;
|
padding: 108rpx;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 20rpx;
|
gap: 20rpx;
|
||||||
border: 3rpx dashed #d9d9d9;
|
border: 3rpx dashed #d9d9d9;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
padding: 2rpx;
|
padding: 2rpx;
|
||||||
}
|
}
|
||||||
.preview {
|
.preview {
|
||||||
padding: 8rpx 32rpx;
|
padding: 8rpx 32rpx;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
background: $my-main-color;
|
background: $my-main-color;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
line-height: 40rpx;
|
line-height: 40rpx;
|
||||||
}
|
}
|
||||||
.preview-box {
|
.preview-box {
|
||||||
width: 700rpx;
|
width: 700rpx;
|
||||||
padding: 32rpx 28rpx;
|
padding: 32rpx 28rpx;
|
||||||
}
|
}
|
||||||
</style>
|
.new_preview {
|
||||||
|
--bg: #3f3b37;
|
||||||
|
--color: #f6dfc4;
|
||||||
|
--borderColor: #f6dfc45b;
|
||||||
|
width: 90vw;
|
||||||
|
background-color: var(--bg);
|
||||||
|
border-radius: 4px;
|
||||||
|
position: relative;
|
||||||
|
.close {
|
||||||
|
--size: 70upx;
|
||||||
|
width: var(--size);
|
||||||
|
height: var(--size);
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: var(--bg);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
position: absolute;
|
||||||
|
bottom: calc(var(--size) * -1 - 20upx);
|
||||||
|
left: 50%;
|
||||||
|
margin-left: calc(var(--size) / 2 * -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 16px;
|
||||||
|
color: var(--color);
|
||||||
|
height: 50px;
|
||||||
|
border-bottom: 1px dashed var(--borderColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
padding-bottom: 14px;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: 14px;
|
||||||
|
color: var(--color);
|
||||||
|
height: 50px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.img_wrap {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
.img {
|
||||||
|
--size: 220px;
|
||||||
|
width: var(--size);
|
||||||
|
height: var(--size);
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.intro {
|
||||||
|
height: 40px;
|
||||||
|
font-size: 14px;
|
||||||
|
color: var(--color);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.foot {
|
||||||
|
height: 40px;
|
||||||
|
color: var(--borderColor);
|
||||||
|
font-size: 14px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0 14px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
513
pageMarket/groupGoods/addGoods.vue
Normal file
513
pageMarket/groupGoods/addGoods.vue
Normal file
@@ -0,0 +1,513 @@
|
|||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<u-form ref="formRef" :model="form" :rules="rules" label-position="top">
|
||||||
|
<view class="card">
|
||||||
|
<u-form-item prop="useShops">
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">可用门店</text>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<view class="ipt" v-if="isMainShop()">
|
||||||
|
<my-shop-select-w v-model:useType="form.useShopType" v-model:selShops="form.useShops"></my-shop-select-w>
|
||||||
|
</view>
|
||||||
|
<view class="ipt" v-else>
|
||||||
|
<u-radio-group v-model="form.useShopType">
|
||||||
|
<u-radio label="仅本店" name="only"></u-radio>
|
||||||
|
</u-radio-group>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
</view>
|
||||||
|
<view class="card">
|
||||||
|
<u-form-item prop="wareName">
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">商品名称</text>
|
||||||
|
<text class="t2" @click="toSelectGoodS">导入已有商品</text>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<view class="ipt">
|
||||||
|
<u-input placeholder="请输入" :maxlength="30" v-model="form.wareName"></u-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item>
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">商品描述</text>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<view class="ipt">
|
||||||
|
<u-textarea placeholder="请输入" :maxlength="50" v-model="form.wareDetail"></u-textarea>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
</view>
|
||||||
|
<view class="card">
|
||||||
|
<u-form-item prop="wareImgs">
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top column">
|
||||||
|
<text class="t">商品图片</text>
|
||||||
|
<text class="tips">*建议优先选择jpg格式,并且最好控制在500kb内</text>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<my-upload-imgs v-model="form.wareImgs"></my-upload-imgs>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
</view>
|
||||||
|
<view class="card">
|
||||||
|
<u-form-item prop="originalPrice">
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">原价</text>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<view class="ipt">
|
||||||
|
<u-input v-model="form.originalPrice" placeholder="请输入" @change="originalPriceInput">
|
||||||
|
<template #suffix>
|
||||||
|
<text>元</text>
|
||||||
|
</template>
|
||||||
|
</u-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item prop="groupPrice">
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">拼团价</text>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<view class="ipt">
|
||||||
|
<u-input v-model="form.groupPrice" placeholder="请输入" @change="groupPriceInput">
|
||||||
|
<template #suffix>
|
||||||
|
<text>元</text>
|
||||||
|
</template>
|
||||||
|
</u-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item prop="groupPeopleNum">
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top column">
|
||||||
|
<text class="t">成团人数</text>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<view class="ipt">
|
||||||
|
<u-input v-model="form.groupPeopleNum" placeholder="当参与人数达到成团人数才能完成拼团" @change="groupPeopleNumInput"></u-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item prop="groupTimeoutHour">
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top column">
|
||||||
|
<text class="t">成团期限(小时)</text>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<view class="ipt">
|
||||||
|
<u-input v-model="form.groupTimeoutHour" placeholder="最小不低于1小时,最大不超过72小时" @change="groupTimeoutHourInput"></u-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
</view>
|
||||||
|
<view class="card">
|
||||||
|
<u-form-item prop="limitBuyNum">
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">限购数量</text>
|
||||||
|
<u-switch v-model="limitBuyNumSwitch" @change="limitBuyNumSwitchChange"></u-switch>
|
||||||
|
</view>
|
||||||
|
<view class="info" v-if="limitBuyNumSwitch == 1">
|
||||||
|
<view class="ipt">
|
||||||
|
<u-input placeholder="请输入限购数量" :maxlength="8" v-model="form.limitBuyNum" @change="limitBuyNumInput"></u-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
</view>
|
||||||
|
<view class="card">
|
||||||
|
<u-form-item>
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top column">
|
||||||
|
<text class="t">商品详情</text>
|
||||||
|
<text class="tips">*建议优先选择jpg格式,并且最好控制在500kb内</text>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<my-upload-imgs v-model="form.wareCommentImgs"></my-upload-imgs>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
</view>
|
||||||
|
</u-form>
|
||||||
|
<my-footer-btn showCancel type="horizontal" @confirm="submitHandle" @cancel="backHandle"></my-footer-btn>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||||
|
import { filterNumberInput } from '@/utils/index.js';
|
||||||
|
import { addGbWare, updateGbWareById } from '@/http/api/ware.js';
|
||||||
|
import { isMainShop } from '@/store/account.js';
|
||||||
|
|
||||||
|
const type = ref('add'); // add添加商品 editor编辑商品
|
||||||
|
const formRef = ref(null);
|
||||||
|
const limitBuyNumSwitch = ref(false);
|
||||||
|
const form = ref({
|
||||||
|
id: '',
|
||||||
|
useShopType: 'only', // only-仅本店 all全部 /custom 指定
|
||||||
|
useShops: [], // 可用门店(指定门店时存储门店ID,逗号分隔)
|
||||||
|
wareName: '', // 商品名称
|
||||||
|
wareDetail: '', // 商品描述
|
||||||
|
wareImgs: [], // 商品图片(多个用逗号分隔)
|
||||||
|
originalPrice: '', // 原价
|
||||||
|
groupPrice: '', // 拼团价
|
||||||
|
groupPeopleNum: '', // 成团人数 最小为1
|
||||||
|
groupTimeoutHour: '', // 成团期限(小时)不低于1小时,最大72小时
|
||||||
|
limitBuyNum: -10086, // 限购数量(每人最多购买次数) -10086
|
||||||
|
onlineStatus: 1, // 上架状态(0下架 1上架)
|
||||||
|
wareCommentImgs: [] // 商品详情图片(多个用逗号分隔)
|
||||||
|
});
|
||||||
|
|
||||||
|
const rules = ref({
|
||||||
|
useShops: [
|
||||||
|
{
|
||||||
|
trigger: ['change'],
|
||||||
|
message: '请选择可用门店',
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (form.value.useShopType == 'custom' && form.value.useShops.length == 0) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
wareName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
trigger: ['blur'],
|
||||||
|
message: '请输入',
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (form.value.wareName === '') {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
wareImgs: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
trigger: ['blur'],
|
||||||
|
message: '请选择商品图片',
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (form.value.wareImgs.length == 0) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
originalPrice: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
trigger: ['blur'],
|
||||||
|
message: '请输入',
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (form.value.originalPrice === '') {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
groupPrice: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
trigger: ['blur'],
|
||||||
|
message: '请输入',
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (form.value.groupPrice === '') {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
groupPeopleNum: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
trigger: ['blur'],
|
||||||
|
message: '请输入',
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (form.value.groupPeopleNum === '') {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
groupTimeoutHour: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
trigger: ['blur'],
|
||||||
|
message: '请输入',
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (form.value.groupTimeoutHour === '') {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
limitBuyNum: [
|
||||||
|
{
|
||||||
|
trigger: ['change', 'blur'],
|
||||||
|
message: '请输入限购数量',
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (limitBuyNumSwitch.value && form.value.limitBuyNum == '') {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
// 跳转去选择商品
|
||||||
|
function toSelectGoodS() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pageMarket/groupGoods/selectGoods'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const limitBuyNumFalseNum = -10086;
|
||||||
|
function limitBuyNumSwitchChange(e) {
|
||||||
|
if (e) {
|
||||||
|
form.value.limitBuyNum = '';
|
||||||
|
} else {
|
||||||
|
form.value.limitBuyNum = limitBuyNumFalseNum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 原价
|
||||||
|
function originalPriceInput(e) {
|
||||||
|
setTimeout(() => {
|
||||||
|
form.value.originalPrice = filterNumberInput(e);
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 拼团价
|
||||||
|
function groupPriceInput(e) {
|
||||||
|
setTimeout(() => {
|
||||||
|
form.value.groupPrice = filterNumberInput(e);
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 成团人数
|
||||||
|
function groupPeopleNumInput(e) {
|
||||||
|
setTimeout(() => {
|
||||||
|
form.value.groupPeopleNum = filterNumberInput(e, 2);
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 成团期限
|
||||||
|
function groupTimeoutHourInput(e) {
|
||||||
|
setTimeout(() => {
|
||||||
|
form.value.groupTimeoutHour = filterNumberInput(e, 1);
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 限制购买数
|
||||||
|
function limitBuyNumInput(e) {
|
||||||
|
setTimeout(() => {
|
||||||
|
form.value.limitBuyNum = filterNumberInput(e, 1);
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存商品
|
||||||
|
function submitHandle() {
|
||||||
|
console.log(form.value);
|
||||||
|
formRef.value
|
||||||
|
.validate()
|
||||||
|
.then(async () => {
|
||||||
|
try {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '保存中...',
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
const data = { ...form.value };
|
||||||
|
if (form.value.useShopType.length) {
|
||||||
|
data.useShops = form.value.useShops.join(',');
|
||||||
|
}
|
||||||
|
|
||||||
|
data.wareImgs = form.value.wareImgs.join(',');
|
||||||
|
|
||||||
|
if (form.value.wareCommentImgs.length) {
|
||||||
|
data.wareCommentImgs = form.value.wareCommentImgs.join(',');
|
||||||
|
} else {
|
||||||
|
data.wareCommentImgs = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (form.value.id) {
|
||||||
|
await updateGbWareById(data);
|
||||||
|
} else {
|
||||||
|
await addGbWare(data);
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '保存成功',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}, 300);
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateBack();
|
||||||
|
}, 1000);
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
uni.hideLoading();
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
}
|
||||||
|
|
||||||
|
function backHandle() {
|
||||||
|
uni.navigateBack();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从本地获取商品信息
|
||||||
|
function getLocalGoods() {
|
||||||
|
let groupGoods = uni.getStorageSync('groupGoods');
|
||||||
|
|
||||||
|
console.log(groupGoods);
|
||||||
|
|
||||||
|
if (groupGoods && groupGoods.id) {
|
||||||
|
form.value = groupGoods;
|
||||||
|
|
||||||
|
if (form.value.useShops !== '') {
|
||||||
|
form.value.useShops = form.value.useShops.split(',');
|
||||||
|
} else {
|
||||||
|
form.value.useShops = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (form.value.wareImgs != '') {
|
||||||
|
form.value.wareImgs = form.value.wareImgs.split(',');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (form.value.wareCommentImgs != '') {
|
||||||
|
form.value.wareCommentImgs = form.value.wareCommentImgs.split(',');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (form.value.limitBuyNum == -10086) {
|
||||||
|
limitBuyNumSwitch.value = false;
|
||||||
|
} else {
|
||||||
|
limitBuyNumSwitch.value = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从本地获取已选择的拼团商品
|
||||||
|
function getLocalGroupProduct() {
|
||||||
|
let groupGoods = uni.getStorageSync('groupProduct');
|
||||||
|
if (groupGoods && groupGoods.coverImg) {
|
||||||
|
form.value.wareName = groupGoods.name;
|
||||||
|
form.value.wareImgs = [groupGoods.coverImg];
|
||||||
|
form.value.originalPrice = groupGoods.price;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onShow(() => {
|
||||||
|
getLocalGroupProduct();
|
||||||
|
});
|
||||||
|
|
||||||
|
onLoad((options) => {
|
||||||
|
uni.setStorageSync('groupProduct', '');
|
||||||
|
if (options.type && options.type == 'editor') {
|
||||||
|
type.value = options.type;
|
||||||
|
uni.setNavigationBarTitle({
|
||||||
|
title: '编辑商品'
|
||||||
|
});
|
||||||
|
getLocalGoods();
|
||||||
|
} else {
|
||||||
|
type.value = 'add';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
page {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.container {
|
||||||
|
padding: 28upx;
|
||||||
|
}
|
||||||
|
.card {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 20px;
|
||||||
|
padding: 28upx;
|
||||||
|
&:not(:last-child) {
|
||||||
|
margin-bottom: 28upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.switch-wrap {
|
||||||
|
flex: 1;
|
||||||
|
width: 100%;
|
||||||
|
.top {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
&.column {
|
||||||
|
align-items: flex-start;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.t {
|
||||||
|
font-size: 32upx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.tips {
|
||||||
|
font-size: 24upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.t2 {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #3c9cff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.info {
|
||||||
|
padding-top: 16upx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16upx;
|
||||||
|
.i {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.ipt {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.t {
|
||||||
|
font-size: 24upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
305
pageMarket/groupGoods/components/goodsList.vue
Normal file
305
pageMarket/groupGoods/components/goodsList.vue
Normal file
@@ -0,0 +1,305 @@
|
|||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<view class="search-wrap" :style="{ top: `${top}px` }">
|
||||||
|
<view class="ipt">
|
||||||
|
<u-input
|
||||||
|
placeholder="请输入商品名称"
|
||||||
|
suffixIcon="search"
|
||||||
|
shape="circle"
|
||||||
|
clearable
|
||||||
|
v-model="queryForm.wareName"
|
||||||
|
@confirm="resetGetList()"
|
||||||
|
@clear="resetGetList()"
|
||||||
|
></u-input>
|
||||||
|
</view>
|
||||||
|
<div class="ipt" @click="showStatusSheet = true">
|
||||||
|
<u-input placeholder="上架状态" readonly v-model="queryForm.onlineStatusLabel" suffixIcon="arrow-down"></u-input>
|
||||||
|
</div>
|
||||||
|
</view>
|
||||||
|
<view class="list">
|
||||||
|
<view class="item" v-for="item in listData.list" :key="item.id">
|
||||||
|
<view class="header">
|
||||||
|
<text class="t1">成团人数:{{ item.groupPeopleNum }}</text>
|
||||||
|
<text class="t1">成团期限(小时):{{ item.groupTimeoutHour }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="goods-info">
|
||||||
|
<view class="img-wrap">
|
||||||
|
<image class="img" :src="item.wareImgs.split(',')[0]" mode="aspectFill"></image>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<text class="t1">{{ item.wareName }}</text>
|
||||||
|
<text class="t1">原价:{{ item.originalPrice }}</text>
|
||||||
|
<text class="t1">拼团价:{{ item.groupPrice }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="status" v-if="item.shopId == shopInfo.id">
|
||||||
|
<view class="row">
|
||||||
|
<u-switch v-model="item.onlineStatus" :active-value="1" :inactive-value="0" @change="onlineStatusChange($event, item)"></u-switch>
|
||||||
|
</view>
|
||||||
|
<text class="t1">
|
||||||
|
<template v-if="item.onlineStatus">下架</template>
|
||||||
|
<template v-else>上架</template>
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="footer-wrap" v-if="item.shopId == shopInfo.id">
|
||||||
|
<view class="btn">
|
||||||
|
<button class="wx-btn" type="primary" open-type="share" @click="setShareOptions(item)">分享</button>
|
||||||
|
</view>
|
||||||
|
<template v-if="!item.onlineStatus">
|
||||||
|
<view class="btn">
|
||||||
|
<u-button shape="circle" @click="delHandle(item)">删除</u-button>
|
||||||
|
</view>
|
||||||
|
<view class="btn">
|
||||||
|
<u-button type="primary" shape="circle" @click="editorHandle(item)">编辑</u-button>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<view class="btn" style="width: 150px">
|
||||||
|
<u-button shape="circle">下架后编辑/删除</u-button>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<u-loadmore :status="listData.status"></u-loadmore>
|
||||||
|
<u-action-sheet
|
||||||
|
:actions="[
|
||||||
|
{ name: '全部', value: '' },
|
||||||
|
{ name: '上架', value: 1 },
|
||||||
|
{ name: '下架', value: 0 }
|
||||||
|
]"
|
||||||
|
title="上架状态"
|
||||||
|
:show="showStatusSheet"
|
||||||
|
cancelText="取消"
|
||||||
|
@close="showStatusSheet = false"
|
||||||
|
@select="sheetConfirm"
|
||||||
|
></u-action-sheet>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { onMounted, reactive, ref } from 'vue';
|
||||||
|
import { getGbWarePage, editOnlineStatus, deleteGbWare } from '@/http/api/ware.js';
|
||||||
|
|
||||||
|
const emits = defineEmits(['share']);
|
||||||
|
function setShareOptions(item) {
|
||||||
|
item.wareImgs = item.wareImgs.split(',');
|
||||||
|
emits('share', item);
|
||||||
|
}
|
||||||
|
|
||||||
|
const shopInfo = ref('');
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
top: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const showStatusSheet = ref(false);
|
||||||
|
const queryForm = reactive({
|
||||||
|
wareName: '',
|
||||||
|
onlineStatusLabel: '',
|
||||||
|
onlineStatus: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
// 选择状态
|
||||||
|
function sheetConfirm(e) {
|
||||||
|
queryForm.onlineStatusLabel = e.name;
|
||||||
|
queryForm.onlineStatus = e.value;
|
||||||
|
resetGetList();
|
||||||
|
}
|
||||||
|
|
||||||
|
const listData = reactive({
|
||||||
|
page: 1,
|
||||||
|
size: 10,
|
||||||
|
status: 'loading',
|
||||||
|
list: []
|
||||||
|
});
|
||||||
|
|
||||||
|
function reachBottom() {
|
||||||
|
if (listData.status != 'nomore') {
|
||||||
|
listData.page++;
|
||||||
|
getGbWarePageAjax();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 改变状态
|
||||||
|
async function onlineStatusChange(e, item) {
|
||||||
|
try {
|
||||||
|
const res = await editOnlineStatus({
|
||||||
|
id: item.id,
|
||||||
|
onlineStatus: item.onlineStatus
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
item.onlineStatus = !item.onlineStatus;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
async function delHandle(item) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '注意',
|
||||||
|
content: `确定要删除${item.wareName}商品吗?`,
|
||||||
|
success: async (res) => {
|
||||||
|
try {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '删除中...',
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
const res = await deleteGbWare(item.id);
|
||||||
|
let index = listData.list.findIndex((val) => val.id == item.id);
|
||||||
|
listData.list.splice(index, 1);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑
|
||||||
|
function editorHandle(item) {
|
||||||
|
uni.setStorageSync('groupGoods', item);
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pageMarket/groupGoods/addGoods?type=editor'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置列表请求
|
||||||
|
function resetGetList() {
|
||||||
|
listData.page = 1;
|
||||||
|
getGbWarePageAjax();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 拼团商品-列表
|
||||||
|
async function getGbWarePageAjax() {
|
||||||
|
try {
|
||||||
|
const res = await getGbWarePage({
|
||||||
|
page: listData.page,
|
||||||
|
size: listData.size,
|
||||||
|
...queryForm
|
||||||
|
});
|
||||||
|
|
||||||
|
if (listData.page == 1) {
|
||||||
|
listData.list = res.records;
|
||||||
|
} else {
|
||||||
|
listData.list.push(...res.records);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res.pageNumber >= res.totalPage) {
|
||||||
|
listData.status = 'nomore';
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
reachBottom,
|
||||||
|
resetGetList
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
shopInfo.value = uni.getStorageSync('shopInfo');
|
||||||
|
resetGetList();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.container {
|
||||||
|
padding-top: 50px;
|
||||||
|
}
|
||||||
|
.search-wrap {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 28upx;
|
||||||
|
width: 100%;
|
||||||
|
height: 50px;
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
background-color: #fff;
|
||||||
|
z-index: 999;
|
||||||
|
padding: 0 28upx;
|
||||||
|
.ipt {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.list {
|
||||||
|
padding-bottom: 28upx;
|
||||||
|
.item {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 20upx;
|
||||||
|
padding: 28upx;
|
||||||
|
&:not(:first-child) {
|
||||||
|
margin-top: 28upx;
|
||||||
|
}
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
.t1 {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.goods-info {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 28upx 0;
|
||||||
|
.img-wrap {
|
||||||
|
$size: 160upx;
|
||||||
|
position: relative;
|
||||||
|
width: $size;
|
||||||
|
height: $size;
|
||||||
|
.img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 8upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.info {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 0 28upx;
|
||||||
|
gap: 4px;
|
||||||
|
.t1 {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.status {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 4px;
|
||||||
|
.t1 {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.footer-wrap {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 28upx;
|
||||||
|
.btn {
|
||||||
|
width: 140upx;
|
||||||
|
.wx-btn {
|
||||||
|
border-radius: 100px;
|
||||||
|
height: 40px;
|
||||||
|
line-height: 40px;
|
||||||
|
font-size: 28upx;
|
||||||
|
background-color: #318afe;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
526
pageMarket/groupGoods/components/orderList.vue
Normal file
526
pageMarket/groupGoods/components/orderList.vue
Normal file
@@ -0,0 +1,526 @@
|
|||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<view class="search-wrap" :style="{ top: `${top}px` }">
|
||||||
|
<view class="top">
|
||||||
|
<view class="ipt">
|
||||||
|
<u-input
|
||||||
|
placeholder="请输入订单号"
|
||||||
|
prefixIcon="search"
|
||||||
|
shape="circle"
|
||||||
|
clearable
|
||||||
|
v-model="queryForm.orderNo"
|
||||||
|
@confirm="resetGetList(1)"
|
||||||
|
@clear="resetGetList(1)"
|
||||||
|
></u-input>
|
||||||
|
</view>
|
||||||
|
<div class="ipt" @click="dateRef.open()">
|
||||||
|
<u-input placeholder="支付时间范围" readonly v-model="time" suffixIcon="arrow-down"></u-input>
|
||||||
|
</div>
|
||||||
|
</view>
|
||||||
|
<view class="tab-wrap">
|
||||||
|
<view class="item" :class="{ active: statusActive == index }" v-for="(item, index) in tabs" :key="index" @click="tabChange(index)">
|
||||||
|
<text class="t">{{ item.label }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="list">
|
||||||
|
<view class="item" v-for="item in listData.list" :key="item.id">
|
||||||
|
<view class="header">
|
||||||
|
<view class="left">
|
||||||
|
<text class="t1">订单号:{{ item.orderNo }}</text>
|
||||||
|
<text class="t1">团单号:{{ item.groupOrderNo }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="status">
|
||||||
|
<u-tag plain plainFill :type="statusFilter(item.status).type" :text="item.status"></u-tag>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="user-info">
|
||||||
|
<text class="t1">用户:{{ item.userName }} {{ item.userPhone }}</text>
|
||||||
|
<text class="t2">核销码:{{ item.verifyCode }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="goods-info">
|
||||||
|
<image class="img" :src="item.wareJson.wareImgs.split(',')[0]" mode="aspectFill"></image>
|
||||||
|
<view class="info">
|
||||||
|
<view class="left">
|
||||||
|
<text class="t1">{{ item.wareJson.wareName }}</text>
|
||||||
|
<text class="t1">x{{ item.num }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="price">
|
||||||
|
<text class="t1">{{ item.payAmount }}元</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="time-wrap">
|
||||||
|
<text class="t">下单时间:{{ item.createTime }}</text>
|
||||||
|
<text class="t" v-if="item.verifyTime">核销时间:{{ item.verifyTime }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="footer-wrap">
|
||||||
|
<view class="btn">
|
||||||
|
<u-button shape="circle" style="width: 100%" v-if="includesString(item.status, '退款中')" @click="showRefundPopupHandle(item)">审核</u-button>
|
||||||
|
</view>
|
||||||
|
<view class="btn" v-if="includesString(item.status, '待核销') || includesString(item.status, '待成团')">
|
||||||
|
<u-button shape="circle" style="width: 100%" @click="refundHandle(item)">退款</u-button>
|
||||||
|
</view>
|
||||||
|
<view class="btn" v-if="includesString(item.status, '待核销')">
|
||||||
|
<u-button type="primary" shape="circle" style="width: 100%" @click="checkoutHandle(item)">核销</u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<u-loadmore :status="listData.status"></u-loadmore>
|
||||||
|
<my-date-pickerview ref="dateRef" @confirm="dateConfirmHandle"></my-date-pickerview>
|
||||||
|
<u-popup :show="showRefundPopup" :round="20" mode="bottom" closeable @close="showRefundPopup = false">
|
||||||
|
<view class="refund-popup-content">
|
||||||
|
<view class="refund-popup-title">
|
||||||
|
<text class="t">退款审核</text>
|
||||||
|
</view>
|
||||||
|
<view class="form">
|
||||||
|
<u-form :model="refundForm" label-width="70" label-position="left">
|
||||||
|
<u-form-item label="是否同意">
|
||||||
|
<u-radio-group v-model="refundForm.type">
|
||||||
|
<u-radio label="同意" :name="1" :customStyle="{ marginRight: '15px' }"></u-radio>
|
||||||
|
<u-radio label="驳回" :name="0"></u-radio>
|
||||||
|
</u-radio-group>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="驳回原因" v-if="refundForm.type === 0">
|
||||||
|
<u-textarea type="textarea" v-model="refundForm.reason" placeholder="请输入驳回原因"></u-textarea>
|
||||||
|
</u-form-item>
|
||||||
|
</u-form>
|
||||||
|
</view>
|
||||||
|
<view class="dialog-footer">
|
||||||
|
<view class="btn">
|
||||||
|
<u-button @click="showRefundPopup = false" shape="circle" style="width: 100%">取消</u-button>
|
||||||
|
</view>
|
||||||
|
<div class="btn">
|
||||||
|
<u-button type="primary" shape="circle" @click="returnCostConfirmHandle" :loading="refundLoading" style="width: 100%">确认</u-button>
|
||||||
|
</div>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
import { ref, reactive, onMounted } from 'vue';
|
||||||
|
import { includesString } from '@/utils/index.js';
|
||||||
|
import { gbOrderPage, agreeRefund, rejectRefund, checkout } from '@/http/api/ware.js';
|
||||||
|
|
||||||
|
const dateRef = ref(null);
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
top: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const time = ref('');
|
||||||
|
const queryForm = reactive({
|
||||||
|
status: '',
|
||||||
|
orderNo: '',
|
||||||
|
orderStartTime: '',
|
||||||
|
orderEndTime: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
// 确认选择时间
|
||||||
|
function dateConfirmHandle(e) {
|
||||||
|
queryForm.orderStartTime = e.start;
|
||||||
|
queryForm.orderEndTime = e.end;
|
||||||
|
time.value = e.text;
|
||||||
|
resetGetList();
|
||||||
|
}
|
||||||
|
|
||||||
|
const statusActive = ref(0);
|
||||||
|
const tabs = ref([
|
||||||
|
{
|
||||||
|
value: '',
|
||||||
|
label: '全部'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: '待成团',
|
||||||
|
label: '待成团'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: '待核销',
|
||||||
|
label: '待核销'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: '已核销',
|
||||||
|
label: '已核销'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: '退款中',
|
||||||
|
label: '退款'
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
const statusList = ref([
|
||||||
|
{
|
||||||
|
value: '待支付',
|
||||||
|
type: 'info'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: '待核销',
|
||||||
|
type: 'warning'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: '待成团',
|
||||||
|
type: 'warning'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: '已核销',
|
||||||
|
type: 'info'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: '退款中',
|
||||||
|
type: 'error'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: '已退款',
|
||||||
|
type: 'info'
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
// 过滤状态
|
||||||
|
function statusFilter(status) {
|
||||||
|
let obj = statusList.value.find((item) => item.value == status);
|
||||||
|
if (obj) {
|
||||||
|
return obj;
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
value: status,
|
||||||
|
type: 'info'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function tabChange(index) {
|
||||||
|
statusActive.value = index;
|
||||||
|
listData.page = 1;
|
||||||
|
queryForm.status = tabs.value[index].value;
|
||||||
|
resetGetList();
|
||||||
|
}
|
||||||
|
|
||||||
|
const listData = reactive({
|
||||||
|
page: 1,
|
||||||
|
size: 10,
|
||||||
|
status: 'loading',
|
||||||
|
list: []
|
||||||
|
});
|
||||||
|
|
||||||
|
// 滚动到底部,方法需要暴露给父级
|
||||||
|
function reachBottom() {
|
||||||
|
if (listData.status != 'nomore') {
|
||||||
|
listData.page++;
|
||||||
|
gbOrderPageAjax();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 退款
|
||||||
|
function refundHandle(item) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '注意',
|
||||||
|
content: `确定要给[${item.userName}/${item.userPhone}]退款吗?`,
|
||||||
|
success: async (res) => {
|
||||||
|
try {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '退款中...'
|
||||||
|
});
|
||||||
|
const res = await agreeRefund({
|
||||||
|
recordId: item.id,
|
||||||
|
orderNo: item.orderNo,
|
||||||
|
reason: ''
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '退款成功',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}, 100);
|
||||||
|
resetGetList();
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 退款popup
|
||||||
|
const refundLoading = ref(false);
|
||||||
|
const showRefundPopup = ref(false);
|
||||||
|
const refundForm = ref({
|
||||||
|
type: 1,
|
||||||
|
recordId: '',
|
||||||
|
orderNo: '',
|
||||||
|
reason: ''
|
||||||
|
});
|
||||||
|
// 显示退款popup
|
||||||
|
function showRefundPopupHandle(item) {
|
||||||
|
showRefundPopup.value = true;
|
||||||
|
refundForm.value.recordId = item.id;
|
||||||
|
refundForm.value.orderNo = item.orderNo;
|
||||||
|
}
|
||||||
|
// 退款操作
|
||||||
|
async function returnCostConfirmHandle() {
|
||||||
|
try {
|
||||||
|
refundLoading.value = true;
|
||||||
|
if (refundForm.value.type == 1) {
|
||||||
|
// 同意
|
||||||
|
await agreeRefund(refundForm.value);
|
||||||
|
} else {
|
||||||
|
// 驳回
|
||||||
|
await rejectRefund(refundForm.value);
|
||||||
|
}
|
||||||
|
showRefundPopup.value = false;
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '操作成功',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}, 100);
|
||||||
|
resetGetList();
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
refundLoading.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 核销操作
|
||||||
|
async function checkoutHandle(item) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '注意',
|
||||||
|
content: '确认要核销吗?',
|
||||||
|
success: async (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
try {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '核销中...',
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
await checkout(item.verifyCode);
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '已核销',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}, 100);
|
||||||
|
resetGetList();
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置列表请求
|
||||||
|
function resetGetList() {
|
||||||
|
listData.page = 1;
|
||||||
|
gbOrderPageAjax();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取拼团商品:订单列表
|
||||||
|
async function gbOrderPageAjax() {
|
||||||
|
try {
|
||||||
|
const res = await gbOrderPage({
|
||||||
|
page: listData.page,
|
||||||
|
size: listData.size,
|
||||||
|
...queryForm
|
||||||
|
});
|
||||||
|
|
||||||
|
res.records.forEach((item) => {
|
||||||
|
item.wareJson = JSON.parse(item.wareJson);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (listData.page == 1) {
|
||||||
|
listData.list = res.records;
|
||||||
|
} else {
|
||||||
|
listData.list.push(...res.records);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res.pageNumber >= res.totalPage) {
|
||||||
|
listData.status = 'nomore';
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
reachBottom,
|
||||||
|
resetGetList
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
resetGetList();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.container {
|
||||||
|
padding-top: 100px;
|
||||||
|
}
|
||||||
|
.search-wrap {
|
||||||
|
width: 100%;
|
||||||
|
height: 100px;
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
background-color: #fff;
|
||||||
|
z-index: 999;
|
||||||
|
.top {
|
||||||
|
height: 50px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 28upx;
|
||||||
|
padding: 0 28upx;
|
||||||
|
.ipt {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.tab-wrap {
|
||||||
|
height: 50px;
|
||||||
|
display: flex;
|
||||||
|
padding: 0 28upx;
|
||||||
|
.item {
|
||||||
|
--activeColor: #318afe;
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
&.active {
|
||||||
|
position: relative;
|
||||||
|
&::after {
|
||||||
|
content: '';
|
||||||
|
width: 100%;
|
||||||
|
border-bottom: 1px solid var(--activeColor);
|
||||||
|
position: absolute;
|
||||||
|
bottom: 8px;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
.t {
|
||||||
|
color: var(--activeColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.list {
|
||||||
|
padding-bottom: 28upx;
|
||||||
|
.item {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 20upx;
|
||||||
|
padding: 28upx;
|
||||||
|
&:not(:first-child) {
|
||||||
|
margin-top: 28upx;
|
||||||
|
}
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 28upx;
|
||||||
|
.left {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
.t1 {
|
||||||
|
color: #999;
|
||||||
|
font-size: 28upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.user-info {
|
||||||
|
display: flex;
|
||||||
|
margin-top: 20upx;
|
||||||
|
justify-content: space-between;
|
||||||
|
.t1 {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.t2 {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.goods-info {
|
||||||
|
display: flex;
|
||||||
|
margin-top: 20upx;
|
||||||
|
.img {
|
||||||
|
$size: 90upx;
|
||||||
|
width: $size;
|
||||||
|
height: $size;
|
||||||
|
border-radius: 8upx;
|
||||||
|
}
|
||||||
|
.info {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.left {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 0 20upx;
|
||||||
|
.t1 {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.price {
|
||||||
|
.t1 {
|
||||||
|
font-size: 32upx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.time-wrap {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
margin-top: 20upx;
|
||||||
|
.t {
|
||||||
|
font-size: 24upx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.footer-wrap {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
padding-top: 20upx;
|
||||||
|
gap: 28upx;
|
||||||
|
.btn {
|
||||||
|
width: 180upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.refund-popup-content {
|
||||||
|
padding: 0 28upx;
|
||||||
|
.refund-popup-title {
|
||||||
|
padding: 28upx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
.t {
|
||||||
|
font-size: 32upx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.form {
|
||||||
|
padding: 28upx;
|
||||||
|
}
|
||||||
|
.dialog-footer {
|
||||||
|
display: flex;
|
||||||
|
gap: 28upx;
|
||||||
|
.btn {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
237
pageMarket/groupGoods/index.vue
Normal file
237
pageMarket/groupGoods/index.vue
Normal file
@@ -0,0 +1,237 @@
|
|||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<my-header-card
|
||||||
|
:options="{
|
||||||
|
name: '拼团商品',
|
||||||
|
intro: '拼团',
|
||||||
|
icon: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/90491451add14df09ce35ecdf47eef6d.png'
|
||||||
|
}"
|
||||||
|
showSwitch
|
||||||
|
v-model:isOpen="form.onlineStatus"
|
||||||
|
@load="(e) => (headHeight = e.height)"
|
||||||
|
></my-header-card>
|
||||||
|
<view class="tab-wrap" :style="{ top: `${headHeight}px` }">
|
||||||
|
<view class="tab-list">
|
||||||
|
<view class="item" v-for="(item, index) in tabs" :class="{ active: tabsActive == index }" :key="item.value" @click="tabClickHandle(item, index)">
|
||||||
|
<text class="t">{{ item.label }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="content">
|
||||||
|
<goodsList ref="goodsListRef" name="goodsList" key="goodsList" :top="headHeight + 54" v-if="tabsActive == 0" @share="shareCallback" />
|
||||||
|
<orderList ref="orderListRef" name="orderList" key="orderList" :top="headHeight + 54" v-if="tabsActive == 1" />
|
||||||
|
</view>
|
||||||
|
<my-footer-btn confirmText="添加" v-if="tabsActive == 0" @confirm="toAdd"></my-footer-btn>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, watch } from 'vue';
|
||||||
|
import { onLoad, onShow, onReachBottom, onPullDownRefresh, onShareAppMessage } from '@dcloudio/uni-app';
|
||||||
|
import goodsList from './components/goodsList.vue';
|
||||||
|
import orderList from './components/orderList.vue';
|
||||||
|
import { upShopConfig } from '@/http/api/ware.js';
|
||||||
|
import { getShopInfo } from '@/http/api/shop.js';
|
||||||
|
import { isMainShop } from '@/store/account.js';
|
||||||
|
|
||||||
|
const path = '/pageMarket/groupGoods/share';
|
||||||
|
const shareOptions = ref({
|
||||||
|
title: '',
|
||||||
|
path: '',
|
||||||
|
imageUrl: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
onShareAppMessage(() => {
|
||||||
|
console.log(shareOptions.value);
|
||||||
|
return shareOptions.value;
|
||||||
|
});
|
||||||
|
|
||||||
|
function shareCallback(item) {
|
||||||
|
console.log('shareCallback', item);
|
||||||
|
|
||||||
|
shareOptions.value.title = item.wareName;
|
||||||
|
shareOptions.value.path = `${path}?shopId=${item.shopId}&id=${item.id}`;
|
||||||
|
shareOptions.value.imageUrl = item.wareImgs[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
const goodsListRef = ref(null);
|
||||||
|
const orderListRef = ref(null);
|
||||||
|
|
||||||
|
const headHeight = ref(0);
|
||||||
|
const tabsActive = ref(0);
|
||||||
|
const tabs = ref([
|
||||||
|
{
|
||||||
|
value: 1,
|
||||||
|
label: '拼团活动'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 2,
|
||||||
|
label: '拼团订单'
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
function tabClickHandle(item, index) {
|
||||||
|
tabsActive.value = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
function toAdd() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pageMarket/groupGoods/addGoods'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 活动开关
|
||||||
|
const form = ref({
|
||||||
|
onlineStatus: 1
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => form.value.onlineStatus,
|
||||||
|
(newValue, oldValue) => {
|
||||||
|
if (loading.value == false) {
|
||||||
|
if (newValue == 0) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '注意',
|
||||||
|
content: '关闭拼团商品所有未成团的订单都将自动取消,是否确定关闭?',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
upShopConfigAjax();
|
||||||
|
} else {
|
||||||
|
form.value.onlineStatus = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
upShopConfigAjax();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// 更改开关状态
|
||||||
|
async function upShopConfigAjax() {
|
||||||
|
try {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '保存中...',
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
const res = await upShopConfig(form.value);
|
||||||
|
if (tabsActive.value == 0) {
|
||||||
|
goodsListRef.value?.resetGetList();
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 下拉刷新
|
||||||
|
onPullDownRefresh(() => {
|
||||||
|
switch (tabsActive.value) {
|
||||||
|
case 0:
|
||||||
|
goodsListRef.value?.resetGetList();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
orderListRef.value?.resetGetList();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 滚动到底部
|
||||||
|
onReachBottom(() => {
|
||||||
|
switch (tabsActive.value) {
|
||||||
|
case 0:
|
||||||
|
goodsListRef.value?.reachBottom();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
orderListRef.value?.reachBottom();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 获取配置信息
|
||||||
|
const loading = ref(true);
|
||||||
|
async function getShopInfoAjax() {
|
||||||
|
try {
|
||||||
|
loading.value = true;
|
||||||
|
const res = await getShopInfo();
|
||||||
|
form.value.onlineStatus = res.isGroupBuy;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
loading.value = false;
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 页面显示
|
||||||
|
onShow(() => {
|
||||||
|
switch (tabsActive.value) {
|
||||||
|
case 0:
|
||||||
|
goodsListRef.value?.resetGetList();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
onLoad(() => {
|
||||||
|
getShopInfoAjax();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
page {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
$bgColor: #e6f0ff;
|
||||||
|
$primarColor: #318afe;
|
||||||
|
.content {
|
||||||
|
padding: calc(54px + 28upx) 28upx 28upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-wrap {
|
||||||
|
height: 54px;
|
||||||
|
padding: 10px 14px;
|
||||||
|
background-color: #fff;
|
||||||
|
width: 100%;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 999;
|
||||||
|
.tab-list {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
background-color: $bgColor;
|
||||||
|
padding: 6upx;
|
||||||
|
border-radius: 12upx;
|
||||||
|
.item {
|
||||||
|
flex: 1;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border-radius: 8upx;
|
||||||
|
.t {
|
||||||
|
color: $primarColor;
|
||||||
|
font-size: 28upx;
|
||||||
|
}
|
||||||
|
&.active {
|
||||||
|
background-color: $primarColor;
|
||||||
|
.t {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
95
pageMarket/groupGoods/selectGoods.vue
Normal file
95
pageMarket/groupGoods/selectGoods.vue
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
<template>
|
||||||
|
<view class="list">
|
||||||
|
<view class="item" v-for="item in list" :key="item.id" @click="selectGoods(item)">
|
||||||
|
<image class="cover" :src="item.coverImg" mode="aspectFill"></image>
|
||||||
|
<view class="info">
|
||||||
|
<text class="name">{{ item.name }}</text>
|
||||||
|
<text class="price">¥{{ returnPrice(item.skuList) }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
|
import { getProductList } from '@/http/api/product.js';
|
||||||
|
|
||||||
|
// 商品列表
|
||||||
|
const list = ref([]);
|
||||||
|
|
||||||
|
// 选择商品
|
||||||
|
function selectGoods(item) {
|
||||||
|
uni.setStorageSync('groupProduct', {
|
||||||
|
coverImg: item.coverImg,
|
||||||
|
name: item.name,
|
||||||
|
price: returnPrice(item.skuList)
|
||||||
|
});
|
||||||
|
uni.navigateBack();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回规格最高价
|
||||||
|
function returnPrice(skuList) {
|
||||||
|
return Math.max(...skuList.map((item) => item.salePrice));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取商品列表
|
||||||
|
async function getProductListAjax() {
|
||||||
|
try {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中...',
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
const res = await getProductList();
|
||||||
|
list.value = res;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
|
||||||
|
onLoad(() => {
|
||||||
|
getProductListAjax();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
page {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.list {
|
||||||
|
padding: 28upx;
|
||||||
|
.item {
|
||||||
|
padding: 28upx;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 20upx;
|
||||||
|
display: flex;
|
||||||
|
&:not(:first-child) {
|
||||||
|
margin-top: 28upx;
|
||||||
|
}
|
||||||
|
.cover {
|
||||||
|
$size: 120upx;
|
||||||
|
width: $size;
|
||||||
|
height: $size;
|
||||||
|
border-radius: 16upx;
|
||||||
|
}
|
||||||
|
.info {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12upx;
|
||||||
|
padding-left: 28upx;
|
||||||
|
.name {
|
||||||
|
font-size: 32upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.price {
|
||||||
|
font-size: 32upx;
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
531
pageMarket/groupGoods/share.vue
Normal file
531
pageMarket/groupGoods/share.vue
Normal file
@@ -0,0 +1,531 @@
|
|||||||
|
<!-- 套餐分享页 -->
|
||||||
|
<template>
|
||||||
|
<view class="color-333 u-font-28 min-page bg-f7" v-if="item.id">
|
||||||
|
<view class="relative">
|
||||||
|
<up-swiper height="428rpx" :list="item.wareImgs.split(',')" @click="prveImg"></up-swiper>
|
||||||
|
<view class="share-box">
|
||||||
|
分享
|
||||||
|
<button class="share" open-type="share" @click="shareCallback">分享</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="sku">
|
||||||
|
<view class="u-flex u-col-center">
|
||||||
|
<text class="price">¥{{ item.groupPrice }}</text>
|
||||||
|
<text class="old-price">¥{{ item.originalPrice }}</text>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
<view class="u-m-t-16 text" v-if="item.limitBuyNum">限购{{ item.limitBuyNum }}份</view>
|
||||||
|
<view class="text u-m-t-10">已售:{{ item.saleNum || 0 }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="goods">
|
||||||
|
<view class="goods-name">{{ item.wareName }}</view>
|
||||||
|
<!-- <view class="u-m-t-20 color-666">
|
||||||
|
{{ item.description }}
|
||||||
|
</view> -->
|
||||||
|
</view>
|
||||||
|
<view class="bg-f7" style="height: 32rpx"></view>
|
||||||
|
<view class="desc">
|
||||||
|
<view class="u-flex">
|
||||||
|
<view class="color-666 no-wrap" style="min-width: 180rpx">可核销门店:</view>
|
||||||
|
<view class="">{{ item.shopName }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-m-t-16 u-col-baseline">
|
||||||
|
<view class="color-666 no-wrap" style="min-width: 180rpx">门店地址:</view>
|
||||||
|
<view class="">{{ item.shopAddress }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- <template v-if="flase">
|
||||||
|
<view class="bg-f7" style="height: 32rpx"></view>
|
||||||
|
<view class="groups">
|
||||||
|
<view class="color-000 u-m-b-28 u-font-32 font-700">立即拼团</view>
|
||||||
|
<view class="item u-flex" v-for="(item, index) in item.gbOrderList" :key="index">
|
||||||
|
<up-avatar size="76rpx" :src="item.avatar"></up-avatar>
|
||||||
|
<view class="u-flex u-flex-1 u-p-l-22 u-col-center u-row-between">
|
||||||
|
<view>
|
||||||
|
<view class="color-000 u-line-1" style="max-width: 180rpx">{{ item.nickName }}</view>
|
||||||
|
<view class="main-color u-m-t-2">差{{ returnNeedPerpole(item) }}人拼成</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-22">
|
||||||
|
<text class="color-666">剩余:</text>
|
||||||
|
<text class="main-color">{{ getRemainingHMS(item) }}</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="btn" @click="fastBuy(item)">快速拼成</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template> -->
|
||||||
|
<!-- <view class="bg-f7" style="height: 24rpx"></view>
|
||||||
|
<view class="goods-group">
|
||||||
|
<view class="u-flex u-row-between">
|
||||||
|
<view class="name">套餐商品</view>
|
||||||
|
<view class="u-flex color-666" @click="showGroup = !showGroup" style="align-items: baseline">
|
||||||
|
<text class="u-m-r-18">{{ showGroup ? '收起' : '展开' }}</text>
|
||||||
|
<view class="guodu" :class="{ rotate: !showGroup }">
|
||||||
|
<up-icon name="arrow-down" bold></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="" v-if="showGroup">
|
||||||
|
<view class="u-m-t-48" v-for="(item, index) in item.packageContent" :key="index">
|
||||||
|
<view class="font-bold">
|
||||||
|
<text class="">{{ item.name }}</text>
|
||||||
|
<text class="u-m-l-30">{{ item.packageProducts.length }}选{{ item.num }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="">
|
||||||
|
<view class="u-flex u-m-t-24 u-row-between" v-for="(goods, goodsIndex) in item.packageProducts" :key="goodsIndex">
|
||||||
|
<text>{{ goods.name }}</text>
|
||||||
|
<view class="u-flex text-right">
|
||||||
|
<text class="color-666 u-m-r-42">x{{ goods.num }}</text>
|
||||||
|
<view style="min-width: 110rpx">¥{{ goods.price }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="desc" v-if="item.tieredDiscount && item.tieredDiscount.length > 0">
|
||||||
|
<view class="u-flex u-row-between">
|
||||||
|
<view class="name">分享说明</view>
|
||||||
|
<view class="u-flex color-666" @click="showDesc = !showDesc" style="align-items: baseline">
|
||||||
|
<text class="u-m-r-18">{{ showDesc ? '收起' : '展开' }}</text>
|
||||||
|
<view class="guodu" :class="{ rotate: !showDesc }">
|
||||||
|
<up-icon name="arrow-down" bold></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<template v-if="showDesc">
|
||||||
|
<view class="u-m-t-26 text-center table">
|
||||||
|
<view class="u-flex header color-666">
|
||||||
|
<view class="u-flex-1 u-p-t-32 u-p-b-32">分享人数</view>
|
||||||
|
<view class="u-flex-1 u-p-t-32 u-p-b-32">购买价格(元)</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex row" v-for="(step, index) in item.tieredDiscount" :key="index">
|
||||||
|
<view class="u-flex-1 u-p-t-32 u-p-b-32">{{ step.peopleNum }}</view>
|
||||||
|
<view class="u-flex-1 u-p-t-32 u-p-b-32">¥{{ step.price }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="u-m-t-26">
|
||||||
|
<view>分享期限(小时):{{ item.expireHours }}</view>
|
||||||
|
<view class="u-m-t-10">规定期限内的助力才会被计入</view>
|
||||||
|
<view class="u-m-t-40">如何才是分享成功?被分享人只需要点击《助力》,提示助力成功后即可</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
<view class="desc">
|
||||||
|
<view class="u-flex u-row-between">
|
||||||
|
<view class="name">使用说明</view>
|
||||||
|
<view class="u-flex color-666" @click="useDescShow = !useDescShow" style="align-items: baseline">
|
||||||
|
<text class="u-m-r-18">{{ useDescShow ? '收起' : '展开' }}</text>
|
||||||
|
<view class="guodu" :class="{ rotate: !useDescShow }">
|
||||||
|
<up-icon name="arrow-down" bold></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<template v-if="useDescShow">
|
||||||
|
<view class="u-m-t-16 color-666">
|
||||||
|
<view>1、可用时间段:{{ canuseTime }}</view>
|
||||||
|
<view v-if="item.otherDesc">2、其他使用说明:{{ item.otherDesc }}</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</view> -->
|
||||||
|
<view class="goods-detail">
|
||||||
|
<view class="u-flex u-row-center">
|
||||||
|
<view class="title">商品详情</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<image class="w-full" v-for="(item, index) in item.wareCommentImgs.split(',')" :key="index" mode="widthFix" :src="item"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<my-footer-btn confirmColor="#E3AD7F" confirmText="立即参加" @confirm="toMiniApp"></my-footer-btn>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { ref, computed, reactive } from 'vue';
|
||||||
|
import { onLoad, onShareAppMessage } from '@dcloudio/uni-app';
|
||||||
|
import { wareDetail } from '@/http/api/ware.js';
|
||||||
|
|
||||||
|
const showGroup = ref(true);
|
||||||
|
const showDesc = ref(true);
|
||||||
|
const useDescShow = ref(true);
|
||||||
|
|
||||||
|
const canuseTime = computed(() => {
|
||||||
|
return item.useWeeks.join('、') + ' ' + item.useTimes;
|
||||||
|
});
|
||||||
|
|
||||||
|
function prveImg(index) {
|
||||||
|
uni.previewImage({
|
||||||
|
urls: coverImgs.value,
|
||||||
|
current: index
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const query = reactive({
|
||||||
|
shopId: '',
|
||||||
|
id: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
const coverImgs = ref([]);
|
||||||
|
const item = reactive({
|
||||||
|
goodsDescription: []
|
||||||
|
});
|
||||||
|
|
||||||
|
function getDetail() {
|
||||||
|
wareDetail({
|
||||||
|
shopId: query.shopId,
|
||||||
|
wareId: query.id
|
||||||
|
}).then((res) => {
|
||||||
|
Object.assign(item, res);
|
||||||
|
coverImgs.value = res.images;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onLoad((options) => {
|
||||||
|
if (options.id) {
|
||||||
|
query.id = options.id;
|
||||||
|
query.shopId = options.shopId;
|
||||||
|
getDetail();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const path = '/pageMarket/packagePopularize/share';
|
||||||
|
const shareOptions = ref({
|
||||||
|
title: '',
|
||||||
|
path: '',
|
||||||
|
imageUrl: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
function shareCallback() {
|
||||||
|
shareOptions.value.title = item.packageName;
|
||||||
|
shareOptions.value.path = `${path}?shopId=${item.shopId}&id=${item.id}`;
|
||||||
|
shareOptions.value.imageUrl = item.images[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
onShareAppMessage(() => {
|
||||||
|
console.log('onShareAppMessage', shareOptions.value);
|
||||||
|
return shareOptions.value;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 跳转到用户小程序
|
||||||
|
function toMiniApp() {
|
||||||
|
uni.navigateToMiniProgram({
|
||||||
|
appId: 'wxd88fffa983758a30',
|
||||||
|
path: `/groupBuying/goodsDetail/goodsDetail?wareId=${query.id}&shopId=${query.shopId}`,
|
||||||
|
envVersion: 'release', // 环境版本:release(正式版)、trial(体验版)、develop(开发版)
|
||||||
|
success: () => {},
|
||||||
|
fail: () => {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
$topHeight: 350rpx;
|
||||||
|
|
||||||
|
.top-img {
|
||||||
|
width: 750rpx;
|
||||||
|
height: $topHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top {
|
||||||
|
margin: 14rpx 18rpx;
|
||||||
|
background-size: cover;
|
||||||
|
height: $topHeight;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding-left: 70rpx;
|
||||||
|
padding-top: 95rpx;
|
||||||
|
|
||||||
|
.name {
|
||||||
|
color: #000000;
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info {
|
||||||
|
color: #333333;
|
||||||
|
font-size: 48rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
margin-top: 62rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.sku {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 20rpx 36rpx;
|
||||||
|
align-items: center;
|
||||||
|
background: linear-gradient(90deg, #ff4a63 0%, #fd1f48 100%);
|
||||||
|
|
||||||
|
.price {
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.old-price {
|
||||||
|
margin-left: 16rpx;
|
||||||
|
color: #e7e7e7;
|
||||||
|
opacity: 0.85;
|
||||||
|
font-weight: 700;
|
||||||
|
text-decoration: line-through;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
color: #fff;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods {
|
||||||
|
padding: 20rpx 28rpx;
|
||||||
|
background: #fff;
|
||||||
|
|
||||||
|
.goods-name {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.desc {
|
||||||
|
padding: 32rpx 28rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods-detail {
|
||||||
|
padding: 32rpx;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
position: relative;
|
||||||
|
padding: 0 22rpx;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '';
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
right: 100%;
|
||||||
|
width: 70rpx;
|
||||||
|
height: 2rpx;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
background: linear-gradient(90deg, #f7f8f9 0%, #c9cbcc 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
left: 100%;
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
display: block;
|
||||||
|
width: 70rpx;
|
||||||
|
height: 2rpx;
|
||||||
|
background: linear-gradient(90deg, #c9cbcc 0%, #f7f8f9 100%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fixed-bottom {
|
||||||
|
position: fixed;
|
||||||
|
left: 98rpx;
|
||||||
|
right: 98rpx;
|
||||||
|
padding-bottom: 30px;
|
||||||
|
padding-top: 32rpx;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 10;
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
padding: 22rpx;
|
||||||
|
border-radius: 200rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #fff;
|
||||||
|
width: 556rpx;
|
||||||
|
text-align: center;
|
||||||
|
background-color: #e8ad7b;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
|
||||||
|
&.gray {
|
||||||
|
background: #fff;
|
||||||
|
color: #e8ad7b;
|
||||||
|
border-color: #e8ad7b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.waring {
|
||||||
|
background-color: rgba(255, 204, 0, 0.09);
|
||||||
|
padding: 32rpx 24rpx;
|
||||||
|
color: #ff8d28;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-content {
|
||||||
|
font-size: 28rpx;
|
||||||
|
min-height: 300px;
|
||||||
|
|
||||||
|
.popup-content-top {
|
||||||
|
padding: 32rpx 28rpx;
|
||||||
|
border-bottom: 1px solid #ededed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods-info {
|
||||||
|
padding: 32rpx 28rpx;
|
||||||
|
border-bottom: 1px solid #ededed;
|
||||||
|
|
||||||
|
.cover {
|
||||||
|
width: 184rpx;
|
||||||
|
height: 184rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
background: #d9d9d9;
|
||||||
|
|
||||||
|
&.bg-fff {
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.price {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #ed5a2e;
|
||||||
|
line-height: 46rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.old-price {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #999;
|
||||||
|
text-decoration-line: line-through;
|
||||||
|
line-height: 48rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.limitBuyNum {
|
||||||
|
color: #666;
|
||||||
|
line-height: 42rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom {
|
||||||
|
padding: 20rpx;
|
||||||
|
border-bottom: 1px solid #ededed;
|
||||||
|
|
||||||
|
.price {
|
||||||
|
color: #ed5a2e;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
display: flex;
|
||||||
|
padding: 22rpx 214rpx;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 20rpx;
|
||||||
|
border-radius: 66rpx;
|
||||||
|
background: #e8ad7b;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 700;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.w-full {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.groups {
|
||||||
|
padding: 28rpx 22rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
padding: 28rpx 0;
|
||||||
|
border-bottom: 2rpx solid #ededed;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-color {
|
||||||
|
color: #ed5a2e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
padding: 8rpx 26rpx;
|
||||||
|
border-radius: 36rpx;
|
||||||
|
background: #e8ad7b;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.share-box {
|
||||||
|
top: 0;
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
padding: 4rpx 30rpx;
|
||||||
|
border-radius: 0 0 0 24rpx;
|
||||||
|
color: #ed5a2e;
|
||||||
|
font-weight: 700;
|
||||||
|
background: #fff;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.share {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods-group {
|
||||||
|
padding: 32rpx 46rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
|
||||||
|
.name {
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rotate {
|
||||||
|
transform: rotate(-90deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.desc {
|
||||||
|
padding: 32rpx 46rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
margin-top: 32rpx;
|
||||||
|
|
||||||
|
.name {
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table {
|
||||||
|
border: 2rpx solid #ededed;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
margin: 0 52rpx;
|
||||||
|
|
||||||
|
.header {
|
||||||
|
background: #f8f8f88f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row {
|
||||||
|
border-top: 2rpx solid #ededed;
|
||||||
|
|
||||||
|
&:first-child {
|
||||||
|
border-top: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.rotate {
|
||||||
|
transform: rotate(-90deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.guodu {
|
||||||
|
transition: all 0.3s;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
1170
pageMarket/packagePopularize/addGoods.vue
Normal file
1170
pageMarket/packagePopularize/addGoods.vue
Normal file
File diff suppressed because it is too large
Load Diff
313
pageMarket/packagePopularize/components/goodsList.vue
Normal file
313
pageMarket/packagePopularize/components/goodsList.vue
Normal file
@@ -0,0 +1,313 @@
|
|||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<view class="search-wrap" :style="{ top: `${top}px` }">
|
||||||
|
<view class="ipt">
|
||||||
|
<u-input
|
||||||
|
placeholder="请输入商品名称"
|
||||||
|
suffixIcon="search"
|
||||||
|
shape="circle"
|
||||||
|
clearable
|
||||||
|
v-model="queryForm.packageName"
|
||||||
|
@confirm="resetGetList()"
|
||||||
|
@clear="
|
||||||
|
queryForm.packageName = '';
|
||||||
|
resetGetList();
|
||||||
|
"
|
||||||
|
></u-input>
|
||||||
|
</view>
|
||||||
|
<div class="ipt" @click="showStatusSheet = true">
|
||||||
|
<u-input placeholder="上架状态" readonly v-model="queryForm.onlineStatusLabel" suffixIcon="arrow-down"></u-input>
|
||||||
|
</div>
|
||||||
|
</view>
|
||||||
|
<view class="list">
|
||||||
|
<view class="item" v-for="item in listData.list" :key="item.id">
|
||||||
|
<view class="header">
|
||||||
|
<text class="t1">分享期限(小时):{{ item.expireHours }}</text>
|
||||||
|
<text class="t1">可用时段:{{ item.useTimes }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="goods-info">
|
||||||
|
<view class="img-wrap">
|
||||||
|
<image class="img" :src="item.images[0]" mode="aspectFill"></image>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<text class="t1">{{ item.packageName }}</text>
|
||||||
|
<text class="t1">原价:{{ item.originPrice }}</text>
|
||||||
|
<text class="t1">价格:{{ item.price }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="status" v-if="item.shopId == shopInfo.id">
|
||||||
|
<view class="row">
|
||||||
|
<u-switch v-model="item.onlineStatus" :active-value="1" :inactive-value="0" @change="onlineStatusChange($event, item)"></u-switch>
|
||||||
|
</view>
|
||||||
|
<text class="t1">
|
||||||
|
<template v-if="item.onlineStatus">下架</template>
|
||||||
|
<template v-else>上架</template>
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="footer-wrap" v-if="item.shopId == shopInfo.id">
|
||||||
|
<view class="btn">
|
||||||
|
<button class="wx-btn" type="primary" open-type="share" @click="setShareOptions(item)">分享</button>
|
||||||
|
</view>
|
||||||
|
<template v-if="!item.onlineStatus">
|
||||||
|
<view class="btn">
|
||||||
|
<u-button shape="circle" @click="delHandle(item)">删除</u-button>
|
||||||
|
</view>
|
||||||
|
<view class="btn">
|
||||||
|
<u-button type="primary" shape="circle" @click="editorHandle(item)">编辑</u-button>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<view class="btn" style="width: 150px">
|
||||||
|
<u-button shape="circle">下架后编辑/删除</u-button>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<u-loadmore :status="listData.status"></u-loadmore>
|
||||||
|
<u-action-sheet
|
||||||
|
:actions="[
|
||||||
|
{ name: '全部', value: '' },
|
||||||
|
{ name: '上架', value: 1 },
|
||||||
|
{ name: '下架', value: 0 }
|
||||||
|
]"
|
||||||
|
title="上架状态"
|
||||||
|
:show="showStatusSheet"
|
||||||
|
cancelText="取消"
|
||||||
|
@close="showStatusSheet = false"
|
||||||
|
@select="sheetConfirm"
|
||||||
|
></u-action-sheet>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { onMounted, reactive, ref } from 'vue';
|
||||||
|
import { packageGet, packageOnline, packageDel } from '@/http/api/ware.js';
|
||||||
|
|
||||||
|
const emits = defineEmits(['share']);
|
||||||
|
function setShareOptions(item) {
|
||||||
|
emits('share', item);
|
||||||
|
}
|
||||||
|
|
||||||
|
const shopInfo = ref('');
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
top: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const showStatusSheet = ref(false);
|
||||||
|
const queryForm = reactive({
|
||||||
|
packageName: '',
|
||||||
|
onlineStatusLabel: '',
|
||||||
|
onlineStatus: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
// 选择状态
|
||||||
|
function sheetConfirm(e) {
|
||||||
|
queryForm.onlineStatusLabel = e.name;
|
||||||
|
queryForm.onlineStatus = e.value;
|
||||||
|
resetGetList();
|
||||||
|
}
|
||||||
|
|
||||||
|
const listData = reactive({
|
||||||
|
page: 1,
|
||||||
|
size: 10,
|
||||||
|
status: 'loading',
|
||||||
|
list: []
|
||||||
|
});
|
||||||
|
|
||||||
|
function reachBottom() {
|
||||||
|
if (listData.status != 'nomore') {
|
||||||
|
listData.page++;
|
||||||
|
getGbWarePageAjax();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 改变状态
|
||||||
|
async function onlineStatusChange(e, item) {
|
||||||
|
try {
|
||||||
|
const res = await packageOnline({
|
||||||
|
packageId: item.id,
|
||||||
|
status: item.onlineStatus
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
item.onlineStatus = !item.onlineStatus;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
async function delHandle(item) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '注意',
|
||||||
|
content: `删除套餐推广所有未支付的订单都将自动取消,是否确定删除?`,
|
||||||
|
success: async (res) => {
|
||||||
|
try {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '删除中...',
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
const res = await packageDel(item.id);
|
||||||
|
let index = listData.list.findIndex((val) => val.id == item.id);
|
||||||
|
listData.list.splice(index, 1);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑
|
||||||
|
function editorHandle(item) {
|
||||||
|
uni.setStorageSync('packageGoods', item);
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pageMarket/packagePopularize/addGoods?type=editor'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置列表请求
|
||||||
|
function resetGetList() {
|
||||||
|
listData.page = 1;
|
||||||
|
getGbWarePageAjax();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 拼团商品-列表
|
||||||
|
async function getGbWarePageAjax(page = listData.page, isPull = false) {
|
||||||
|
try {
|
||||||
|
const res = await packageGet({
|
||||||
|
page: page,
|
||||||
|
size: listData.size,
|
||||||
|
...queryForm
|
||||||
|
});
|
||||||
|
|
||||||
|
if (listData.page == 1) {
|
||||||
|
listData.list = res.records;
|
||||||
|
} else {
|
||||||
|
listData.list.push(...res.records);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res.pageNumber >= res.totalPage) {
|
||||||
|
listData.status = 'nomore';
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
if (isPull) {
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '刷新成功',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
reachBottom,
|
||||||
|
resetGetList
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
shopInfo.value = uni.getStorageSync('shopInfo');
|
||||||
|
resetGetList();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.container {
|
||||||
|
padding-top: 50px;
|
||||||
|
}
|
||||||
|
.search-wrap {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 28upx;
|
||||||
|
width: 100%;
|
||||||
|
height: 50px;
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
background-color: #fff;
|
||||||
|
z-index: 999;
|
||||||
|
padding: 0 28upx;
|
||||||
|
.ipt {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.list {
|
||||||
|
padding-bottom: 28upx;
|
||||||
|
.item {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 20upx;
|
||||||
|
padding: 28upx;
|
||||||
|
&:not(:first-child) {
|
||||||
|
margin-top: 28upx;
|
||||||
|
}
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
.t1 {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.goods-info {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 28upx 0;
|
||||||
|
.img-wrap {
|
||||||
|
$size: 160upx;
|
||||||
|
position: relative;
|
||||||
|
width: $size;
|
||||||
|
height: $size;
|
||||||
|
.img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 8upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.info {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 0 28upx;
|
||||||
|
gap: 4px;
|
||||||
|
.t1 {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.status {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 4px;
|
||||||
|
.t1 {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.footer-wrap {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 28upx;
|
||||||
|
.btn {
|
||||||
|
width: 140upx;
|
||||||
|
.wx-btn {
|
||||||
|
border-radius: 100px;
|
||||||
|
height: 40px;
|
||||||
|
line-height: 40px;
|
||||||
|
font-size: 28upx;
|
||||||
|
background-color: #318afe;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
540
pageMarket/packagePopularize/components/orderList.vue
Normal file
540
pageMarket/packagePopularize/components/orderList.vue
Normal file
@@ -0,0 +1,540 @@
|
|||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<view class="search-wrap" :style="{ top: `${top}px` }">
|
||||||
|
<view class="top">
|
||||||
|
<view class="ipt">
|
||||||
|
<u-input
|
||||||
|
placeholder="请输入订单号"
|
||||||
|
prefixIcon="search"
|
||||||
|
shape="circle"
|
||||||
|
clearable
|
||||||
|
v-model="queryForm.orderNo"
|
||||||
|
@confirm="resetGetList()"
|
||||||
|
@clear="resetGetList()"
|
||||||
|
></u-input>
|
||||||
|
</view>
|
||||||
|
<div class="ipt" @click="dateRef.open()">
|
||||||
|
<u-input placeholder="支付时间范围" readonly v-model="time" suffixIcon="arrow-down"></u-input>
|
||||||
|
</div>
|
||||||
|
</view>
|
||||||
|
<view class="tab-wrap">
|
||||||
|
<view class="item" :class="{ active: statusActive == index }" v-for="(item, index) in tabs" :key="index" @click="tabChange(index)">
|
||||||
|
<text class="t">{{ item.label }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="list">
|
||||||
|
<view class="item" v-for="item in listData.list" :key="item.id">
|
||||||
|
<view class="header">
|
||||||
|
<view class="left">
|
||||||
|
<text class="t1">订单号:{{ item.orderNo }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="status">
|
||||||
|
<u-tag plain plainFill :type="statusFilter(item.status).type" :text="statusFilter(item.status).label"></u-tag>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="user-info">
|
||||||
|
<text class="t1">用户:{{ item.nickname }} {{ item.phone }}</text>
|
||||||
|
<text class="t2">核销码:{{ item.verifyCode }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="goods-info">
|
||||||
|
<image class="img" :src="item.images[0]" mode="aspectFill"></image>
|
||||||
|
<view class="info">
|
||||||
|
<view class="left">
|
||||||
|
<text class="t1">{{ item.packageName }}</text>
|
||||||
|
<text class="t2">{{ item.price }}元</text>
|
||||||
|
</view>
|
||||||
|
<view class="price">
|
||||||
|
<text class="t1">分享人数:{{ item.shareNum || 0 }}</text>
|
||||||
|
<text class="t2">最终支付:{{ item.finalPrice || 0 }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="time-wrap">
|
||||||
|
<text class="t">支付时间:{{ item.payTime }}</text>
|
||||||
|
<text class="t" v-if="item.verifyTime">核销时间:{{ item.verifyTime }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="footer-wrap">
|
||||||
|
<view class="btn">
|
||||||
|
<u-button shape="circle" style="width: 100%" v-if="item.status == 'refunding'" @click="showRefundPopupHandle(item)">审核</u-button>
|
||||||
|
</view>
|
||||||
|
<view class="btn" v-if="item.status == 'wait_verify'">
|
||||||
|
<u-button shape="circle" style="width: 100%" @click="refundHandle(item)">退款</u-button>
|
||||||
|
</view>
|
||||||
|
<view class="btn" v-if="item.status == 'wait_verify'">
|
||||||
|
<u-button type="primary" shape="circle" style="width: 100%" @click="checkoutHandle(item)">核销</u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<u-loadmore :status="listData.status"></u-loadmore>
|
||||||
|
<my-date-pickerview ref="dateRef" @confirm="dateConfirmHandle"></my-date-pickerview>
|
||||||
|
<u-popup :show="showRefundPopup" :round="20" mode="bottom" closeable @close="showRefundPopup = false">
|
||||||
|
<view class="refund-popup-content">
|
||||||
|
<view class="refund-popup-title">
|
||||||
|
<text class="t">退款审核</text>
|
||||||
|
</view>
|
||||||
|
<view class="form">
|
||||||
|
<u-form :model="refundForm" label-width="70" label-position="left">
|
||||||
|
<u-form-item label="是否同意">
|
||||||
|
<u-radio-group v-model="refundForm.type">
|
||||||
|
<u-radio label="同意" :name="1" :customStyle="{ marginRight: '15px' }"></u-radio>
|
||||||
|
<u-radio label="驳回" :name="0"></u-radio>
|
||||||
|
</u-radio-group>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="驳回原因" v-if="refundForm.type === 0">
|
||||||
|
<u-textarea type="textarea" v-model="refundForm.reason" placeholder="请输入驳回原因"></u-textarea>
|
||||||
|
</u-form-item>
|
||||||
|
</u-form>
|
||||||
|
</view>
|
||||||
|
<view class="dialog-footer">
|
||||||
|
<view class="btn">
|
||||||
|
<u-button @click="showRefundPopup = false" shape="circle" style="width: 100%">取消</u-button>
|
||||||
|
</view>
|
||||||
|
<div class="btn">
|
||||||
|
<u-button type="primary" shape="circle" @click="returnCostConfirmHandle" :loading="refundLoading" style="width: 100%">确认</u-button>
|
||||||
|
</div>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
import { ref, reactive, onMounted } from 'vue';
|
||||||
|
import { includesString } from '@/utils/index.js';
|
||||||
|
import { packageOrder, packageConfirmRefund, packageRejectRefund, packageCheckout } from '@/http/api/ware.js';
|
||||||
|
|
||||||
|
const dateRef = ref(null);
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
top: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const time = ref('');
|
||||||
|
const queryForm = reactive({
|
||||||
|
status: '',
|
||||||
|
orderNo: '',
|
||||||
|
orderStartTime: '',
|
||||||
|
orderEndTime: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
// 确认选择时间
|
||||||
|
function dateConfirmHandle(e) {
|
||||||
|
queryForm.orderStartTime = e.start;
|
||||||
|
queryForm.orderEndTime = e.end;
|
||||||
|
time.value = e.text;
|
||||||
|
resetGetList();
|
||||||
|
}
|
||||||
|
|
||||||
|
const statusActive = ref(0);
|
||||||
|
const tabs = ref([
|
||||||
|
{
|
||||||
|
value: '',
|
||||||
|
label: '全部'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'wait_verify',
|
||||||
|
label: '待核销'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'finish',
|
||||||
|
label: '已核销'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'ref',
|
||||||
|
label: '退款'
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
const statusList = ref([
|
||||||
|
{
|
||||||
|
label: '进行中',
|
||||||
|
value: 'ing',
|
||||||
|
type: 'warning'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '待核销',
|
||||||
|
value: 'wait_verify',
|
||||||
|
type: 'warning'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '已核销',
|
||||||
|
value: 'finish',
|
||||||
|
type: 'success'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '退款中',
|
||||||
|
value: 'refunding',
|
||||||
|
type: 'error'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '已退款',
|
||||||
|
value: 'refund',
|
||||||
|
type: 'info'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '已取消',
|
||||||
|
value: 'cancel',
|
||||||
|
type: 'info'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '超时',
|
||||||
|
value: 'timeout',
|
||||||
|
type: 'error'
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
// 过滤状态
|
||||||
|
function statusFilter(status) {
|
||||||
|
let obj = statusList.value.find((item) => item.value == status);
|
||||||
|
if (obj) {
|
||||||
|
return obj;
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
value: status,
|
||||||
|
type: 'info'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function tabChange(index) {
|
||||||
|
statusActive.value = index;
|
||||||
|
queryForm.status = tabs.value[index].value;
|
||||||
|
resetGetList();
|
||||||
|
}
|
||||||
|
|
||||||
|
const listData = reactive({
|
||||||
|
page: 1,
|
||||||
|
size: 10,
|
||||||
|
status: 'loading',
|
||||||
|
list: []
|
||||||
|
});
|
||||||
|
|
||||||
|
// 滚动到底部,方法需要暴露给父级
|
||||||
|
function reachBottom() {
|
||||||
|
if (listData.status != 'nomore') {
|
||||||
|
listData.page++;
|
||||||
|
gbOrderPageAjax();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 退款
|
||||||
|
function refundHandle(item) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '注意',
|
||||||
|
content: `确定要给[${item.nickname}/${item.phone}]退款吗?`,
|
||||||
|
success: async (res) => {
|
||||||
|
try {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '退款中...'
|
||||||
|
});
|
||||||
|
const res = await packageConfirmRefund({
|
||||||
|
recordId: item.id,
|
||||||
|
orderNo: item.orderNo,
|
||||||
|
reason: ''
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '退款成功',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}, 100);
|
||||||
|
resetGetList();
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 退款popup
|
||||||
|
const refundLoading = ref(false);
|
||||||
|
const showRefundPopup = ref(false);
|
||||||
|
const refundForm = ref({
|
||||||
|
type: 1,
|
||||||
|
recordId: '',
|
||||||
|
orderNo: '',
|
||||||
|
reason: ''
|
||||||
|
});
|
||||||
|
// 显示退款popup
|
||||||
|
function showRefundPopupHandle(item) {
|
||||||
|
showRefundPopup.value = true;
|
||||||
|
refundForm.value.recordId = item.id;
|
||||||
|
refundForm.value.orderNo = item.orderNo;
|
||||||
|
}
|
||||||
|
// 退款操作
|
||||||
|
async function returnCostConfirmHandle() {
|
||||||
|
try {
|
||||||
|
refundLoading.value = true;
|
||||||
|
if (refundForm.value.type == 1) {
|
||||||
|
// 同意
|
||||||
|
await packageConfirmRefund(refundForm.value);
|
||||||
|
} else {
|
||||||
|
// 驳回
|
||||||
|
await packageRejectRefund(refundForm.value);
|
||||||
|
}
|
||||||
|
showRefundPopup.value = false;
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '操作成功',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}, 100);
|
||||||
|
resetGetList();
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
refundLoading.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 核销操作
|
||||||
|
async function checkoutHandle(item) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '注意',
|
||||||
|
content: '确认要核销吗?',
|
||||||
|
success: async (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
try {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '核销中...',
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
await packageCheckout({ verifyCode: item.verifyCode });
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '已核销',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}, 100);
|
||||||
|
resetGetList();
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置列表请求
|
||||||
|
function resetGetList() {
|
||||||
|
listData.page = 1;
|
||||||
|
gbOrderPageAjax();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取拼团商品:订单列表
|
||||||
|
async function gbOrderPageAjax() {
|
||||||
|
try {
|
||||||
|
const res = await packageOrder({
|
||||||
|
page: listData.page,
|
||||||
|
size: listData.size,
|
||||||
|
...queryForm
|
||||||
|
});
|
||||||
|
|
||||||
|
if (listData.page == 1) {
|
||||||
|
listData.list = res.records;
|
||||||
|
} else {
|
||||||
|
listData.list.push(...res.records);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res.pageNumber >= res.totalPage) {
|
||||||
|
listData.status = 'nomore';
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
reachBottom,
|
||||||
|
resetGetList
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
resetGetList();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.container {
|
||||||
|
padding-top: 100px;
|
||||||
|
}
|
||||||
|
.search-wrap {
|
||||||
|
width: 100%;
|
||||||
|
height: 100px;
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
background-color: #fff;
|
||||||
|
z-index: 999;
|
||||||
|
.top {
|
||||||
|
height: 50px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 28upx;
|
||||||
|
padding: 0 28upx;
|
||||||
|
.ipt {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.tab-wrap {
|
||||||
|
height: 50px;
|
||||||
|
display: flex;
|
||||||
|
padding: 0 28upx;
|
||||||
|
.item {
|
||||||
|
--activeColor: #318afe;
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
&.active {
|
||||||
|
position: relative;
|
||||||
|
&::after {
|
||||||
|
content: '';
|
||||||
|
width: 100%;
|
||||||
|
border-bottom: 1px solid var(--activeColor);
|
||||||
|
position: absolute;
|
||||||
|
bottom: 8px;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
.t {
|
||||||
|
color: var(--activeColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.list {
|
||||||
|
padding-bottom: 28upx;
|
||||||
|
.item {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 20upx;
|
||||||
|
padding: 28upx;
|
||||||
|
&:not(:first-child) {
|
||||||
|
margin-top: 28upx;
|
||||||
|
}
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 28upx;
|
||||||
|
.left {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
.t1 {
|
||||||
|
color: #999;
|
||||||
|
font-size: 28upx;
|
||||||
|
}
|
||||||
|
.t2 {
|
||||||
|
color: #333;
|
||||||
|
font-size: 28upx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.user-info {
|
||||||
|
display: flex;
|
||||||
|
margin-top: 20upx;
|
||||||
|
justify-content: space-between;
|
||||||
|
.t1 {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.t2 {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.goods-info {
|
||||||
|
display: flex;
|
||||||
|
margin-top: 20upx;
|
||||||
|
.img {
|
||||||
|
$size: 90upx;
|
||||||
|
width: $size;
|
||||||
|
height: $size;
|
||||||
|
border-radius: 8upx;
|
||||||
|
}
|
||||||
|
.info {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.left {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 0 20upx;
|
||||||
|
.t1 {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.price {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
.t1 {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.t2 {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #ff383c;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.time-wrap {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
margin-top: 20upx;
|
||||||
|
.t {
|
||||||
|
font-size: 24upx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.footer-wrap {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
padding-top: 20upx;
|
||||||
|
gap: 28upx;
|
||||||
|
.btn {
|
||||||
|
width: 180upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.refund-popup-content {
|
||||||
|
padding: 0 28upx;
|
||||||
|
.refund-popup-title {
|
||||||
|
padding: 28upx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
.t {
|
||||||
|
font-size: 32upx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.form {
|
||||||
|
padding: 28upx;
|
||||||
|
}
|
||||||
|
.dialog-footer {
|
||||||
|
display: flex;
|
||||||
|
gap: 28upx;
|
||||||
|
.btn {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
234
pageMarket/packagePopularize/index.vue
Normal file
234
pageMarket/packagePopularize/index.vue
Normal file
@@ -0,0 +1,234 @@
|
|||||||
|
<!-- 套餐推广 -->
|
||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<my-header-card
|
||||||
|
:options="{
|
||||||
|
name: '套餐推广',
|
||||||
|
intro: '下单通过用户邀请好友减免金额的方式裂变宣传套餐加购',
|
||||||
|
icon: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/d660089c797346a4afba90e00464d557.png'
|
||||||
|
}"
|
||||||
|
showSwitch
|
||||||
|
v-model:isOpen="form.onlineStatus"
|
||||||
|
@load="(e) => (headHeight = e.height)"
|
||||||
|
></my-header-card>
|
||||||
|
<view class="tab-wrap" :style="{ top: `${headHeight}px` }">
|
||||||
|
<view class="tab-list">
|
||||||
|
<view class="item" v-for="(item, index) in tabs" :class="{ active: tabsActive == index }" :key="item.value" @click="tabClickHandle(item, index)">
|
||||||
|
<text class="t">{{ item.label }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="content">
|
||||||
|
<goodsList ref="goodsListRef" name="goodsList" key="goodsList" :top="headHeight + 54" v-if="tabsActive == 0" @share="shareCallback" />
|
||||||
|
<orderList ref="orderListRef" name="orderList" key="orderList" :top="headHeight + 54" v-if="tabsActive == 1" />
|
||||||
|
</view>
|
||||||
|
<my-footer-btn confirmText="添加" v-if="tabsActive == 0" @confirm="toAdd"></my-footer-btn>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, watch } from 'vue';
|
||||||
|
import { onLoad, onShow, onReachBottom, onPullDownRefresh, onShareAppMessage } from '@dcloudio/uni-app';
|
||||||
|
import goodsList from './components/goodsList.vue';
|
||||||
|
import orderList from './components/orderList.vue';
|
||||||
|
import { packageSwitchGet, packageSwitchPut } from '@/http/api/ware.js';
|
||||||
|
|
||||||
|
const path = '/pageMarket/packagePopularize/share';
|
||||||
|
const shareOptions = ref({
|
||||||
|
title: '',
|
||||||
|
path: '',
|
||||||
|
imageUrl: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
onShareAppMessage(() => {
|
||||||
|
console.log(shareOptions.value);
|
||||||
|
return shareOptions.value;
|
||||||
|
});
|
||||||
|
|
||||||
|
function shareCallback(item) {
|
||||||
|
shareOptions.value.title = item.packageName;
|
||||||
|
shareOptions.value.path = `${path}?shopId=${item.shopId}&id=${item.id}`;
|
||||||
|
shareOptions.value.imageUrl = item.images[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
const goodsListRef = ref(null);
|
||||||
|
const orderListRef = ref(null);
|
||||||
|
|
||||||
|
const headHeight = ref(0);
|
||||||
|
const tabsActive = ref(0);
|
||||||
|
const tabs = ref([
|
||||||
|
{
|
||||||
|
value: 1,
|
||||||
|
label: '套餐活动'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 2,
|
||||||
|
label: '套餐订单'
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
function tabClickHandle(item, index) {
|
||||||
|
tabsActive.value = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
function toAdd() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pageMarket/packagePopularize/addGoods'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 活动开关
|
||||||
|
const form = ref({
|
||||||
|
onlineStatus: 1
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => form.value.onlineStatus,
|
||||||
|
(newValue, oldValue) => {
|
||||||
|
if (loading.value == false) {
|
||||||
|
if (newValue == 0) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '注意',
|
||||||
|
content: '关闭套餐推广所有未支付的订单都将自动取消,是否确定关闭?',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
upShopConfigAjax();
|
||||||
|
} else {
|
||||||
|
form.value.onlineStatus = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
upShopConfigAjax();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// 更改开关状态
|
||||||
|
async function upShopConfigAjax() {
|
||||||
|
try {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '保存中...',
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
await packageSwitchPut({ status: form.value.onlineStatus });
|
||||||
|
if (tabsActive.value == 0) {
|
||||||
|
goodsListRef.value?.resetGetList();
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 下拉刷新
|
||||||
|
onPullDownRefresh(() => {
|
||||||
|
switch (tabsActive.value) {
|
||||||
|
case 0:
|
||||||
|
goodsListRef.value?.resetGetList();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
orderListRef.value?.gbOrderPageAjax(1, true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 滚动到底部
|
||||||
|
onReachBottom(() => {
|
||||||
|
switch (tabsActive.value) {
|
||||||
|
case 0:
|
||||||
|
goodsListRef.value?.reachBottom();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
orderListRef.value?.reachBottom();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 获取配置信息
|
||||||
|
const loading = ref(true);
|
||||||
|
async function getShopInfoAjax() {
|
||||||
|
try {
|
||||||
|
loading.value = true;
|
||||||
|
const res = await packageSwitchGet();
|
||||||
|
form.value.onlineStatus = res;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
loading.value = false;
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 页面显示
|
||||||
|
onShow(() => {
|
||||||
|
switch (tabsActive.value) {
|
||||||
|
case 0:
|
||||||
|
goodsListRef.value?.resetGetList();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
onLoad(() => {
|
||||||
|
getShopInfoAjax();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
page {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
$bgColor: #e6f0ff;
|
||||||
|
$primarColor: #318afe;
|
||||||
|
.content {
|
||||||
|
padding: calc(54px + 28upx) 28upx 28upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-wrap {
|
||||||
|
height: 54px;
|
||||||
|
padding: 10px 14px;
|
||||||
|
background-color: #fff;
|
||||||
|
width: 100%;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 999;
|
||||||
|
.tab-list {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
background-color: $bgColor;
|
||||||
|
padding: 6upx;
|
||||||
|
border-radius: 12upx;
|
||||||
|
.item {
|
||||||
|
flex: 1;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border-radius: 8upx;
|
||||||
|
.t {
|
||||||
|
color: $primarColor;
|
||||||
|
font-size: 28upx;
|
||||||
|
}
|
||||||
|
&.active {
|
||||||
|
background-color: $primarColor;
|
||||||
|
.t {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
96
pageMarket/packagePopularize/selectGoods.vue
Normal file
96
pageMarket/packagePopularize/selectGoods.vue
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
<template>
|
||||||
|
<view class="list">
|
||||||
|
<view class="item" v-for="item in list" :key="item.id" @click="selectGoods(item)">
|
||||||
|
<image class="cover" :src="item.coverImg" mode="aspectFill"></image>
|
||||||
|
<view class="info">
|
||||||
|
<text class="name">{{ item.name }}</text>
|
||||||
|
<text class="price">¥{{ returnPrice(item.skuList) }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
|
import { getProductList } from '@/http/api/product.js';
|
||||||
|
|
||||||
|
// 商品列表
|
||||||
|
const list = ref([]);
|
||||||
|
|
||||||
|
// 选择商品
|
||||||
|
function selectGoods(item) {
|
||||||
|
uni.setStorageSync('packageSelectGoods', {
|
||||||
|
id: item.id,
|
||||||
|
coverImg: item.coverImg,
|
||||||
|
name: item.name,
|
||||||
|
price: returnPrice(item.skuList)
|
||||||
|
});
|
||||||
|
uni.navigateBack();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回规格最高价
|
||||||
|
function returnPrice(skuList) {
|
||||||
|
return Math.max(...skuList.map((item) => item.salePrice));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取商品列表
|
||||||
|
async function getProductListAjax() {
|
||||||
|
try {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中...',
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
const res = await getProductList();
|
||||||
|
list.value = res;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
|
||||||
|
onLoad(() => {
|
||||||
|
getProductListAjax();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
page {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.list {
|
||||||
|
padding: 28upx;
|
||||||
|
.item {
|
||||||
|
padding: 28upx;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 20upx;
|
||||||
|
display: flex;
|
||||||
|
&:not(:first-child) {
|
||||||
|
margin-top: 28upx;
|
||||||
|
}
|
||||||
|
.cover {
|
||||||
|
$size: 120upx;
|
||||||
|
width: $size;
|
||||||
|
height: $size;
|
||||||
|
border-radius: 16upx;
|
||||||
|
}
|
||||||
|
.info {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12upx;
|
||||||
|
padding-left: 28upx;
|
||||||
|
.name {
|
||||||
|
font-size: 32upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.price {
|
||||||
|
font-size: 32upx;
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
528
pageMarket/packagePopularize/share.vue
Normal file
528
pageMarket/packagePopularize/share.vue
Normal file
@@ -0,0 +1,528 @@
|
|||||||
|
<!-- 套餐分享页 -->
|
||||||
|
<template>
|
||||||
|
<view class="color-333 u-font-28 min-page bg-f7" v-if="item.id">
|
||||||
|
<view class="relative">
|
||||||
|
<up-swiper height="428rpx" :list="item.images" @click="prveImg"></up-swiper>
|
||||||
|
<view class="share-box">
|
||||||
|
分享
|
||||||
|
<button class="share" open-type="share" @click="shareCallback">分享</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="sku">
|
||||||
|
<view class="u-flex u-col-center">
|
||||||
|
<text class="price">¥{{ item.price }}</text>
|
||||||
|
<text class="old-price">¥{{ item.originPrice }}</text>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
<view class="u-m-t-16 text" v-if="item.limitBuyNum">限购{{ item.limitBuyNum }}份</view>
|
||||||
|
<view class="text u-m-t-10">已售:{{ item.saleNum || 0 }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="goods">
|
||||||
|
<view class="goods-name">{{ item.packageName }}</view>
|
||||||
|
<view class="u-m-t-20 color-666">
|
||||||
|
{{ item.description }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="bg-f7" style="height: 32rpx"></view>
|
||||||
|
<view class="desc">
|
||||||
|
<view class="u-flex">
|
||||||
|
<view class="color-666 no-wrap" style="min-width: 180rpx">可核销门店:</view>
|
||||||
|
<view class="">{{ item.shopName }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-m-t-16 u-col-baseline">
|
||||||
|
<view class="color-666 no-wrap" style="min-width: 180rpx">门店地址:</view>
|
||||||
|
<view class="">{{ item.shopAddress }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- <template v-if="flase">
|
||||||
|
<view class="bg-f7" style="height: 32rpx"></view>
|
||||||
|
<view class="groups">
|
||||||
|
<view class="color-000 u-m-b-28 u-font-32 font-700">立即拼团</view>
|
||||||
|
<view class="item u-flex" v-for="(item, index) in item.gbOrderList" :key="index">
|
||||||
|
<up-avatar size="76rpx" :src="item.avatar"></up-avatar>
|
||||||
|
<view class="u-flex u-flex-1 u-p-l-22 u-col-center u-row-between">
|
||||||
|
<view>
|
||||||
|
<view class="color-000 u-line-1" style="max-width: 180rpx">{{ item.nickName }}</view>
|
||||||
|
<view class="main-color u-m-t-2">差{{ returnNeedPerpole(item) }}人拼成</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-22">
|
||||||
|
<text class="color-666">剩余:</text>
|
||||||
|
<text class="main-color">{{ getRemainingHMS(item) }}</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="btn" @click="fastBuy(item)">快速拼成</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template> -->
|
||||||
|
<view class="bg-f7" style="height: 24rpx"></view>
|
||||||
|
<view class="goods-group">
|
||||||
|
<view class="u-flex u-row-between">
|
||||||
|
<view class="name">套餐商品</view>
|
||||||
|
<view class="u-flex color-666" @click="showGroup = !showGroup" style="align-items: baseline">
|
||||||
|
<text class="u-m-r-18">{{ showGroup ? '收起' : '展开' }}</text>
|
||||||
|
<view class="guodu" :class="{ rotate: !showGroup }">
|
||||||
|
<up-icon name="arrow-down" bold></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="" v-if="showGroup">
|
||||||
|
<view class="u-m-t-48" v-for="(item, index) in item.packageContent" :key="index">
|
||||||
|
<view class="font-bold">
|
||||||
|
<text class="">{{ item.name }}</text>
|
||||||
|
<text class="u-m-l-30">{{ item.packageProducts.length }}选{{ item.num }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="">
|
||||||
|
<view class="u-flex u-m-t-24 u-row-between" v-for="(goods, goodsIndex) in item.packageProducts" :key="goodsIndex">
|
||||||
|
<text>{{ goods.name }}</text>
|
||||||
|
<view class="u-flex text-right">
|
||||||
|
<text class="color-666 u-m-r-42">x{{ goods.num }}</text>
|
||||||
|
<view style="min-width: 110rpx">¥{{ goods.price }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="desc" v-if="item.tieredDiscount && item.tieredDiscount.length > 0">
|
||||||
|
<view class="u-flex u-row-between">
|
||||||
|
<view class="name">分享说明</view>
|
||||||
|
<view class="u-flex color-666" @click="showDesc = !showDesc" style="align-items: baseline">
|
||||||
|
<text class="u-m-r-18">{{ showDesc ? '收起' : '展开' }}</text>
|
||||||
|
<view class="guodu" :class="{ rotate: !showDesc }">
|
||||||
|
<up-icon name="arrow-down" bold></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<template v-if="showDesc">
|
||||||
|
<view class="u-m-t-26 text-center table">
|
||||||
|
<view class="u-flex header color-666">
|
||||||
|
<view class="u-flex-1 u-p-t-32 u-p-b-32">分享人数</view>
|
||||||
|
<view class="u-flex-1 u-p-t-32 u-p-b-32">购买价格(元)</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex row" v-for="(step, index) in item.tieredDiscount" :key="index">
|
||||||
|
<view class="u-flex-1 u-p-t-32 u-p-b-32">{{ step.peopleNum }}</view>
|
||||||
|
<view class="u-flex-1 u-p-t-32 u-p-b-32">¥{{ step.price }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="u-m-t-26">
|
||||||
|
<view>分享期限(小时):{{ item.expireHours }}</view>
|
||||||
|
<view class="u-m-t-10">规定期限内的助力才会被计入</view>
|
||||||
|
<view class="u-m-t-40">如何才是分享成功?被分享人只需要点击《助力》,提示助力成功后即可</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
<view class="desc">
|
||||||
|
<view class="u-flex u-row-between">
|
||||||
|
<view class="name">使用说明</view>
|
||||||
|
<view class="u-flex color-666" @click="useDescShow = !useDescShow" style="align-items: baseline">
|
||||||
|
<text class="u-m-r-18">{{ useDescShow ? '收起' : '展开' }}</text>
|
||||||
|
<view class="guodu" :class="{ rotate: !useDescShow }">
|
||||||
|
<up-icon name="arrow-down" bold></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<template v-if="useDescShow">
|
||||||
|
<view class="u-m-t-16 color-666">
|
||||||
|
<view>1、可用时间段:{{ canuseTime }}</view>
|
||||||
|
<view v-if="item.otherDesc">2、其他使用说明:{{ item.otherDesc }}</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
<view class="goods-detail" v-if="item.goodsCategory != '优惠券'">
|
||||||
|
<view class="u-flex u-row-center">
|
||||||
|
<view class="title">商品详情</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<image class="w-full" v-for="(item, index) in item.detailImages" :key="index" mode="widthFix" :src="item"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<my-footer-btn confirmColor="#E3AD7F" confirmText="立即参加" @confirm="toMiniApp"></my-footer-btn>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { ref, computed, reactive } from 'vue';
|
||||||
|
import { onLoad, onShareAppMessage } from '@dcloudio/uni-app';
|
||||||
|
import { packageDetail } from '@/http/api/ware.js';
|
||||||
|
|
||||||
|
const showGroup = ref(true);
|
||||||
|
const showDesc = ref(true);
|
||||||
|
const useDescShow = ref(true);
|
||||||
|
|
||||||
|
const canuseTime = computed(() => {
|
||||||
|
return item.useWeeks.join('、') + ' ' + item.useTimes;
|
||||||
|
});
|
||||||
|
|
||||||
|
function prveImg(index) {
|
||||||
|
uni.previewImage({
|
||||||
|
urls: coverImgs.value,
|
||||||
|
current: index
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const query = reactive({
|
||||||
|
shopId: '',
|
||||||
|
id: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
const coverImgs = ref([]);
|
||||||
|
const item = reactive({
|
||||||
|
goodsDescription: []
|
||||||
|
});
|
||||||
|
|
||||||
|
function getDetail() {
|
||||||
|
packageDetail(query).then((res) => {
|
||||||
|
Object.assign(item, res);
|
||||||
|
coverImgs.value = res.images;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onLoad((options) => {
|
||||||
|
if (options.id) {
|
||||||
|
query.id = options.id;
|
||||||
|
query.shopId = options.shopId;
|
||||||
|
getDetail();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const path = '/pageMarket/packagePopularize/share';
|
||||||
|
const shareOptions = ref({
|
||||||
|
title: '',
|
||||||
|
path: '',
|
||||||
|
imageUrl: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
function shareCallback() {
|
||||||
|
shareOptions.value.title = item.packageName;
|
||||||
|
shareOptions.value.path = `${path}?shopId=${item.shopId}&id=${item.id}`;
|
||||||
|
shareOptions.value.imageUrl = item.images[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
onShareAppMessage(() => {
|
||||||
|
console.log('onShareAppMessage', shareOptions.value);
|
||||||
|
return shareOptions.value;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 跳转到用户小程序
|
||||||
|
function toMiniApp() {
|
||||||
|
uni.navigateToMiniProgram({
|
||||||
|
appId: 'wxd88fffa983758a30',
|
||||||
|
path: `/userPackage/goodsDetail/goodsDetail?id=${query.id}&shopId=${query.shopId}`,
|
||||||
|
envVersion: 'release', // 环境版本:release(正式版)、trial(体验版)、develop(开发版)
|
||||||
|
success: () => {},
|
||||||
|
fail: () => {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
$topHeight: 350rpx;
|
||||||
|
|
||||||
|
.top-img {
|
||||||
|
width: 750rpx;
|
||||||
|
height: $topHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top {
|
||||||
|
margin: 14rpx 18rpx;
|
||||||
|
background-size: cover;
|
||||||
|
height: $topHeight;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding-left: 70rpx;
|
||||||
|
padding-top: 95rpx;
|
||||||
|
|
||||||
|
.name {
|
||||||
|
color: #000000;
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info {
|
||||||
|
color: #333333;
|
||||||
|
font-size: 48rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
margin-top: 62rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.sku {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 20rpx 36rpx;
|
||||||
|
align-items: center;
|
||||||
|
background: linear-gradient(90deg, #ff4a63 0%, #fd1f48 100%);
|
||||||
|
|
||||||
|
.price {
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.old-price {
|
||||||
|
margin-left: 16rpx;
|
||||||
|
color: #e7e7e7;
|
||||||
|
opacity: 0.85;
|
||||||
|
font-weight: 700;
|
||||||
|
text-decoration: line-through;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
color: #fff;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods {
|
||||||
|
padding: 20rpx 28rpx;
|
||||||
|
background: #fff;
|
||||||
|
|
||||||
|
.goods-name {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.desc {
|
||||||
|
padding: 32rpx 28rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods-detail {
|
||||||
|
padding: 32rpx;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
position: relative;
|
||||||
|
padding: 0 22rpx;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '';
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
right: 100%;
|
||||||
|
width: 70rpx;
|
||||||
|
height: 2rpx;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
background: linear-gradient(90deg, #f7f8f9 0%, #c9cbcc 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
left: 100%;
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
display: block;
|
||||||
|
width: 70rpx;
|
||||||
|
height: 2rpx;
|
||||||
|
background: linear-gradient(90deg, #c9cbcc 0%, #f7f8f9 100%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fixed-bottom {
|
||||||
|
position: fixed;
|
||||||
|
left: 98rpx;
|
||||||
|
right: 98rpx;
|
||||||
|
padding-bottom: 30px;
|
||||||
|
padding-top: 32rpx;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 10;
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
padding: 22rpx;
|
||||||
|
border-radius: 200rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #fff;
|
||||||
|
width: 556rpx;
|
||||||
|
text-align: center;
|
||||||
|
background-color: #e8ad7b;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
|
||||||
|
&.gray {
|
||||||
|
background: #fff;
|
||||||
|
color: #e8ad7b;
|
||||||
|
border-color: #e8ad7b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.waring {
|
||||||
|
background-color: rgba(255, 204, 0, 0.09);
|
||||||
|
padding: 32rpx 24rpx;
|
||||||
|
color: #ff8d28;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-content {
|
||||||
|
font-size: 28rpx;
|
||||||
|
min-height: 300px;
|
||||||
|
|
||||||
|
.popup-content-top {
|
||||||
|
padding: 32rpx 28rpx;
|
||||||
|
border-bottom: 1px solid #ededed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods-info {
|
||||||
|
padding: 32rpx 28rpx;
|
||||||
|
border-bottom: 1px solid #ededed;
|
||||||
|
|
||||||
|
.cover {
|
||||||
|
width: 184rpx;
|
||||||
|
height: 184rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
background: #d9d9d9;
|
||||||
|
|
||||||
|
&.bg-fff {
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.price {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #ed5a2e;
|
||||||
|
line-height: 46rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.old-price {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #999;
|
||||||
|
text-decoration-line: line-through;
|
||||||
|
line-height: 48rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.limitBuyNum {
|
||||||
|
color: #666;
|
||||||
|
line-height: 42rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom {
|
||||||
|
padding: 20rpx;
|
||||||
|
border-bottom: 1px solid #ededed;
|
||||||
|
|
||||||
|
.price {
|
||||||
|
color: #ed5a2e;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
display: flex;
|
||||||
|
padding: 22rpx 214rpx;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 20rpx;
|
||||||
|
border-radius: 66rpx;
|
||||||
|
background: #e8ad7b;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 700;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.w-full {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.groups {
|
||||||
|
padding: 28rpx 22rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
padding: 28rpx 0;
|
||||||
|
border-bottom: 2rpx solid #ededed;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-color {
|
||||||
|
color: #ed5a2e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
padding: 8rpx 26rpx;
|
||||||
|
border-radius: 36rpx;
|
||||||
|
background: #e8ad7b;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.share-box {
|
||||||
|
top: 0;
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
padding: 4rpx 30rpx;
|
||||||
|
border-radius: 0 0 0 24rpx;
|
||||||
|
color: #ed5a2e;
|
||||||
|
font-weight: 700;
|
||||||
|
background: #fff;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.share {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods-group {
|
||||||
|
padding: 32rpx 46rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
|
||||||
|
.name {
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rotate {
|
||||||
|
transform: rotate(-90deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.desc {
|
||||||
|
padding: 32rpx 46rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
margin-top: 32rpx;
|
||||||
|
|
||||||
|
.name {
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table {
|
||||||
|
border: 2rpx solid #ededed;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
margin: 0 52rpx;
|
||||||
|
|
||||||
|
.header {
|
||||||
|
background: #f8f8f88f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row {
|
||||||
|
border-top: 2rpx solid #ededed;
|
||||||
|
|
||||||
|
&:first-child {
|
||||||
|
border-top: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.rotate {
|
||||||
|
transform: rotate(-90deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.guodu {
|
||||||
|
transition: all 0.3s;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
421
pageMarket/points/addProduct.vue
Normal file
421
pageMarket/points/addProduct.vue
Normal file
@@ -0,0 +1,421 @@
|
|||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<u-form ref="formRef" :model="form" :rules="rules" label-position="top">
|
||||||
|
<view class="card">
|
||||||
|
<u-form-item>
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">商品类型</text>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<u-radio-group v-model="form.goodsCategory">
|
||||||
|
<u-radio label="优惠券" name="优惠券"></u-radio>
|
||||||
|
<u-radio label="其它商品" name="其它商品"></u-radio>
|
||||||
|
</u-radio-group>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item prop="couponId" v-if="includesString(form.goodsCategory, '优惠券')">
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">选择优惠券</text>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<view class="ipt">
|
||||||
|
<my-select-coupon v-model="form.couponId"></my-select-coupon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item prop="goodsName">
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">商品名称</text>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<view class="ipt">
|
||||||
|
<u-input placeholder="请输入" :maxlength="30" v-model="form.goodsName"></u-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item prop="goodsImageUrl" v-if="includesString(form.goodsCategory, '其它商品')">
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">商品图片</text>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<my-upload-img v-model="form.goodsImageUrl"></my-upload-img>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item prop="requiredPoints">
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">所需积分</text>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<view class="ipt">
|
||||||
|
<u-input placeholder="请输入" :maxlength="8" v-model="form.requiredPoints" @change="requiredPointsInput">
|
||||||
|
<template #suffix>
|
||||||
|
<text>积分</text>
|
||||||
|
</template>
|
||||||
|
</u-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item>
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">额外价格</text>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<view class="ipt">
|
||||||
|
<u-input placeholder="请输入" :maxlength="8" v-model="form.extraPrice" @change="extraPriceInput">
|
||||||
|
<template #suffix>
|
||||||
|
<text>元</text>
|
||||||
|
</template>
|
||||||
|
</u-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item prop="quantity">
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">数量</text>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<view class="ipt">
|
||||||
|
<u-input placeholder="请输入" :maxlength="8" v-model="form.quantity" @change="quantityInput"></u-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item>
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">排序值</text>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<view class="ipt">
|
||||||
|
<u-input placeholder="请输入" :maxlength="8" v-model="form.sort" @change="sortInput"></u-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item prop="limitQuota">
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">每人限购</text>
|
||||||
|
<u-switch v-model="isLimitQuota" :active-value="1" :inactive-value="0" @change="isLimitQuotaChange"></u-switch>
|
||||||
|
</view>
|
||||||
|
<view class="info" v-if="isLimitQuota == 1">
|
||||||
|
<view class="ipt">
|
||||||
|
<u-input placeholder="请输入限购数量" :maxlength="8" v-model="form.limitQuota" @change="limitQuotaInput"></u-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item prop="limitQuota">
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">发放方式</text>
|
||||||
|
<text class="intro">
|
||||||
|
<template class="tips" v-if="includesString(form.goodsCategory, '优惠券')">系统发放</template>
|
||||||
|
<template class="tips" v-if="includesString(form.goodsCategory, '其它商品')">需要用户到店内领取核销</template>
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
</view>
|
||||||
|
<view class="card" v-if="includesString(form.goodsCategory, '其它商品')">
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">商品图片</text>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<my-upload-imgs v-model="imgs"></my-upload-imgs>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="card">
|
||||||
|
<u-form-item prop="limitQuota">
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">是否上架</text>
|
||||||
|
<u-switch v-model="form.status" :active-value="1" :inactive-value="0"></u-switch>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
</view>
|
||||||
|
</u-form>
|
||||||
|
<my-footer-btn type="horizontal" showCancel @confirm="submitHandle" @cancel="backHandle"></my-footer-btn>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
|
import { pointsGoodsPost, pointsGoodsDetail } from '@/http/api/market/point.js';
|
||||||
|
import { includesString, filterNumberInput } from '@/utils/index.js';
|
||||||
|
|
||||||
|
const formRef = ref(null);
|
||||||
|
const isLimitQuota = ref(0);
|
||||||
|
const imgs = ref([]);
|
||||||
|
const form = ref({
|
||||||
|
id: '',
|
||||||
|
goodsCategory: '优惠券', // 商品类型 优惠券 其它商品
|
||||||
|
couponId: '', // 优惠券id
|
||||||
|
goodsName: '', // 商品名称/优惠券名称
|
||||||
|
goodsImageUrl: '', // 商品图片URL
|
||||||
|
requiredPoints: '', // 所需积分
|
||||||
|
extraPrice: '', // 额外价格
|
||||||
|
quantity: '', // 数量
|
||||||
|
sort: 0,
|
||||||
|
status: 1, // 是否上架 1-是 0-否
|
||||||
|
receiveType: '', // 领取方式 店内自取、系统发放
|
||||||
|
limitQuota: '', // 限购数量
|
||||||
|
goodsDescription: '' // 商品详情
|
||||||
|
});
|
||||||
|
|
||||||
|
function backHandle() {
|
||||||
|
uni.navigateBack();
|
||||||
|
}
|
||||||
|
|
||||||
|
function isLimitQuotaChange() {
|
||||||
|
form.value.limitQuota = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
const rules = ref({
|
||||||
|
couponId: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
trigger: ['blur'],
|
||||||
|
message: '请选择优惠券',
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (form.value.couponId === '') {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
goodsName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
trigger: ['blur'],
|
||||||
|
message: '请输入',
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (form.value.goodsName === '') {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
goodsImageUrl: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
trigger: ['change'],
|
||||||
|
message: '请上传商品封面图',
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (form.value.goodsImageUrl === '') {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
requiredPoints: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
trigger: ['blur'],
|
||||||
|
message: '请输入',
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (form.value.requiredPoints < 0 || form.value.requiredPoints === '') {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
quantity: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
trigger: ['blur'],
|
||||||
|
message: '请输入',
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (form.value.quantity < 0 || form.value.quantity === '') {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
limitQuota: [
|
||||||
|
{
|
||||||
|
trigger: ['blur'],
|
||||||
|
message: '请输入限购数量',
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (isLimitQuota.value == 1 && form.value.limitQuota === '') {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
function requiredPointsInput(e) {
|
||||||
|
setTimeout(() => {
|
||||||
|
form.value.requiredPoints = filterNumberInput(e, 1);
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
function extraPriceInput(e) {
|
||||||
|
setTimeout(() => {
|
||||||
|
form.value.extraPrice = filterNumberInput(e);
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
function quantityInput(e) {
|
||||||
|
setTimeout(() => {
|
||||||
|
form.value.quantity = filterNumberInput(e, 1);
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sortInput(e) {
|
||||||
|
setTimeout(() => {
|
||||||
|
form.value.sort = filterNumberInput(e, 1);
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
function limitQuotaInput(e) {
|
||||||
|
setTimeout(() => {
|
||||||
|
form.value.limitQuota = filterNumberInput(e, 1);
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交
|
||||||
|
function submitHandle() {
|
||||||
|
formRef.value
|
||||||
|
.validate()
|
||||||
|
.then(async () => {
|
||||||
|
try {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '保存中...',
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
const data = { ...form.value };
|
||||||
|
if (imgs.value.length > 0) {
|
||||||
|
data.goodsDescription = JSON.stringify(imgs.value);
|
||||||
|
}
|
||||||
|
await pointsGoodsPost(data);
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '保存成功',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}, 300);
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateBack();
|
||||||
|
}, 1000);
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
uni.hideLoading();
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 积分:商品:详情
|
||||||
|
async function pointsGoodsDetailAjax() {
|
||||||
|
try {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中...',
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
const obj = await pointsGoodsDetail(form.value.id);
|
||||||
|
form.value = obj;
|
||||||
|
if (obj.goodsDescription !== '') {
|
||||||
|
imgs.value = JSON.parse(obj.goodsDescription);
|
||||||
|
}
|
||||||
|
if (obj.limitQuota !== '' && obj.limitQuota !== null) {
|
||||||
|
isLimitQuota.value = 1;
|
||||||
|
} else {
|
||||||
|
isLimitQuota.value = 0;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
|
||||||
|
onLoad((options) => {
|
||||||
|
if (options.id) {
|
||||||
|
form.value.id = options.id;
|
||||||
|
uni.setNavigationBarTitle({
|
||||||
|
title: '编辑商品'
|
||||||
|
});
|
||||||
|
pointsGoodsDetailAjax();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
page {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.container {
|
||||||
|
padding: 28upx;
|
||||||
|
}
|
||||||
|
.card {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 20px;
|
||||||
|
padding: 28upx;
|
||||||
|
&:not(:last-child) {
|
||||||
|
margin-bottom: 28upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.switch-wrap {
|
||||||
|
flex: 1;
|
||||||
|
width: 100%;
|
||||||
|
.top {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
.t {
|
||||||
|
font-size: 32upx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.info {
|
||||||
|
padding-top: 16upx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16upx;
|
||||||
|
.i {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.ipt {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.t {
|
||||||
|
font-size: 24upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
142
pageMarket/points/components/coupon-icon.vue
Normal file
142
pageMarket/points/components/coupon-icon.vue
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
<!-- 优惠券图标 -->
|
||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<view class="icon icon1" v-if="props.item[props.typeKey] == 1">
|
||||||
|
<view class="top">
|
||||||
|
<text class="i">¥</text>
|
||||||
|
<text class="num">{{ props.item.discountAmount }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="intro">
|
||||||
|
<text class="t">满{{ props.item.fullAmount }}可用</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="icon icon2" v-if="props.item[props.typeKey] == 2">
|
||||||
|
<view class="top">
|
||||||
|
<text class="i">{{ props.item.discountNum }}件</text>
|
||||||
|
<text class="num">商品兑换</text>
|
||||||
|
</view>
|
||||||
|
<view class="intro">
|
||||||
|
<text class="t">满{{ props.item.fullAmount }}可用</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="icon icon3" v-if="props.item[props.typeKey] == 3">
|
||||||
|
<view class="top">
|
||||||
|
<text class="num">{{ props.item.discountRate / 10 }}折</text>
|
||||||
|
</view>
|
||||||
|
<view class="intro">
|
||||||
|
<text class="t">满{{ props.item.fullAmount }}可用</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="icon icon2" v-if="props.item[props.typeKey] == 4">
|
||||||
|
<view class="top">
|
||||||
|
<text class="i">第二件</text>
|
||||||
|
<text class="num">半价券</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="icon icon2" v-if="props.item[props.typeKey] == 6">
|
||||||
|
<view class="top">
|
||||||
|
<text class="i">买一送</text>
|
||||||
|
<text class="num">一券</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
const props = defineProps({
|
||||||
|
item: {
|
||||||
|
type: Object,
|
||||||
|
default: {}
|
||||||
|
},
|
||||||
|
typeKey: {
|
||||||
|
type: String,
|
||||||
|
default: 'type'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
$color: #ff1c1c;
|
||||||
|
|
||||||
|
.container {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
&.icon1 {
|
||||||
|
.top {
|
||||||
|
.i {
|
||||||
|
color: $color;
|
||||||
|
font-size: 24upx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.num {
|
||||||
|
color: $color;
|
||||||
|
font-size: 72upx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.icon2 {
|
||||||
|
.top {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
.i {
|
||||||
|
color: $color;
|
||||||
|
font-size: 34upx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.num {
|
||||||
|
color: $color;
|
||||||
|
font-size: 34upx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.icon3 {
|
||||||
|
.top {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
.i {
|
||||||
|
color: $color;
|
||||||
|
font-size: 34upx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.num {
|
||||||
|
color: $color;
|
||||||
|
font-size: 52upx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.intro {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
.t {
|
||||||
|
font-size: 22upx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
337
pageMarket/points/components/productPage.vue
Normal file
337
pageMarket/points/components/productPage.vue
Normal file
@@ -0,0 +1,337 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="list">
|
||||||
|
<view class="item" v-for="item in listData.list" :key="item.id">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">排序值:{{ item.sort }}</text>
|
||||||
|
<view class="quantity" @click="showEdtorQuantityHandle(item)">
|
||||||
|
<text class="t">库存:{{ item.quantity }}</text>
|
||||||
|
<u-icon name="edit-pen" color="#999"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="goods-wrap">
|
||||||
|
<view class="left">
|
||||||
|
<view class="icon" v-if="includesString(item.goodsCategory, '其它商品')">
|
||||||
|
<image class="img" :src="item.goodsImageUrl" mode="aspectFill"></image>
|
||||||
|
</view>
|
||||||
|
<view class="icon border" v-if="includesString(item.goodsCategory, '优惠券')">
|
||||||
|
<couponIcon :item="item.couponInfo" typeKey="couponType" v-if="item.couponInfo" />
|
||||||
|
</view>
|
||||||
|
<view class="info-wrap">
|
||||||
|
<text class="name">{{ item.goodsName }}</text>
|
||||||
|
<text class="num">{{ item.requiredPoints }}积分 + {{ item.extraPrice || 0 }}元</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="status-wrap">
|
||||||
|
<u-switch v-model="item.status" :active-value="1" :inactive-value="0" @change="statusChange($event, item)"></u-switch>
|
||||||
|
<text class="t">
|
||||||
|
<template v-if="item.status == 0">上架</template>
|
||||||
|
<template v-if="item.status == 1">下架</template>
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="footer-wrap">
|
||||||
|
<view class="btn">
|
||||||
|
<u-button shape="circle" @click="delHandle(item)">删除</u-button>
|
||||||
|
</view>
|
||||||
|
<view class="btn">
|
||||||
|
<u-button type="primary" shape="circle" @click="toEditor(item)">编辑</u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<u-loadmore :status="listData.status"></u-loadmore>
|
||||||
|
<u-popup :show="showEdtorQuantity" mode="center" :safeAreaInsetBottom="false" @close="showEdtorQuantity = false">
|
||||||
|
<view class="quantity-wrap">
|
||||||
|
<view class="title">
|
||||||
|
<text class="t">修改库存</text>
|
||||||
|
</view>
|
||||||
|
<view class="form-content">
|
||||||
|
<u-form :model="quantityItem" :rules="quantityFormRules">
|
||||||
|
<u-form-item label="数量">
|
||||||
|
<u-input v-model="quantityItem.quantity" placeholder="请输入数量" @change="quantityInput" clearable></u-input>
|
||||||
|
</u-form-item>
|
||||||
|
</u-form>
|
||||||
|
</view>
|
||||||
|
<view class="quantity-footer">
|
||||||
|
<view class="btn">
|
||||||
|
<u-button style="width: 100%" shape="circle" @click="showEdtorQuantity = false">取消</u-button>
|
||||||
|
</view>
|
||||||
|
<view class="btn">
|
||||||
|
<u-button type="primary" style="width: 100%" shape="circle" @click="submitQuntity">确认</u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, onMounted, reactive } from 'vue';
|
||||||
|
import { onReachBottom } from '@dcloudio/uni-app';
|
||||||
|
import { pointsGoodsPage, pointsGoodsPost, pointsGoodsDel } from '@/http/api/market/point.js';
|
||||||
|
import { filterNumberInput, includesString } from '@/utils/index.js';
|
||||||
|
import couponIcon from './coupon-icon.vue';
|
||||||
|
|
||||||
|
const listData = reactive({
|
||||||
|
page: 1,
|
||||||
|
size: 10,
|
||||||
|
status: 'loading',
|
||||||
|
list: []
|
||||||
|
});
|
||||||
|
|
||||||
|
function reachBottom() {
|
||||||
|
if (listData.status != 'nomore') {
|
||||||
|
listData.page++;
|
||||||
|
pointsGoodsPageAjax();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 积分:商品:列表
|
||||||
|
async function pointsGoodsPageAjax(page = listData.page, isPull = false) {
|
||||||
|
try {
|
||||||
|
const res = await pointsGoodsPage({
|
||||||
|
page: page,
|
||||||
|
size: listData.size
|
||||||
|
});
|
||||||
|
|
||||||
|
if (listData.page == 1) {
|
||||||
|
listData.list = res.records;
|
||||||
|
} else {
|
||||||
|
listData.list.push(...res.records);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res.pageNumber >= res.totalPage) {
|
||||||
|
listData.status = 'nomore';
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
if (isPull) {
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '刷新成功',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 状态修改
|
||||||
|
function statusChange(e, item) {
|
||||||
|
pointsGoodsPostAjax(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 积分:商品:新增/修改
|
||||||
|
async function pointsGoodsPostAjax(item) {
|
||||||
|
try {
|
||||||
|
await pointsGoodsPost(item);
|
||||||
|
pointsGoodsPageAjax();
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 显示修改库存
|
||||||
|
const quantityItem = ref({});
|
||||||
|
const showEdtorQuantity = ref(false);
|
||||||
|
const quantityFormRules = ref({
|
||||||
|
quantity: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
trigger: ['blur'],
|
||||||
|
message: '请输入',
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (quantityItem.value.quantity < 0 || quantityItem.value.quantity === '') {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
function quantityInput(e) {
|
||||||
|
setTimeout(() => {
|
||||||
|
quantityItem.value.quantity = filterNumberInput(e, 1);
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
function showEdtorQuantityHandle(item) {
|
||||||
|
quantityItem.value = { ...item };
|
||||||
|
showEdtorQuantity.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交库存修改
|
||||||
|
async function submitQuntity() {
|
||||||
|
try {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '保存中...',
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
await pointsGoodsPost(quantityItem.value);
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '保存成功',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}, 300);
|
||||||
|
pointsGoodsPageAjax();
|
||||||
|
showEdtorQuantity.value = false;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
function delHandle(item) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '注意',
|
||||||
|
content: `确认要删除${item.goodsName}商品吗?`,
|
||||||
|
success: async (res) => {
|
||||||
|
try {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '删除中...',
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
await pointsGoodsDel(item.id);
|
||||||
|
uni.showToast({
|
||||||
|
title: '已删除',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
let index = listData.list.findIndex((val) => val.id == item.id);
|
||||||
|
listData.list.splice(index, 1);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function toEditor(item) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pageMarket/points/addProduct?id=${item.id}`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
reachBottom,
|
||||||
|
pointsGoodsPageAjax
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
pointsGoodsPageAjax();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.list {
|
||||||
|
padding-bottom: 28upx;
|
||||||
|
.item {
|
||||||
|
border-radius: 16upx;
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 28upx;
|
||||||
|
&:not(:first-child) {
|
||||||
|
margin-top: 28upx;
|
||||||
|
}
|
||||||
|
.top {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 44upx;
|
||||||
|
.t {
|
||||||
|
font-size: 24upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.quantity {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.goods-wrap {
|
||||||
|
display: flex;
|
||||||
|
padding: 28upx 0;
|
||||||
|
.left {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.icon {
|
||||||
|
$size: 180upx;
|
||||||
|
width: $size;
|
||||||
|
height: $size;
|
||||||
|
&.border {
|
||||||
|
border: 1px solid #ececec;
|
||||||
|
border-radius: 16upx;
|
||||||
|
padding: 16upx;
|
||||||
|
}
|
||||||
|
.img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 16upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.info-wrap {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 28upx;
|
||||||
|
padding-left: 20upx;
|
||||||
|
.name {
|
||||||
|
font-size: 28upx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.status-wrap {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 4upx;
|
||||||
|
.t {
|
||||||
|
font-size: 24upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.footer-wrap {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 28upx;
|
||||||
|
.btn {
|
||||||
|
width: 140upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.quantity-wrap {
|
||||||
|
width: 80vw;
|
||||||
|
.title {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 28upx;
|
||||||
|
.t {
|
||||||
|
font-size: 32upx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.form-content {
|
||||||
|
padding: 0 28upx;
|
||||||
|
}
|
||||||
|
.quantity-footer {
|
||||||
|
display: flex;
|
||||||
|
gap: 28upx;
|
||||||
|
padding: 28upx;
|
||||||
|
.btn {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
462
pageMarket/points/components/record.vue
Normal file
462
pageMarket/points/components/record.vue
Normal file
@@ -0,0 +1,462 @@
|
|||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<view class="tab-wrap" :style="{ top: `${top}px` }">
|
||||||
|
<view class="item" :class="{ active: tabsActive == index }" v-for="(item, index) in tabs" :key="index" @click="changeTabHandle(index)">
|
||||||
|
<text class="t">{{ item.label }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="list">
|
||||||
|
<view class="loader"></view>
|
||||||
|
<view class="item" v-for="item in listData.list" :key="item.id">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">{{ item.orderNo }}</text>
|
||||||
|
<u-tag :type="statusFilter(item.status).type" plain plainFill :text="item.status"></u-tag>
|
||||||
|
</view>
|
||||||
|
<view class="row">
|
||||||
|
<text class="name">用户:{{ item.nickName }} {{ item.phone }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="goods-wrap">
|
||||||
|
<view class="left">
|
||||||
|
<view class="icon" v-if="includesString(item.goodsCategory, '其它商品')">
|
||||||
|
<image class="img" :src="item.goodsImageUrl" mode="aspectFill"></image>
|
||||||
|
</view>
|
||||||
|
<view class="icon border" v-if="includesString(item.goodsCategory, '优惠券')">
|
||||||
|
<couponIcon :item="item.couponInfo" typeKey="couponType" v-if="item.couponInfo" />
|
||||||
|
</view>
|
||||||
|
<view class="info-wrap">
|
||||||
|
<text class="name">{{ item.pointsGoodsName }}</text>
|
||||||
|
<text class="num">x{{ item.number }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="status-wrap">
|
||||||
|
<text class="t">{{ item.spendPoints }}积分 + {{ item.extraPaymentAmount }}元</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="row">
|
||||||
|
<text class="t">下单时间:{{ item.createTime }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="row" v-if="item.checkoutTime">
|
||||||
|
<text class="t">核销时间:{{ item.checkoutTime }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="footer-wrap" v-if="includesString(item.status, '退款中') || includesString(item.status, '待核销')">
|
||||||
|
<view class="btn" v-if="includesString(item.status, '退款中')">
|
||||||
|
<u-button type="error" shape="circle" @click="refundCostHandle(item)">审核</u-button>
|
||||||
|
</view>
|
||||||
|
<view class="btn" v-if="includesString(item.status, '待核销')">
|
||||||
|
<u-button type="primary" shape="circle" @click="checkoutHandle(item)">核销</u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<u-loadmore :status="listData.status"></u-loadmore>
|
||||||
|
<u-popup :show="showRefundPopup" :round="20" mode="bottom" closeable @close="showRefundPopup = false">
|
||||||
|
<view class="refund-popup-content">
|
||||||
|
<view class="refund-popup-title">
|
||||||
|
<text class="t">退款审核</text>
|
||||||
|
</view>
|
||||||
|
<view class="form">
|
||||||
|
<u-form :model="refundForm" label-width="70" label-position="left">
|
||||||
|
<u-form-item label="是否同意">
|
||||||
|
<u-radio-group v-model="refundForm.type">
|
||||||
|
<u-radio label="同意" :name="1" :customStyle="{ marginRight: '15px' }"></u-radio>
|
||||||
|
<u-radio label="驳回" :name="0"></u-radio>
|
||||||
|
</u-radio-group>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="驳回原因" v-if="refundForm.type === 0">
|
||||||
|
<u-textarea type="textarea" v-model="refundForm.reason" placeholder="请输入驳回原因"></u-textarea>
|
||||||
|
</u-form-item>
|
||||||
|
</u-form>
|
||||||
|
</view>
|
||||||
|
<view class="dialog-footer">
|
||||||
|
<view class="btn">
|
||||||
|
<u-button @click="showRefundPopup = false" shape="circle" style="width: 100%">取消</u-button>
|
||||||
|
</view>
|
||||||
|
<div class="btn">
|
||||||
|
<u-button type="primary" shape="circle" @click="returnCostConfirmHandle" :loading="refundLoading" style="width: 100%">确认</u-button>
|
||||||
|
</div>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, reactive, onMounted } from 'vue';
|
||||||
|
import { goodsRecordPage, goodsRecordCkecout, goodsRecordAgreeRefund, goodsRecordRejectRefund } from '@/http/api/market/point.js';
|
||||||
|
import { includesString } from '@/utils/index.js';
|
||||||
|
import couponIcon from './coupon-icon.vue';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
top: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const tabsActive = ref(0);
|
||||||
|
|
||||||
|
const tabs = ref([
|
||||||
|
{
|
||||||
|
value: '',
|
||||||
|
label: '全部'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: '待核销',
|
||||||
|
label: '待核销'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: '已完成',
|
||||||
|
label: '已完成'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: '已退款',
|
||||||
|
label: '售后'
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
const statusList = ref([
|
||||||
|
{
|
||||||
|
label: '待支付',
|
||||||
|
type: 'info'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '待核销',
|
||||||
|
type: 'warning'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '已完成',
|
||||||
|
type: 'info'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '退款中',
|
||||||
|
type: 'error'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '已退款',
|
||||||
|
type: 'info'
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
function statusFilter(status) {
|
||||||
|
const obj = statusList.value.find((item) => item.label == status);
|
||||||
|
if (obj) {
|
||||||
|
return obj;
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
label: status,
|
||||||
|
type: 'info'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 切换tab
|
||||||
|
function changeTabHandle(index) {
|
||||||
|
tabsActive.value = index;
|
||||||
|
listData.status = 'loading';
|
||||||
|
listData.page = 1;
|
||||||
|
listData.list = [];
|
||||||
|
goodsRecordPageAjax();
|
||||||
|
}
|
||||||
|
|
||||||
|
const listData = reactive({
|
||||||
|
page: 1,
|
||||||
|
size: 10,
|
||||||
|
status: 'loading',
|
||||||
|
list: []
|
||||||
|
});
|
||||||
|
|
||||||
|
function reachBottom() {
|
||||||
|
if (listData.status != 'nomore') {
|
||||||
|
listData.page++;
|
||||||
|
goodsRecordPageAjax();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确认核销
|
||||||
|
function checkoutHandle(item) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '注意',
|
||||||
|
content: `确认要核销吗?`,
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
checkoutAjax(item.couponCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 核销请求
|
||||||
|
async function checkoutAjax(couponCode) {
|
||||||
|
try {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '核销中...',
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
await goodsRecordCkecout(couponCode);
|
||||||
|
goodsRecordPageAjax();
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '已核销',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}, 300);
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
|
||||||
|
const refundLoading = ref(false);
|
||||||
|
const showRefundPopup = ref(false);
|
||||||
|
const refundForm = ref({
|
||||||
|
type: 1,
|
||||||
|
recordId: '',
|
||||||
|
orderNo: '',
|
||||||
|
reason: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
// 显示退款操作
|
||||||
|
function refundCostHandle(row) {
|
||||||
|
refundForm.value.recordId = row.id;
|
||||||
|
refundForm.value.orderNo = row.orderNo;
|
||||||
|
showRefundPopup.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 退款操作
|
||||||
|
async function returnCostConfirmHandle() {
|
||||||
|
try {
|
||||||
|
refundLoading.value = true;
|
||||||
|
if (refundForm.value.type == 1) {
|
||||||
|
// 同意
|
||||||
|
await goodsRecordAgreeRefund(refundForm.value);
|
||||||
|
} else {
|
||||||
|
// 驳回
|
||||||
|
await goodsRecordRejectRefund(refundForm.value);
|
||||||
|
}
|
||||||
|
showRefundPopup.value = false;
|
||||||
|
uni.showToast({
|
||||||
|
title: '操作成功',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
goodsRecordPageAjax();
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
refundLoading.value = false;
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 积分:积分商品:兑换记录
|
||||||
|
async function goodsRecordPageAjax(page = listData.page, isPull = false) {
|
||||||
|
try {
|
||||||
|
const res = await goodsRecordPage({
|
||||||
|
page: page,
|
||||||
|
size: listData.size,
|
||||||
|
status: tabs.value[tabsActive.value].value
|
||||||
|
});
|
||||||
|
|
||||||
|
if (listData.page == 1) {
|
||||||
|
listData.list = res.records;
|
||||||
|
} else {
|
||||||
|
listData.list.push(...res.records);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res.pageNumber >= res.totalPage) {
|
||||||
|
listData.status = 'nomore';
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
if (isPull) {
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '刷新成功',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
reachBottom,
|
||||||
|
goodsRecordPageAjax,
|
||||||
|
checkoutAjax
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
goodsRecordPageAjax();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.loader {
|
||||||
|
width: 5px;
|
||||||
|
aspect-ratio: 1;
|
||||||
|
border-radius: 50%;
|
||||||
|
animation: l5 1s infinite linear alternate;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%) translateY(-80upx);
|
||||||
|
}
|
||||||
|
@keyframes l5 {
|
||||||
|
0% {
|
||||||
|
box-shadow: 20px 0 #000, -20px 0 #0002;
|
||||||
|
background: #000;
|
||||||
|
}
|
||||||
|
33% {
|
||||||
|
box-shadow: 20px 0 #000, -20px 0 #0002;
|
||||||
|
background: #0002;
|
||||||
|
}
|
||||||
|
66% {
|
||||||
|
box-shadow: 20px 0 #0002, -20px 0 #000;
|
||||||
|
background: #0002;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
box-shadow: 20px 0 #0002, -20px 0 #000;
|
||||||
|
background: #000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.container {
|
||||||
|
padding-top: 40px;
|
||||||
|
}
|
||||||
|
.tab-wrap {
|
||||||
|
$color: #318afe;
|
||||||
|
width: 100%;
|
||||||
|
height: 50px;
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
background-color: #fff;
|
||||||
|
display: flex;
|
||||||
|
z-index: 999;
|
||||||
|
.item {
|
||||||
|
flex: 1;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border-bottom: 1px solid #fff;
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
&.active {
|
||||||
|
border-bottom-color: $color;
|
||||||
|
.t {
|
||||||
|
color: $color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.list {
|
||||||
|
padding-bottom: 28upx;
|
||||||
|
position: relative;
|
||||||
|
.item {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 20upx;
|
||||||
|
padding: 28upx;
|
||||||
|
&:not(:first-child) {
|
||||||
|
margin-top: 28upx;
|
||||||
|
}
|
||||||
|
.top {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.row {
|
||||||
|
.name {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.t {
|
||||||
|
font-size: 24upx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.goods-wrap {
|
||||||
|
display: flex;
|
||||||
|
padding: 28upx 0;
|
||||||
|
.left {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.icon {
|
||||||
|
$size: 180upx;
|
||||||
|
width: $size;
|
||||||
|
height: $size;
|
||||||
|
&.border {
|
||||||
|
border: 1px solid #ececec;
|
||||||
|
border-radius: 16upx;
|
||||||
|
padding: 16upx;
|
||||||
|
}
|
||||||
|
.img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 16upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.info-wrap {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 28upx;
|
||||||
|
padding-left: 20upx;
|
||||||
|
.name {
|
||||||
|
font-size: 28upx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.status-wrap {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.t {
|
||||||
|
font-size: 32upx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer-wrap {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 28upx;
|
||||||
|
padding-top: 28upx;
|
||||||
|
.btn {
|
||||||
|
width: 180upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.refund-popup-content {
|
||||||
|
padding: 0 28upx;
|
||||||
|
.refund-popup-title {
|
||||||
|
padding: 28upx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
.t {
|
||||||
|
font-size: 32upx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.form {
|
||||||
|
padding: 28upx;
|
||||||
|
}
|
||||||
|
.dialog-footer {
|
||||||
|
display: flex;
|
||||||
|
gap: 28upx;
|
||||||
|
.btn {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
297
pageMarket/points/components/setting.vue
Normal file
297
pageMarket/points/components/setting.vue
Normal file
@@ -0,0 +1,297 @@
|
|||||||
|
<template>
|
||||||
|
<view class="form">
|
||||||
|
<u-form ref="formRef" :model="form" :rules="rules" label-width="200px" label-position="top">
|
||||||
|
<view class="card">
|
||||||
|
<u-form-item>
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">开启积分</text>
|
||||||
|
<u-switch v-model="form.enableRewards" :active-value="1" :inactive-value="0"></u-switch>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<text class="t">开启后,所有用户可通过消费获得积分及可用积分抵扣支付</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
</view>
|
||||||
|
<view class="card">
|
||||||
|
<u-form-item prop="consumeAmount">
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">消费送积分</text>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<text class="i">每消费</text>
|
||||||
|
<view class="ipt">
|
||||||
|
<u-input placeholder="请输入" :maxlength="8" v-model="form.consumeAmount" @change="consumeAmountInput">
|
||||||
|
<template #suffix>
|
||||||
|
<text>元</text>
|
||||||
|
</template>
|
||||||
|
</u-input>
|
||||||
|
</view>
|
||||||
|
<text class="i">获得1积分</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item prop="minPaymentAmount">
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">可抵扣门槛</text>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<view class="ipt">
|
||||||
|
<u-input placeholder="请输入" :maxlength="8" v-model="form.minPaymentAmount" @change="minPaymentAmountInput">
|
||||||
|
<template #suffix>
|
||||||
|
<text>元</text>
|
||||||
|
</template>
|
||||||
|
</u-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item prop="maxDeductionRatio">
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">最高抵扣比例</text>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<view class="ipt">
|
||||||
|
<u-input placeholder="请输入" :maxlength="8" v-model="form.maxDeductionRatio" @change="maxDeductionRatioInput">
|
||||||
|
<template #suffix>
|
||||||
|
<text>%</text>
|
||||||
|
</template>
|
||||||
|
</u-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item prop="equivalentPoints">
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">抵扣积分比例</text>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<text class="i">1元等于</text>
|
||||||
|
<view class="ipt">
|
||||||
|
<u-input placeholder="请输入" :maxlength="8" v-model="form.equivalentPoints" @change="equivalentPointsInput">
|
||||||
|
<template #suffix>
|
||||||
|
<text>积分</text>
|
||||||
|
</template>
|
||||||
|
</u-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
</view>
|
||||||
|
<view class="card">
|
||||||
|
<u-form-item>
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">开启积分商城</text>
|
||||||
|
<u-switch v-model="form.enablePointsMall" :active-value="1" :inactive-value="0"></u-switch>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
</view>
|
||||||
|
</u-form>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, onMounted } from 'vue';
|
||||||
|
import { filterNumberInput } from '@/utils/index.js';
|
||||||
|
import { pointsConfigPost, pointsConfigGet } from '@/http/api/market/point.js';
|
||||||
|
|
||||||
|
const formRef = ref(null);
|
||||||
|
const formObj = {
|
||||||
|
enableRewards: 0,
|
||||||
|
consumeAmount: '', // 每消费xx元赠送1积分
|
||||||
|
minPaymentAmount: '', // 下单实付抵扣门槛
|
||||||
|
maxDeductionRatio: 100, // 下单最高抵扣比例
|
||||||
|
equivalentPoints: '', // 下单抵扣积分比例 1元=?积分
|
||||||
|
enablePointsMall: 0 // 开启积分商城
|
||||||
|
};
|
||||||
|
const form = ref({ ...formObj });
|
||||||
|
|
||||||
|
const rules = ref({
|
||||||
|
consumeAmount: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
trigger: ['blur'],
|
||||||
|
message: '请输入',
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (form.value.consumeAmount < 0 || form.value.consumeAmount === '') {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
minPaymentAmount: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
trigger: ['blur'],
|
||||||
|
message: '请输入',
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (form.value.minPaymentAmount < 0 || form.value.minPaymentAmount === '') {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
maxDeductionRatio: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
trigger: ['blur'],
|
||||||
|
message: '请输入',
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (form.value.maxDeductionRatio < 0 || form.value.maxDeductionRatio === '') {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
equivalentPoints: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
trigger: ['blur'],
|
||||||
|
message: '请输入',
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (form.value.equivalentPoints < 0 || form.value.equivalentPoints === '') {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
function consumeAmountInput(e) {
|
||||||
|
setTimeout(() => {
|
||||||
|
form.value.consumeAmount = filterNumberInput(e);
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
function minPaymentAmountInput(e) {
|
||||||
|
setTimeout(() => {
|
||||||
|
form.value.minPaymentAmount = filterNumberInput(e);
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
function maxDeductionRatioInput(e) {
|
||||||
|
setTimeout(() => {
|
||||||
|
form.value.maxDeductionRatio = filterNumberInput(e, 1);
|
||||||
|
if (form.value.maxDeductionRatio > 100) {
|
||||||
|
form.value.maxDeductionRatio = 100;
|
||||||
|
}
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
function equivalentPointsInput(e) {
|
||||||
|
setTimeout(() => {
|
||||||
|
form.value.equivalentPoints = filterNumberInput(e, 1);
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交
|
||||||
|
function submitHandle() {
|
||||||
|
formRef.value
|
||||||
|
.validate()
|
||||||
|
.then(async () => {
|
||||||
|
try {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '保存中...',
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
await pointsConfigPost(form.value);
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '保存成功',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}, 300);
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
uni.hideLoading();
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取配置
|
||||||
|
async function pointsConfigGetAjax() {
|
||||||
|
try {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中...',
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
const res = await pointsConfigGet();
|
||||||
|
if (res == null || !res) {
|
||||||
|
form.value = { ...formObj };
|
||||||
|
} else {
|
||||||
|
form.value = res;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.hideLoading();
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
submitHandle
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
pointsConfigGetAjax();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.card {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 20px;
|
||||||
|
padding: 28upx;
|
||||||
|
&:not(:last-child) {
|
||||||
|
margin-bottom: 28upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.switch-wrap {
|
||||||
|
flex: 1;
|
||||||
|
width: 100%;
|
||||||
|
.top {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
.t {
|
||||||
|
font-size: 32upx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.info {
|
||||||
|
padding-top: 16upx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16upx;
|
||||||
|
.i {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.ipt {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.t {
|
||||||
|
font-size: 24upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
157
pageMarket/points/components/userRecord.vue
Normal file
157
pageMarket/points/components/userRecord.vue
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="list">
|
||||||
|
<view class="item" v-for="item in listData.list" :key="item.id">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">用户ID:{{ item.userId }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="user-info">
|
||||||
|
<view class="left">
|
||||||
|
<u-avatar :src="item.headImg" shape="square" :size="50"></u-avatar>
|
||||||
|
<view class="info">
|
||||||
|
<text class="t">{{ item.nickName }}</text>
|
||||||
|
<text class="t">{{ item.phone }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="right">
|
||||||
|
<text class="t1">当前积分</text>
|
||||||
|
<text class="t2">{{ item.pointBalance }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="footer-wrap">
|
||||||
|
<view class="btn" @click="toDetail(item)">
|
||||||
|
<u-text type="primary" text="查看明细"></u-text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<u-loadmore :status="listData.status"></u-loadmore>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, reactive, onMounted } from 'vue';
|
||||||
|
import { pointUserPage } from '@/http/api/market/point.js';
|
||||||
|
|
||||||
|
const listData = reactive({
|
||||||
|
page: 1,
|
||||||
|
size: 10,
|
||||||
|
status: 'loading',
|
||||||
|
list: []
|
||||||
|
});
|
||||||
|
|
||||||
|
function reachBottom() {
|
||||||
|
if (listData.status != 'nomore') {
|
||||||
|
listData.page++;
|
||||||
|
pointUserPageAjax();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取用户所有门店下积分列表
|
||||||
|
async function pointUserPageAjax(page = listData.page, isPull = false) {
|
||||||
|
try {
|
||||||
|
const res = await pointUserPage({
|
||||||
|
page: page,
|
||||||
|
size: listData.size
|
||||||
|
});
|
||||||
|
|
||||||
|
if (listData.page == 1) {
|
||||||
|
listData.list = res.records;
|
||||||
|
} else {
|
||||||
|
listData.list.push(...res.records);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res.pageNumber >= res.totalPage) {
|
||||||
|
listData.status = 'nomore';
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
if (isPull) {
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '刷新成功',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 去积分详情
|
||||||
|
function toDetail(item) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pageMarket/points/userPointDetail?id=${item.id}&nickName=${item.nickName}&phone=${item.phone}&point=${item.pointBalance}`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
reachBottom,
|
||||||
|
pointUserPageAjax
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
pointUserPageAjax();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.list {
|
||||||
|
padding-bottom: 28upx;
|
||||||
|
.item {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 20upx;
|
||||||
|
padding: 28upx;
|
||||||
|
&:not(:first-child) {
|
||||||
|
margin-top: 28upx;
|
||||||
|
}
|
||||||
|
.top {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.user-info {
|
||||||
|
display: flex;
|
||||||
|
padding: 28upx 0;
|
||||||
|
.left {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
.info {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
flex-direction: column;
|
||||||
|
padding-left: 10px;
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.right {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
.t1 {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.t2 {
|
||||||
|
color: #333;
|
||||||
|
font-size: 32upx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.footer-wrap {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
189
pageMarket/points/index.vue
Normal file
189
pageMarket/points/index.vue
Normal file
@@ -0,0 +1,189 @@
|
|||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<my-header-card
|
||||||
|
:options="{
|
||||||
|
name: '积分锁客',
|
||||||
|
intro: '下单可获得积分,再次下单可使用积分抵扣',
|
||||||
|
icon: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/11e5482336a94c2a91a10e2bf289126e.png'
|
||||||
|
}"
|
||||||
|
@load="(e) => (headHeight = e.height)"
|
||||||
|
></my-header-card>
|
||||||
|
<view class="content">
|
||||||
|
<setting ref="settingRef" name="setting" key="setting" v-if="tabsActive == 0" />
|
||||||
|
<productPage ref="productPageRef" name="productPage" key="productPage" v-if="tabsActive == 1" />
|
||||||
|
<record ref="recordRef" name="record" key="record" :top="headHeight + 54" v-if="tabsActive == 2" />
|
||||||
|
<userRecord ref="userRecordRef" name="userRecord" key="userRecord" v-if="tabsActive == 3" />
|
||||||
|
</view>
|
||||||
|
<view class="tab-wrap" :style="{ top: `${headHeight}px` }">
|
||||||
|
<view class="tab-list">
|
||||||
|
<view class="item" v-for="(item, index) in tabs" :class="{ active: tabsActive == index }" :key="item.value" @click="tabClickHandle(item, index)">
|
||||||
|
<text class="t">{{ item.label }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<my-footer-btn type="horizontal" showCancel @confirm="settingRef.submitHandle()" @cancel="backHandle" v-if="tabsActive == 0"></my-footer-btn>
|
||||||
|
<my-footer-btn confirmText="添加商品" type="horizontal" @confirm="toAddProduct" v-if="tabsActive == 1"></my-footer-btn>
|
||||||
|
<my-footer-btn confirmText="扫码核销" v-if="tabsActive == 2" @confirm="scanHandle"></my-footer-btn>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, reactive } from 'vue';
|
||||||
|
import { onLoad, onShow, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app';
|
||||||
|
import setting from './components/setting.vue';
|
||||||
|
import productPage from './components/productPage.vue';
|
||||||
|
import record from './components/record.vue';
|
||||||
|
import userRecord from './components/userRecord.vue';
|
||||||
|
|
||||||
|
const settingRef = ref(null);
|
||||||
|
const productPageRef = ref(null);
|
||||||
|
const recordRef = ref(null);
|
||||||
|
const userRecordRef = ref(null);
|
||||||
|
|
||||||
|
const headHeight = ref(0);
|
||||||
|
const tabsActive = ref(0);
|
||||||
|
const tabs = ref([
|
||||||
|
{
|
||||||
|
value: 1,
|
||||||
|
label: '基础设置'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 2,
|
||||||
|
label: '商品设置'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 3,
|
||||||
|
label: '兑换记录'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 4,
|
||||||
|
label: '用户积分'
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
function tabClickHandle(item, index) {
|
||||||
|
tabsActive.value = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
function backHandle() {
|
||||||
|
uni.navigateBack();
|
||||||
|
}
|
||||||
|
|
||||||
|
function toAddProduct() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pageMarket/points/addProduct'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 扫码核销
|
||||||
|
function scanHandle() {
|
||||||
|
uni.scanCode({
|
||||||
|
success: (res) => {
|
||||||
|
console.log('扫码核销===', res.result);
|
||||||
|
recordRef.value.checkoutAjax(res.result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 下拉刷新
|
||||||
|
onPullDownRefresh(() => {
|
||||||
|
switch (tabsActive.value) {
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
productPageRef.value.pointsGoodsPageAjax(1, true);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
recordRef.value.goodsRecordPageAjax(1, true);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
userRecordRef.value.pointUserPageAjax(1, true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
onReachBottom(() => {
|
||||||
|
switch (tabsActive.value) {
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
productPageRef.value.reachBottom();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
recordRef.value.reachBottom();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
userRecordRef.value.reachBottom();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
onShow(() => {
|
||||||
|
switch (tabsActive.value) {
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
productPageRef.value.pointsGoodsPageAjax(1);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
recordRef.value.goodsRecordPageAjax(1);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
page {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
$bgColor: #e6f0ff;
|
||||||
|
$primarColor: #318afe;
|
||||||
|
.content {
|
||||||
|
padding: calc(54px + 28upx) 28upx 28upx;
|
||||||
|
}
|
||||||
|
.tab-wrap {
|
||||||
|
height: 54px;
|
||||||
|
padding: 10px 14px;
|
||||||
|
background-color: #fff;
|
||||||
|
width: 100%;
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
z-index: 999;
|
||||||
|
.tab-list {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
background-color: $bgColor;
|
||||||
|
padding: 6upx;
|
||||||
|
border-radius: 12upx;
|
||||||
|
.item {
|
||||||
|
flex: 1;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border-radius: 8upx;
|
||||||
|
.t {
|
||||||
|
color: $primarColor;
|
||||||
|
font-size: 28upx;
|
||||||
|
}
|
||||||
|
&.active {
|
||||||
|
background-color: $primarColor;
|
||||||
|
.t {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
180
pageMarket/points/userPointDetail.vue
Normal file
180
pageMarket/points/userPointDetail.vue
Normal file
@@ -0,0 +1,180 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="header-wrap">
|
||||||
|
<view class="item">
|
||||||
|
<text class="t">{{ listData.nickName }} {{ listData.phone }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<text class="t">当前积分 {{ listData.point }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="list">
|
||||||
|
<view class="item" v-for="item in listData.list" :key="item.id">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">{{ item.content }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="user-info">
|
||||||
|
<view class="left">
|
||||||
|
<view class="info">
|
||||||
|
<text class="t1">{{ item.shopName }}</text>
|
||||||
|
<text class="t2">{{ item.createTime }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="right">
|
||||||
|
<text class="t1">{{ item.floatPoints }}</text>
|
||||||
|
<text class="t2">变动后积分:{{ item.balancePoints }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<u-loadmore :status="listData.status"></u-loadmore>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { reactive } from 'vue';
|
||||||
|
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
||||||
|
import { pointUserRecord } from '@/http/api/market/point.js';
|
||||||
|
|
||||||
|
const listData = reactive({
|
||||||
|
nickName: '',
|
||||||
|
phone: '',
|
||||||
|
id: '',
|
||||||
|
point: '',
|
||||||
|
page: 1,
|
||||||
|
size: 10,
|
||||||
|
status: 'loading',
|
||||||
|
list: []
|
||||||
|
});
|
||||||
|
|
||||||
|
onReachBottom(() => {
|
||||||
|
if (listData.status != 'nomore') {
|
||||||
|
listData.page++;
|
||||||
|
pointUserRecordAjax();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 获取用户所有门店下积分列表
|
||||||
|
async function pointUserRecordAjax() {
|
||||||
|
try {
|
||||||
|
const res = await pointUserRecord({
|
||||||
|
page: listData.page,
|
||||||
|
size: listData.size,
|
||||||
|
id: listData.id
|
||||||
|
});
|
||||||
|
|
||||||
|
if (listData.page == 1) {
|
||||||
|
listData.list = res.records;
|
||||||
|
} else {
|
||||||
|
listData.list.push(...res.records);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res.pageNumber >= res.totalPage) {
|
||||||
|
listData.status = 'nomore';
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onLoad((options) => {
|
||||||
|
listData.id = options.id;
|
||||||
|
listData.nickName = options.nickName;
|
||||||
|
listData.phone = options.phone;
|
||||||
|
listData.point = options.point;
|
||||||
|
pointUserRecordAjax();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
page {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.header-wrap {
|
||||||
|
width: 100%;
|
||||||
|
height: 53px;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 999;
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 0 28upx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
.item {
|
||||||
|
flex: 1;
|
||||||
|
&:last-child {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.list {
|
||||||
|
padding: calc(53px + 28upx) 28upx 28upx;
|
||||||
|
.item {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 20upx;
|
||||||
|
padding: 28upx;
|
||||||
|
&:not(:first-child) {
|
||||||
|
margin-top: 28upx;
|
||||||
|
}
|
||||||
|
.top {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
.t {
|
||||||
|
font-size: 32upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.user-info {
|
||||||
|
display: flex;
|
||||||
|
padding: 28upx 0;
|
||||||
|
.left {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
.info {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
flex-direction: column;
|
||||||
|
.t1 {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.t2 {
|
||||||
|
font-size: 24upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.right {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
.t1 {
|
||||||
|
font-size: 32upx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.t2 {
|
||||||
|
color: #666;
|
||||||
|
font-size: 24upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.footer-wrap {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
File diff suppressed because it is too large
Load Diff
95
pages.json
95
pages.json
@@ -257,6 +257,13 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "添加临时菜"
|
"navigationBarTitleText": "添加临时菜"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "stick/stick",
|
||||||
|
"pageId": "PAGES_CREATE_ORDER_STICK",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "编辑"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -533,6 +540,12 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "账单付款记录"
|
"navigationBarTitleText": "账单付款记录"
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
"pageId": "PAGES_BATCH_IN",
|
||||||
|
"path": "batch_in",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "批量入库"
|
||||||
|
}
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -808,9 +821,85 @@
|
|||||||
"style": {
|
"style": {
|
||||||
// "navigationBarTitleText": "添加会员等级"
|
// "navigationBarTitleText": "添加会员等级"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pageId": "PAGES_MARKET_POINTS_INDEX",
|
||||||
|
"path": "points/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "积分锁客",
|
||||||
|
"enablePullDownRefresh": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pageId": "PAGES_MARKET_POINTS_ADD_PRODUCT",
|
||||||
|
"path": "points/addProduct",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "添加商品"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pageId": "PAGES_MARKET_POINTS_USER_POINT_DETAIL",
|
||||||
|
"path": "points/userPointDetail",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "查看明细"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pageId": "PAGES_MARKET_GROUP_GOODS_INDEX",
|
||||||
|
"path": "groupGoods/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "拼团商品"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pageId": "PAGES_MARKET_GROUP_GOODS_SHARE",
|
||||||
|
"path": "groupGoods/share",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "分享"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pageId": "PAGES_MARKET_GROUP_GOODS_ADDGOODS",
|
||||||
|
"path": "groupGoods/addGoods",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "添加商品"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pageId": "PAGES_MARKET_GROUP_GOODS_ADDGOODS",
|
||||||
|
"path": "groupGoods/selectGoods",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "选择商品"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pageId": "PAGES_MARKET_PACKAGE_POPULARIZE_INDEX",
|
||||||
|
"path": "packagePopularize/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "套餐推广"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pageId": "PAGES_MARKET_GROUP_GOODS_PACKAGE",
|
||||||
|
"path": "packagePopularize/addGoods",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "添加套餐"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pageId": "PAGES_MARKET_GROUP_GOODS_PACKAGE",
|
||||||
|
"path": "packagePopularize/selectGoods",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "选择商品"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pageId": "PAGES_MARKET_PACKAGE_POPULARIZE_SHARE",
|
||||||
|
"path": "packagePopularize/share",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "分享"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -861,7 +950,7 @@
|
|||||||
// "navigationBarTitleText": "查看优惠券"
|
// "navigationBarTitleText": "查看优惠券"
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// ]
|
// ]
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ const menuList = ref([
|
|||||||
{
|
{
|
||||||
title: '积分锁客',
|
title: '积分锁客',
|
||||||
icon: '',
|
icon: '',
|
||||||
pageUrl: '',
|
pageUrl: 'PAGES_MARKET_POINTS_INDEX',
|
||||||
intro: '设置充值消费的N倍,当前订单立即免单'
|
intro: '设置充值消费的N倍,当前订单立即免单'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -112,7 +112,7 @@ const menuList = ref([
|
|||||||
{
|
{
|
||||||
title: '套餐推广',
|
title: '套餐推广',
|
||||||
icon: '',
|
icon: '',
|
||||||
pageUrl: '',
|
pageUrl: 'PAGES_MARKET_PACKAGE_POPULARIZE_INDEX',
|
||||||
intro: '下单通过用户邀请好友减免金额的方式裂变宣传套餐加购'
|
intro: '下单通过用户邀请好友减免金额的方式裂变宣传套餐加购'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -135,7 +135,7 @@ const menuList = ref([
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: 'xszk',
|
icon: 'xszk',
|
||||||
pageUrl: 'PAGES_LIMIT_DISCOUNT',
|
pageUrl: 'PAGES_MARKET_GROUP_GOODS_INDEX',
|
||||||
title: '商品拼团',
|
title: '商品拼团',
|
||||||
intro: '拼团'
|
intro: '拼团'
|
||||||
}
|
}
|
||||||
@@ -219,21 +219,19 @@ const menuList = ref([
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
console.log(menusStore.adminPages);
|
|
||||||
|
// console.log(
|
||||||
|
// 'menusStore.adminPages===',
|
||||||
|
// menusStore.adminPages.map((item) => item.title)
|
||||||
|
// );
|
||||||
|
|
||||||
const computedMenus = computed(() => {
|
const computedMenus = computed(() => {
|
||||||
// const arr = menusStore.adminPages.filter((v) => {
|
|
||||||
// return navList.find((navItem) => navItem.title == v.title);
|
|
||||||
// });
|
|
||||||
return menuList.value.map((v) => {
|
return menuList.value.map((v) => {
|
||||||
v.menus = v.menus.filter((menu) => {
|
v.menus = v.menus.filter((menu) => {
|
||||||
const hasPermission = menusStore.adminPages.find((navItem) => navItem.title == menu.title);
|
const hasPermission = menusStore.adminPages.find((navItem) => navItem.title == menu.title);
|
||||||
console.log('hasPermission', hasPermission);
|
|
||||||
if (hasPermission) {
|
if (hasPermission) {
|
||||||
menu.icon = hasPermission.miniIcon;
|
menu.icon = hasPermission.miniIcon;
|
||||||
console.log(menu);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasPermission;
|
return hasPermission;
|
||||||
});
|
});
|
||||||
return v;
|
return v;
|
||||||
|
|||||||
@@ -23,11 +23,11 @@
|
|||||||
<view class="u-flex-1 u-p-l-30 u-text-left">
|
<view class="u-flex-1 u-p-l-30 u-text-left">
|
||||||
<view class="u-flex">
|
<view class="u-flex">
|
||||||
<view class="u-line-1 u-font-36 font-bold" style="width: 80%;">{{shopInfo.shopName}}</view>
|
<view class="u-line-1 u-font-36 font-bold" style="width: 80%;">{{shopInfo.shopName}}</view>
|
||||||
<view class="u-font-28 color-fff change-shop u-flex u-row-center" @click="changeShop">
|
<!-- <view class="u-font-28 color-fff change-shop u-flex u-row-center" @click="changeShop">
|
||||||
<image src="/static/change.png" class="u-m-t-2" style="width: 20rpx;height: 20rpx;"
|
<image src="/static/change.png" class="u-m-t-2" style="width: 20rpx;height: 20rpx;"
|
||||||
mode=""></image>
|
mode=""></image>
|
||||||
<text class="u-m-l-6">切换店铺</text>
|
<text class="u-m-l-6">切换店铺</text>
|
||||||
</view>
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="u-m-t-16">
|
<view class="u-m-t-16">
|
||||||
<view style="color: rgba(255,255,255,0.83);" v-if="shopStaff">
|
<view style="color: rgba(255,255,255,0.83);" v-if="shopStaff">
|
||||||
|
|||||||
@@ -94,6 +94,19 @@
|
|||||||
></up-switch>
|
></up-switch>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="page-cell m">
|
||||||
|
<view class="label">是否开启数签子</view>
|
||||||
|
<view class="right">
|
||||||
|
<up-switch
|
||||||
|
v-model="vdata.shopInfo.isCountStick"
|
||||||
|
size="20"
|
||||||
|
:inactiveValue="0"
|
||||||
|
:activeValue="1"
|
||||||
|
activeColor="#0FC161"
|
||||||
|
@change="switchChange('isCountStick')"
|
||||||
|
></up-switch>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<view class="page-cell m" style="display: block">
|
<view class="page-cell m" style="display: block">
|
||||||
<view class="u-flex u-row-between">
|
<view class="u-flex u-row-between">
|
||||||
<view class="label">点餐电子围栏</view>
|
<view class="label">点餐电子围栏</view>
|
||||||
@@ -449,6 +462,9 @@ let switchChange = (type) => {
|
|||||||
case "isOrderFence":
|
case "isOrderFence":
|
||||||
params.isOrderFence = vdata.shopInfo.isOrderFence;
|
params.isOrderFence = vdata.shopInfo.isOrderFence;
|
||||||
break;
|
break;
|
||||||
|
case "isCountStick":
|
||||||
|
params.isCountStick = vdata.shopInfo.isCountStick;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
updateShopInfo(params);
|
updateShopInfo(params);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -239,6 +239,7 @@
|
|||||||
discount_sale_amount: form.price, //数量
|
discount_sale_amount: form.price, //数量
|
||||||
pack_number: 0, //数量
|
pack_number: 0, //数量
|
||||||
is_gift: 0,
|
is_gift: 0,
|
||||||
|
remark:form.note,
|
||||||
is_temporary: 1, //是否是临时菜
|
is_temporary: 1, //是否是临时菜
|
||||||
}
|
}
|
||||||
websocketUtil.send(JSON.stringify(params))
|
websocketUtil.send(JSON.stringify(params))
|
||||||
@@ -247,6 +248,7 @@
|
|||||||
name: form.name,
|
name: form.name,
|
||||||
lowPrice: form.price,
|
lowPrice: form.price,
|
||||||
number: form.num,
|
number: form.num,
|
||||||
|
remark:form.note,
|
||||||
is_temporary: 1, //是否是临时菜
|
is_temporary: 1, //是否是临时菜
|
||||||
})
|
})
|
||||||
clearInterval(timer)
|
clearInterval(timer)
|
||||||
|
|||||||
@@ -169,6 +169,7 @@
|
|||||||
>
|
>
|
||||||
<image class="img" :src="item.coverImg" mode=""></image>
|
<image class="img" :src="item.coverImg" mode=""></image>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view
|
<view
|
||||||
style="
|
style="
|
||||||
background-color: #3f9eff;
|
background-color: #3f9eff;
|
||||||
@@ -180,7 +181,7 @@
|
|||||||
"
|
"
|
||||||
v-else
|
v-else
|
||||||
>
|
>
|
||||||
临时菜
|
{{ item.name }}
|
||||||
</view>
|
</view>
|
||||||
<view class="u-m-l-32">
|
<view class="u-m-l-32">
|
||||||
<view class="u-flex">
|
<view class="u-flex">
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
407
pagesCreateOrder/stick/stick.vue
Normal file
407
pagesCreateOrder/stick/stick.vue
Normal file
@@ -0,0 +1,407 @@
|
|||||||
|
<template>
|
||||||
|
<view class="min-page bg-f7 u-font-28 color-333 u-p-30">
|
||||||
|
<view v-for="(item,index) in list" :key="index" class="block">
|
||||||
|
<view class="font-bold u-font-32 ">序号{{index+1}}</view>
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<view class="font-bold u-m-b-14">单价</view>
|
||||||
|
<view class="u-flex ">
|
||||||
|
<up-input type="digit" placeholder="请输入单价" v-model="item.salePrice"
|
||||||
|
@blur="salePriceBlur(item)"></up-input>
|
||||||
|
<text class="u-m-l-24">元/根</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<view class="font-bold u-m-b-14">数量</view>
|
||||||
|
<up-input type="number" placeholder="请输入数量" v-model="item.number" @blur="numberBlur(item)"></up-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="bottom">
|
||||||
|
<view class="font-bold">
|
||||||
|
<text>合计:</text>
|
||||||
|
<text class="color-red">{{totalMoney}}元</text>
|
||||||
|
<text>/</text>
|
||||||
|
<text>{{totalNumber}}根</text>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex">
|
||||||
|
<view class="btn main" @click="chooseImage">继续拍照</view>
|
||||||
|
<view class="btn" @click="confirmOrder">下单</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
BigNumber
|
||||||
|
} from "bignumber.js";
|
||||||
|
import {
|
||||||
|
computed,
|
||||||
|
inject,
|
||||||
|
onUnmounted,
|
||||||
|
ref
|
||||||
|
} from 'vue';
|
||||||
|
import {
|
||||||
|
hasPermission
|
||||||
|
} from "@/commons/utils/hasPermission.js";
|
||||||
|
import {
|
||||||
|
stickCount
|
||||||
|
} from '@/http/api/product/stick.js'
|
||||||
|
import {
|
||||||
|
onLoad,
|
||||||
|
onShow,
|
||||||
|
onHide
|
||||||
|
} from '@dcloudio/uni-app'
|
||||||
|
import go from "@/commons/utils/go.js";
|
||||||
|
import {
|
||||||
|
createOrder,
|
||||||
|
getHistoryOrder
|
||||||
|
} from "@/http/api/order.js";
|
||||||
|
|
||||||
|
|
||||||
|
const websocketUtil = inject("websocketUtil"); // 注入 WebSocket 工具类实例
|
||||||
|
const totalMoney = computed(() => {
|
||||||
|
return list.value.reduce((prve, cur) => {
|
||||||
|
return prve.plus(BigNumber(cur.number || 0).times(cur.salePrice || 0))
|
||||||
|
}, BigNumber(0)).toNumber()
|
||||||
|
})
|
||||||
|
const totalNumber = computed(() => {
|
||||||
|
return list.value.reduce((prve, cur) => {
|
||||||
|
return prve.plus(BigNumber(cur.number || 0))
|
||||||
|
}, BigNumber(0)).toNumber()
|
||||||
|
})
|
||||||
|
|
||||||
|
function chooseImage() {
|
||||||
|
uni.chooseImage({
|
||||||
|
count: 1, //默认9
|
||||||
|
sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
|
||||||
|
sourceType: ["album", "camera "],
|
||||||
|
success: async function(res) {
|
||||||
|
uni.showLoading({
|
||||||
|
title: "上传中",
|
||||||
|
});
|
||||||
|
console.log(res);
|
||||||
|
const fileRes = await stickCount(res.tempFiles[0]);
|
||||||
|
uni.hideLoading();
|
||||||
|
if (fileRes) {
|
||||||
|
list.value.push({
|
||||||
|
number: fileRes,
|
||||||
|
salePrice: 0
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: "上传失败",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const list = ref([])
|
||||||
|
const options = {}
|
||||||
|
|
||||||
|
function salePriceBlur(item) {
|
||||||
|
console.log('item', item)
|
||||||
|
if (item.salePrice * 1 <= 0) {
|
||||||
|
item.salePrice = 0
|
||||||
|
}
|
||||||
|
if (item.salePrice.split('.')[1] && item.salePrice.split('.')[1].length > 2) {
|
||||||
|
item.salePrice = Number(item.salePrice).toFixed(2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function numberBlur(item) {
|
||||||
|
if (item.number * 1 <= 0) {
|
||||||
|
item.number = 0
|
||||||
|
}
|
||||||
|
if (item.number.split('.')[1] && item.number.split('.')[1].length >= 1) {
|
||||||
|
item.number = Number(item.number.split('.')[0])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function init(opt) {
|
||||||
|
Object.assign(options, opt)
|
||||||
|
initCart()
|
||||||
|
if (opt.number) {
|
||||||
|
list.value = [{
|
||||||
|
number: opt.number,
|
||||||
|
salePrice: 0
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 初始化购物车
|
||||||
|
*/
|
||||||
|
function initCart() {
|
||||||
|
let params = {
|
||||||
|
type: "onboc",
|
||||||
|
account: uni.getStorageSync("iToken").loginId,
|
||||||
|
shop_id: uni.getStorageSync("shopInfo").id,
|
||||||
|
operate_type: "init",
|
||||||
|
table_code: options.tableCode,
|
||||||
|
};
|
||||||
|
console.log("购物车初始化参数===", params);
|
||||||
|
websocketUtil.send(JSON.stringify(params));
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* socket消息监听
|
||||||
|
*/
|
||||||
|
|
||||||
|
let hasReciveMsgLen = 0
|
||||||
|
|
||||||
|
function onMessage() {
|
||||||
|
websocketUtil.offMessage();
|
||||||
|
websocketUtil.onMessage(async (res) => {
|
||||||
|
let msg = JSON.parse(res);
|
||||||
|
if (msg.msg_id) {
|
||||||
|
websocketUtil.send(
|
||||||
|
JSON.stringify({
|
||||||
|
type: "receipt",
|
||||||
|
msg_id: msg.msg_id,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (statWatchMsg && msg.operate_type == "onboc_add") {
|
||||||
|
if (sendMsgsku_names.value.find(v => msg.data.sku_name == v)) {
|
||||||
|
hasReciveMsgLen++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (statWatchMsg && hasReciveMsgLen) {
|
||||||
|
createAnOrder()
|
||||||
|
hasReciveMsgLen = 0
|
||||||
|
statWatchMsg = false;
|
||||||
|
sendMsgsku_names.value = []
|
||||||
|
}
|
||||||
|
console.log('msg', msg)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
let sendMsgsku_names = ref([])
|
||||||
|
let statWatchMsg = false
|
||||||
|
|
||||||
|
function confirmOrder() {
|
||||||
|
const isPas = list.value.every(v => {
|
||||||
|
if (!v.number) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (v.salePrice < 0) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
if (!isPas) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请输入正确的数量和单价',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
statWatchMsg = true;
|
||||||
|
for (let item of list.value) {
|
||||||
|
const shop_id = uni.getStorageSync("shopInfo").id
|
||||||
|
const roundNum = Math.floor(Math.random() * 10)
|
||||||
|
const roundNum1 = Math.floor(Math.random() * 1000)
|
||||||
|
const sku_name = `签子_${roundNum}_${shop_id}_${options.tableCode}_${roundNum1}`
|
||||||
|
sendMsgsku_names.value.push(sku_name)
|
||||||
|
websocketUtil.send(
|
||||||
|
JSON.stringify({
|
||||||
|
account: uni.getStorageSync("iToken").loginId,
|
||||||
|
shop_id,
|
||||||
|
type: "onboc",
|
||||||
|
operate_type: "add",
|
||||||
|
table_code: options.tableCode,
|
||||||
|
product_name: '签子',
|
||||||
|
is_gift: 0,
|
||||||
|
pack_number: 0,
|
||||||
|
discount_sale_amount: item.salePrice,
|
||||||
|
number: item.number * 1,
|
||||||
|
sku_name,
|
||||||
|
is_temporary: 1, //是否是临时菜
|
||||||
|
is_qz: 1
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
// createAnOrder()
|
||||||
|
// toConfimOrder()
|
||||||
|
}, 200)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async function createAnOrder() {
|
||||||
|
const shopInfo = uni.getStorageSync('shopInfo')
|
||||||
|
if (
|
||||||
|
shopInfo.registerType == "before"
|
||||||
|
) {
|
||||||
|
const canJiesuan = await hasPermission("允许收款");
|
||||||
|
if (!canJiesuan) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const stickData = uni.getStorageSync('stickData')
|
||||||
|
const orderInfo = stickData.orderInfo
|
||||||
|
|
||||||
|
let placeNum = orderInfo ? orderInfo.placeNum + 1 : 1;
|
||||||
|
let par = {
|
||||||
|
shopId: shopInfo.id, //店铺Id
|
||||||
|
userId: '', //用户Id
|
||||||
|
tableCode: options.tableCode, //台桌编码
|
||||||
|
dineMode: 'dine-in', //用餐模式 堂食 dine-in 外带 take-out 外卖 take-away
|
||||||
|
remark: '', //备注
|
||||||
|
seatNum: 0, //用餐人数
|
||||||
|
packFee: 0, //打包费
|
||||||
|
originAmount: 0, //订单原金额(不包含打包费+餐位费)
|
||||||
|
placeNum: placeNum, //当前订单下单次数
|
||||||
|
waitCall: 0, //是否等叫 0 否 1 等叫
|
||||||
|
vipPrice: 0, //是否使用会员价
|
||||||
|
limitRate: stickData.limitTimeDiscount,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (stickData.orderInfo && shopInfo.registerType != "before") {
|
||||||
|
par.orderId = stickData.orderInfo.id;
|
||||||
|
}
|
||||||
|
let res = null;
|
||||||
|
res = await createOrder(par);
|
||||||
|
console.log(res, "创建订单");
|
||||||
|
if (!res) {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg || "创建订单失败!",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.$emit("update:createOrderIndex");
|
||||||
|
websocketUtil.send(
|
||||||
|
JSON.stringify({
|
||||||
|
type: "onboc",
|
||||||
|
account: uni.getStorageSync("iToken").loginId,
|
||||||
|
shop_id: uni.getStorageSync("shopInfo").id,
|
||||||
|
operate_type: "cleanup",
|
||||||
|
table_code: stickData.table.tableCode,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
uni.removeStorageSync("table_code");
|
||||||
|
|
||||||
|
if (
|
||||||
|
shopInfo.registerType == "before"
|
||||||
|
) {
|
||||||
|
//先付
|
||||||
|
return go.to(
|
||||||
|
"PAGES_ORDER_DETAIL", {
|
||||||
|
id: res.id || stickData.orderInfo.id,
|
||||||
|
dinnerType: 'dine-in',
|
||||||
|
},
|
||||||
|
"redirect"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
if (!res.id && stickData.orderInfo.id) {
|
||||||
|
return go.to(
|
||||||
|
"PAGES_ORDER_PAY", {
|
||||||
|
orderId: stickData.orderInfo.id,
|
||||||
|
isNowPay: true,
|
||||||
|
dinnerType: 'dine-in',
|
||||||
|
},
|
||||||
|
"redirect"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
//后付
|
||||||
|
if (options.isCreateOrderToDetail != "0") {
|
||||||
|
go.to(
|
||||||
|
"PAGES_ORDER_DETAIL", {
|
||||||
|
id: res.id || stickData.orderInfo.id,
|
||||||
|
dinnerType: 'dine-in',
|
||||||
|
},
|
||||||
|
"redirect"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
uni.showToast({
|
||||||
|
title: "提交成功",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function toConfimOrder() {
|
||||||
|
const stickData = uni.getStorageSync('stickData')
|
||||||
|
console.log(stickData);
|
||||||
|
const {
|
||||||
|
name,
|
||||||
|
status,
|
||||||
|
type
|
||||||
|
} = stickData.table;
|
||||||
|
|
||||||
|
|
||||||
|
let shopInfo = uni.getStorageSync("shopInfo");
|
||||||
|
|
||||||
|
go.to("PAGES_CONFIRM_ORDER", {
|
||||||
|
type: type,
|
||||||
|
tableId: stickData.table.id,
|
||||||
|
tableCode: stickData.table.tableCode,
|
||||||
|
name: name,
|
||||||
|
status: status,
|
||||||
|
isCreateOrderToDetail: options.isCreateOrderToDetail ? 1 : 0,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onLoad(init)
|
||||||
|
|
||||||
|
onHide(() => {
|
||||||
|
console.log("onHide");
|
||||||
|
websocketUtil.offMessage();
|
||||||
|
});
|
||||||
|
onShow(() => {
|
||||||
|
onMessage();
|
||||||
|
})
|
||||||
|
onUnmounted(() => {
|
||||||
|
console.log("onUnmounted");
|
||||||
|
websocketUtil.offMessage();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.block {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
padding: 32rpx 28rpx;
|
||||||
|
margin-bottom: 32rpx;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom {
|
||||||
|
display: flex;
|
||||||
|
padding: 24rpx 32rpx;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
padding-bottom: 40rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
z-index: 10;
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
padding: 16rpx 24rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
background-color: #f2f2f2;
|
||||||
|
margin-left: 24rpx;
|
||||||
|
min-width: 188rpx;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
&.main {
|
||||||
|
background-color: $my-main-color;
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
<image v-if="item.isTemporary == 0" class="img" :src="item.coverImg||item.productImg" mode=""></image>
|
<image v-if="item.isTemporary == 0" class="img" :src="item.coverImg||item.productImg" mode=""></image>
|
||||||
<view v-else style="background-color: #3f9eff; width: 152rpx;height: 152rpx;line-height: 152rpx;text-align: center;color: #fff;" >
|
<view v-else style="background-color: #3f9eff; width: 152rpx;height: 152rpx;line-height: 152rpx;text-align: center;color: #fff;" >
|
||||||
临时菜
|
{{item.name||item.productName||'临时菜'}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-p-l-32 u-flex-1">
|
<view class="u-p-l-32 u-flex-1">
|
||||||
|
|||||||
@@ -2,23 +2,23 @@
|
|||||||
<view class="default-box-padding bg-fff border-r-12 u-m-t-24">
|
<view class="default-box-padding bg-fff border-r-12 u-m-t-24">
|
||||||
<view class="u-flex u-row-between">
|
<view class="u-flex u-row-between">
|
||||||
<view>订单状态</view>
|
<view>订单状态</view>
|
||||||
<view>{{$dict.getDiceName(data.status,'orderStatus')}}</view>
|
<view>{{ $dict.getDiceName(data.status, 'orderStatus') }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex u-row-between u-m-t-24">
|
<view class="u-flex u-row-between u-m-t-24">
|
||||||
<view>订单类型</view>
|
<view>订单类型</view>
|
||||||
<view>{{$dict.getDiceName(data.dineMode,'dineMode')}}</view>
|
<view>{{ $dict.getDiceName(data.dineMode, 'dineMode') }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex u-row-between u-m-t-24">
|
<view class="u-flex u-row-between u-m-t-24">
|
||||||
<view>桌位号</view>
|
<view>桌位号</view>
|
||||||
<view>{{table.name||data.tableName}}</view>
|
<view>{{ table.name || data.tableName }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex u-row-between u-m-t-24" v-if="seatFee.number">
|
<view class="u-flex u-row-between u-m-t-24" v-if="seatFee.number">
|
||||||
<view>就餐人数</view>
|
<view>就餐人数</view>
|
||||||
<view>{{seatFee.number||''}}</view>
|
<view>{{ seatFee.number || '' }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex u-row-between u-m-t-24">
|
<view class="u-flex u-row-between u-m-t-24">
|
||||||
<view>支付方式</view>
|
<view>支付方式</view>
|
||||||
<view>{{$dict.getDiceName(data.payType,'payType')||''}}</view>
|
<view>{{ $dict.getDiceName(data.payType, 'payType') || '' }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex u-row-between u-m-t-24">
|
<view class="u-flex u-row-between u-m-t-24">
|
||||||
<view>下单时间</view>
|
<view>下单时间</view>
|
||||||
@@ -27,9 +27,9 @@
|
|||||||
<view class="u-flex u-row-between u-m-t-24">
|
<view class="u-flex u-row-between u-m-t-24">
|
||||||
<view>订单编号</view>
|
<view>订单编号</view>
|
||||||
<view class="u-flex">
|
<view class="u-flex">
|
||||||
<view>{{data.orderNo}}</view>
|
<view>{{ data.orderNo }}</view>
|
||||||
<view v-if="data.orderNo" class="u-m-l-6">
|
<view v-if="data.orderNo" class="u-m-l-6">
|
||||||
<up-copy :content="data.orderNo" >
|
<up-copy :content="data.orderNo">
|
||||||
<up-icon name="/static/copy.svg" :size="16"></up-icon>
|
<up-icon name="/static/copy.svg" :size="16"></up-icon>
|
||||||
</up-copy>
|
</up-copy>
|
||||||
</view>
|
</view>
|
||||||
@@ -37,34 +37,44 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="u-flex u-row-between u-m-t-24 u-col-top">
|
<view class="u-flex u-row-between u-m-t-24 u-col-top">
|
||||||
<view class="no-wrap">商家备注</view>
|
<view class="no-wrap">商家备注</view>
|
||||||
<view class="u-p-l-32 " style="max-width: 522rpx; word-wrap: break-word;">
|
<view class="u-p-l-32" style="max-width: 522rpx; word-wrap: break-word">
|
||||||
{{data.remark}}
|
{{ data.remark }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-row-between u-m-t-24 u-col-top">
|
||||||
|
<view class="no-wrap">打印状态</view>
|
||||||
|
<view class="u-p-l-32" style="max-width: 522rpx; word-wrap: break-word; color: red">
|
||||||
|
<template v-if="JSON.parse(data.printStatus).length > 0">
|
||||||
|
打印失败({{
|
||||||
|
JSON.parse(data.printStatus)
|
||||||
|
.map((item) => item.name)
|
||||||
|
.join('、')
|
||||||
|
}})
|
||||||
|
</template>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
data: {
|
data: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {}
|
default: () => {}
|
||||||
},
|
},
|
||||||
table: {
|
table: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {}
|
default: () => {}
|
||||||
},
|
},
|
||||||
seatFee: {
|
seatFee: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {
|
default: () => {
|
||||||
totalNumber: 0
|
totalNumber: 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped></style>
|
||||||
</style>
|
|
||||||
|
|||||||
1547
pnpm-lock.yaml
generated
1547
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,9 @@
|
|||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
||||||
dayjs.extend(customParseFormat); // 注册插件
|
dayjs.extend(customParseFormat); // 注册插件
|
||||||
|
import {
|
||||||
|
BigNumber
|
||||||
|
} from "bignumber.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 过滤输入,只允许数字和最多两位小数
|
* 过滤输入,只允许数字和最多两位小数
|
||||||
@@ -71,4 +74,73 @@ export const convertTimeFormat = (timeStr) => {
|
|||||||
|
|
||||||
// 非法格式兜底
|
// 非法格式兜底
|
||||||
return '00:00';
|
return '00:00';
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断目标值是否包含指定字符串
|
||||||
|
* @param {string|number|array} target - 目标值(字符串/数字/数组)
|
||||||
|
* @param {string} searchStr - 要查找的子字符串
|
||||||
|
* @param {object} [options] - 可选配置
|
||||||
|
* @param {boolean} [options.ignoreCase=false] - 是否忽略大小写
|
||||||
|
* @param {boolean} [options.allowEmpty=false] - 当 searchStr 为空时,是否返回 true(默认 false)
|
||||||
|
* @returns {boolean} 是否包含指定字符串
|
||||||
|
*/
|
||||||
|
export function includesString(target, searchStr, options = {}) {
|
||||||
|
// 解构配置,设置默认值
|
||||||
|
const {
|
||||||
|
ignoreCase = false, allowEmpty = false
|
||||||
|
} = options;
|
||||||
|
|
||||||
|
// 1. 处理 searchStr 为空的情况
|
||||||
|
if (searchStr === '' || searchStr === null || searchStr === undefined) {
|
||||||
|
return allowEmpty;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 统一将目标值转为字符串(兼容数字/数组等)
|
||||||
|
let targetStr = '';
|
||||||
|
if (typeof target === 'string') {
|
||||||
|
targetStr = target;
|
||||||
|
} else if (typeof target === 'number') {
|
||||||
|
targetStr = String(target);
|
||||||
|
} else if (Array.isArray(target)) {
|
||||||
|
// 数组:拼接为字符串(也可改为 "数组中某一项包含",根据需求调整)
|
||||||
|
targetStr = target.join(',');
|
||||||
|
} else {
|
||||||
|
// 其他类型(对象/布尔等):转为字符串或返回 false
|
||||||
|
targetStr = String(target);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 处理大小写忽略
|
||||||
|
const processedTarget = ignoreCase ? targetStr.toLowerCase() : targetStr;
|
||||||
|
const processedSearch = ignoreCase ? searchStr.toLowerCase() : searchStr;
|
||||||
|
|
||||||
|
// 4. 执行包含判断
|
||||||
|
return processedTarget.includes(processedSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 乘法计算并格式化结果
|
||||||
|
* @param {string|number} num1 - 第一个乘数
|
||||||
|
* @param {string|number} num2 - 第二个乘数
|
||||||
|
* @returns {string} 保留两位小数的结果(不四舍五入,补零)
|
||||||
|
*/
|
||||||
|
export const multiplyAndFormat = (num1, num2) => {
|
||||||
|
try {
|
||||||
|
// 转换为BigNumber(使用字符串构造避免精度问题)
|
||||||
|
const bigNum1 = new BigNumber(num1.toString());
|
||||||
|
const bigNum2 = new BigNumber(num2.toString());
|
||||||
|
|
||||||
|
// 1. 乘法计算
|
||||||
|
const product = bigNum1.multipliedBy(bigNum2);
|
||||||
|
|
||||||
|
// 2. 截断到两位小数(不四舍五入)
|
||||||
|
const truncated = product.decimalPlaces(2, BigNumber.ROUND_DOWN);
|
||||||
|
|
||||||
|
// 3. 格式化保留两位小数(补零)
|
||||||
|
return truncated.toFixed(2);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('计算错误:', error);
|
||||||
|
return '0.00'; // 出错时返回默认值
|
||||||
|
}
|
||||||
};
|
};
|
||||||
@@ -8,14 +8,14 @@ export default defineConfig({
|
|||||||
server: {
|
server: {
|
||||||
proxy: {
|
proxy: {
|
||||||
'/javaapi': {
|
'/javaapi': {
|
||||||
// target: 'https://cashier.sxczgkj.com', // 目标服务器地址
|
target: 'https://cashier.sxczgkj.com', // 目标服务器地址
|
||||||
target: 'http://192.168.1.42/', // 目标服务器地址
|
// target: 'http://192.168.1.42/', // 目标服务器地址
|
||||||
changeOrigin: true, // 是否更改请求源
|
changeOrigin: true, // 是否更改请求源
|
||||||
rewrite: path => path.replace(/^\/javaapi/, '')
|
rewrite: path => path.replace(/^\/javaapi/, '')
|
||||||
},
|
},
|
||||||
'/phpapi': {
|
'/phpapi': {
|
||||||
// target: 'https://cashier.sxczgkj.com', // 目标服务器地址
|
target: 'https://cashier.sxczgkj.com', // 目标服务器地址
|
||||||
target: 'http://192.168.1.42:8787/', // 目标服务器地址
|
// target: 'http://192.168.1.42:8787/', // 目标服务器地址
|
||||||
changeOrigin: true, // 是否更改请求源
|
changeOrigin: true, // 是否更改请求源
|
||||||
rewrite: path => path.replace(/^\/phpapi/, '')
|
rewrite: path => path.replace(/^\/phpapi/, '')
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user