Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0990e08201 | |||
| 63896046a8 | |||
| 1a16b0b3dd | |||
| 684014e183 | |||
| 6c08b3b878 | |||
| 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>
|
||||
<view
|
||||
class="fixed-wrap"
|
||||
:style="{ '--num': showCancel ? '63px' : '0px' }"
|
||||
v-if="isShow"
|
||||
>
|
||||
<view class="fixed-btn" id="targetRef">
|
||||
<div class="btn">
|
||||
<u-button
|
||||
type="primary"
|
||||
:shape="shape"
|
||||
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>
|
||||
<view class="fixed-wrap" :style="{ '--num': `${numValue}px` }">
|
||||
<view class="fixed-btn" :class="[type]" id="targetRef">
|
||||
<div class="btn">
|
||||
<u-button type="primary" :color="confirmColor" :shape="shape" 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>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, nextTick, getCurrentInstance ,computed} from "vue";
|
||||
import { isMainShop } from "@/store/account.js";
|
||||
import { ref, onMounted, nextTick, getCurrentInstance, computed } from 'vue';
|
||||
// import { isMainShop } from '@/store/account.js';
|
||||
|
||||
const props = defineProps({
|
||||
isOpenPermission: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
confirmText: {
|
||||
type: String,
|
||||
default: "保存",
|
||||
},
|
||||
showCancel: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
shape: {
|
||||
type: String,
|
||||
default: "circle", // squre circle
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: 'vertical' // horizontal横向 vertical竖向
|
||||
},
|
||||
isOpenPermission: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
confirmText: {
|
||||
type: String,
|
||||
default: '保存'
|
||||
},
|
||||
confirmColor: {
|
||||
type: String,
|
||||
default: '#3C9CFF'
|
||||
},
|
||||
showCancel: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
shape: {
|
||||
type: String,
|
||||
default: 'circle' // squre circle
|
||||
}
|
||||
});
|
||||
const isShow = computed(() => {
|
||||
if (props.isOpenPermission) {
|
||||
return isMainShop();
|
||||
}
|
||||
return true;
|
||||
|
||||
// const isShow = computed(() => {
|
||||
// if (props.isOpenPermission) {
|
||||
// return isMainShop();
|
||||
// }
|
||||
// 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>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.fixed-wrap {
|
||||
--height: calc(83px + var(--num) + env(safe-area-inset-bottom) / 2);
|
||||
width: 100%;
|
||||
height: var(--height);
|
||||
.fixed-btn {
|
||||
width: 100%;
|
||||
height: var(--height);
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 99;
|
||||
padding: 10px 14px calc(20px + env(safe-area-inset-bottom) / 2) 10px;
|
||||
background-color: #fff;
|
||||
.btn {
|
||||
&:first-child {
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
--height: calc(83px + var(--num) + env(safe-area-inset-bottom) / 2);
|
||||
width: 100%;
|
||||
height: var(--height);
|
||||
.fixed-btn {
|
||||
width: 100%;
|
||||
height: var(--height);
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 999;
|
||||
padding: 10px 14px calc(20px + env(safe-area-inset-bottom) / 2) 10px;
|
||||
background-color: #fff;
|
||||
&.horizontal {
|
||||
display: flex;
|
||||
gap: 28upx;
|
||||
.btn {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
.btn {
|
||||
&:first-child {
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
</view>
|
||||
</view>
|
||||
<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>
|
||||
@@ -27,11 +28,12 @@ import { ref, onMounted, nextTick } from 'vue';
|
||||
const props = defineProps({
|
||||
options: {
|
||||
type: Object,
|
||||
default: {
|
||||
default: () => ({
|
||||
// 注意:对象/数组默认值推荐用函数,避免引用共享
|
||||
name: '标题',
|
||||
intro: '说明',
|
||||
icon: 'xszk'
|
||||
}
|
||||
})
|
||||
},
|
||||
showSwitch: {
|
||||
type: Boolean,
|
||||
@@ -41,11 +43,13 @@ const props = defineProps({
|
||||
|
||||
const headHeight = ref(70);
|
||||
|
||||
// defineModel 是 Vue3.4+ 语法糖,自动实现 v-model:isOpen 的双向绑定
|
||||
const isOpen = defineModel('isOpen', {
|
||||
type: [Boolean, String, Number],
|
||||
default: 0
|
||||
});
|
||||
|
||||
// 声明自定义 emit 事件(仅在 script setup 内使用)
|
||||
const emits = defineEmits(['load']);
|
||||
|
||||
onMounted(() => {
|
||||
@@ -83,6 +87,7 @@ onMounted(() => {
|
||||
padding-left: 20upx;
|
||||
flex-direction: column;
|
||||
.title {
|
||||
margin-top: -4upx;
|
||||
.t {
|
||||
font-size: 28upx;
|
||||
font-weight: bold;
|
||||
|
||||
@@ -1,118 +1,110 @@
|
||||
<template>
|
||||
<view>
|
||||
<up-radio-group v-model="useTimeType" placement="row">
|
||||
<up-radio
|
||||
v-for="item in useTimeTypeList"
|
||||
:key="item.value"
|
||||
:value="item.value"
|
||||
:name="item.value"
|
||||
:label="item.label"
|
||||
:customStyle="customStyle"
|
||||
></up-radio>
|
||||
</up-radio-group>
|
||||
<view class="container" v-if="useTimeType == 'custom'">
|
||||
<view class="u-flex u-m-t-30 box" >
|
||||
<view class="u-flex u-flex-1">
|
||||
<view class="item" @click="pirckerShow(startValue, 'startValue')">
|
||||
<text class="u-m-r-12" v-if="!startValue">开始时间</text>
|
||||
<text class="u-m-r-12" v-else>{{ startValue }}</text>
|
||||
</view>
|
||||
<view class="u-m-l-8 u-m-r-8" style="padding: 0 30rpx">—</view>
|
||||
<view class="item" @click="pirckerShow(endValue, 'endValue')">
|
||||
<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>
|
||||
<view>
|
||||
<up-radio-group v-model="useTimeType" placement="row" v-if="showType">
|
||||
<up-radio v-for="item in useTimeTypeList" :key="item.value" :value="item.value" :name="item.value" :label="item.label" :customStyle="customStyle"></up-radio>
|
||||
</up-radio-group>
|
||||
<view class="container" v-if="useTimeType == 'custom' || !showType">
|
||||
<view class="u-flex u-m-t-30 box">
|
||||
<view class="u-flex u-flex-1">
|
||||
<view class="item" @click="pirckerShow(startValue, 'startValue')">
|
||||
<text class="u-m-r-12" v-if="!startValue">开始时间</text>
|
||||
<text class="u-m-r-12" v-else>{{ startValue }}</text>
|
||||
</view>
|
||||
<view class="u-m-l-8 u-m-r-8" style="padding: 0 30rpx">—</view>
|
||||
<view class="item" @click="pirckerShow(endValue, 'endValue')">
|
||||
<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
|
||||
:show="show"
|
||||
v-model="value1"
|
||||
closeOnClickOverlay
|
||||
@close="close"
|
||||
@cancel="close"
|
||||
@confirm="confirm"
|
||||
mode="time"
|
||||
></up-datetime-picker>
|
||||
|
||||
</view>
|
||||
<up-datetime-picker :show="show" v-model="value1" closeOnClickOverlay @close="close" @cancel="close" @confirm="confirm" mode="time"></up-datetime-picker>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, ref } from "vue";
|
||||
function cancel(){
|
||||
union.navigateBack()
|
||||
}
|
||||
const customStyle = ref({
|
||||
marginRight: "15px",
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
showType: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
});
|
||||
|
||||
const useTimeType = defineModel("useTimeType", {
|
||||
type: String,
|
||||
default: "all",
|
||||
function cancel() {
|
||||
union.navigateBack();
|
||||
}
|
||||
const customStyle = ref({
|
||||
marginRight: '15px'
|
||||
});
|
||||
|
||||
const useTimeType = defineModel('useTimeType', {
|
||||
type: String,
|
||||
default: 'all'
|
||||
});
|
||||
const useTimeTypeList = [
|
||||
{
|
||||
value: "all",
|
||||
label: "全时段可用",
|
||||
},
|
||||
{
|
||||
value: "custom",
|
||||
label: "指定时间段可用",
|
||||
},
|
||||
{
|
||||
value: 'all',
|
||||
label: '全时段可用'
|
||||
},
|
||||
{
|
||||
value: 'custom',
|
||||
label: '指定时间段可用'
|
||||
}
|
||||
];
|
||||
import dayjs from "dayjs";
|
||||
const startValue = defineModel("startValue", {
|
||||
type: String,
|
||||
default: "",
|
||||
import dayjs from 'dayjs';
|
||||
const startValue = defineModel('startValue', {
|
||||
type: String,
|
||||
default: ''
|
||||
});
|
||||
const endValue = defineModel("endValue", {
|
||||
type: String,
|
||||
default: "",
|
||||
const endValue = defineModel('endValue', {
|
||||
type: String,
|
||||
default: ''
|
||||
});
|
||||
|
||||
function close() {
|
||||
show.value = false;
|
||||
show.value = false;
|
||||
}
|
||||
const value1 = ref("");
|
||||
const value1 = ref('');
|
||||
const show = ref(false);
|
||||
const nowKey = ref("");
|
||||
const nowKey = ref('');
|
||||
|
||||
function pirckerShow(date, key) {
|
||||
nowKey.value = key;
|
||||
show.value = true;
|
||||
value1.value = date || "";
|
||||
nowKey.value = key;
|
||||
show.value = true;
|
||||
value1.value = date || '';
|
||||
}
|
||||
|
||||
function confirm(e) {
|
||||
console.log(e);
|
||||
console.log(e);
|
||||
|
||||
if (nowKey.value == "startValue") {
|
||||
startValue.value = e.value;
|
||||
} else if (nowKey.value == "endValue") {
|
||||
endValue.value = e.value;
|
||||
}
|
||||
value1.value = e.value;
|
||||
show.value = false;
|
||||
if (nowKey.value == 'startValue') {
|
||||
startValue.value = e.value;
|
||||
} else if (nowKey.value == 'endValue') {
|
||||
endValue.value = e.value;
|
||||
}
|
||||
value1.value = e.value;
|
||||
show.value = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.item {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
line-height: 48rpx;
|
||||
padding: 0 12rpx;
|
||||
display: flex;
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
line-height: 48rpx;
|
||||
padding: 0 12rpx;
|
||||
display: flex;
|
||||
}
|
||||
.box {
|
||||
border: 2rpx solid #dddfe6;
|
||||
padding: 16rpx 30rpx;
|
||||
box-sizing: border-box;
|
||||
width: 564rpx;
|
||||
border-radius: 4rpx;
|
||||
overflow: hidden;
|
||||
border: 2rpx solid #dddfe6;
|
||||
padding: 16rpx 30rpx;
|
||||
box-sizing: border-box;
|
||||
width: 564rpx;
|
||||
border-radius: 4rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<view @click="show = true">
|
||||
<slot v-if="$slots.default"></slot>
|
||||
<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>
|
||||
<up-icon size="14" name="arrow-down"></up-icon>
|
||||
</view>
|
||||
|
||||
@@ -1,89 +1,162 @@
|
||||
<template>
|
||||
<view class="upload-file" @click="chooseImage">
|
||||
<slot v-if="$slots.default"></slot>
|
||||
<view class="icon" v-if="!modelValue"> + </view>
|
||||
<image class="img" v-else :src="modelValue"></image>
|
||||
<view class="upload-file" @click="chooseImage" :style="returnStyle('box')">
|
||||
<slot v-if="$slots.default"></slot>
|
||||
<view class="icon" v-if="!modelValue">+</view>
|
||||
<image class="img" v-else :src="modelValue" :style="returnStyle('img')"></image>
|
||||
|
||||
<view class="close" @click.stop="()=>{}" v-if="modelValue">
|
||||
<up-icon name="close-circle" color="#333" size="14" @click="clearImg" ></up-icon>
|
||||
<view class="close" @click.stop="() => {}" v-if="modelValue">
|
||||
<up-icon name="close-circle" color="#333" size="14" @click="clearImg"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { uploadFile } from "@/http/api/index.js";
|
||||
import {
|
||||
uploadFile
|
||||
} from '@/http/api/index.js';
|
||||
import {
|
||||
ref
|
||||
} from 'vue';
|
||||
|
||||
import { reactive, ref, watch } from "vue";
|
||||
const props = defineProps({
|
||||
size: {
|
||||
default: ''
|
||||
},
|
||||
// 图片最大上传大小,单位M,默认undefined(不限制大小)
|
||||
maxSize: {
|
||||
type: [Number, String], // 支持数字(如2)或字符串(如"2")传参
|
||||
default: undefined,
|
||||
validator: (value) => {
|
||||
// 校验:传参必须是大于0的数字(转换后),否则视为不限制
|
||||
const numValue = Number(value);
|
||||
return value === undefined || (!isNaN(numValue) && numValue > 0);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const modelValue = defineModel({
|
||||
type: String,
|
||||
default: "",
|
||||
});
|
||||
function returnStyle(type) {
|
||||
let size = null
|
||||
if (!props.size) {
|
||||
return
|
||||
}
|
||||
if (Number(props.size) === NaN) {
|
||||
size = props.size
|
||||
} else {
|
||||
size = props.size + 'rpx'
|
||||
}
|
||||
return {
|
||||
width: size,
|
||||
height: size
|
||||
}
|
||||
}
|
||||
|
||||
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 uploadFile(res.tempFiles[0]);
|
||||
uni.hideLoading();
|
||||
if (fileRes) {
|
||||
modelValue.value = fileRes;
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "上传失败",
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
const modelValue = defineModel({
|
||||
type: String,
|
||||
default: ''
|
||||
});
|
||||
|
||||
function clearImg(){
|
||||
modelValue.value=""
|
||||
}
|
||||
const emits = defineEmits('uploadSuccess')
|
||||
|
||||
// ------------- 新增2:工具函数:将M转换为字节(1M = 1024 * 1024 字节) -------------
|
||||
/**
|
||||
* 转换文件大小单位(M → 字节)
|
||||
* @returns {number} 最大允许的文件字节数,返回0表示不限制
|
||||
*/
|
||||
function getMaxFileSizeInBytes() {
|
||||
if (props.maxSize === undefined) return 0; // 未传参,返回0(不限制)
|
||||
|
||||
const maxSizeNum = Number(props.maxSize);
|
||||
// 无效数值,返回0(不限制)
|
||||
if (isNaN(maxSizeNum) || maxSizeNum <= 0) return 0;
|
||||
|
||||
// 转换公式:1M = 1024KB,1KB = 1024字节
|
||||
return maxSizeNum * 1024 * 1024;
|
||||
}
|
||||
|
||||
// ------------- 修改1:在上传前增加文件大小校验 -------------
|
||||
function chooseImage() {
|
||||
uni.chooseImage({
|
||||
count: 1, //默认9
|
||||
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType: ['album', 'camera'],
|
||||
success: async function(res) {
|
||||
// 1. 获取文件信息(大小、临时路径等)
|
||||
const tempFile = res.tempFiles[0];
|
||||
const maxFileSize = getMaxFileSizeInBytes();
|
||||
|
||||
// 2. 校验文件大小(仅当maxFileSize>0时才校验)
|
||||
if (maxFileSize > 0 && tempFile.size > maxFileSize) {
|
||||
uni.showToast({
|
||||
title: `图片大小不能超过${props.maxSize}M`,
|
||||
icon: 'none'
|
||||
});
|
||||
return; // 校验失败,终止后续上传逻辑
|
||||
}
|
||||
|
||||
// 3. 校验通过,执行上传
|
||||
uni.showLoading({
|
||||
title: '上传中'
|
||||
});
|
||||
console.log(res);
|
||||
const fileRes = await uploadFile(tempFile);
|
||||
uni.hideLoading();
|
||||
|
||||
if (fileRes) {
|
||||
modelValue.value = fileRes;
|
||||
emits('uploadSuccess', fileRes)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '上传失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function clearImg() {
|
||||
modelValue.value = '';
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.upload-file {
|
||||
$size: 128rpx;
|
||||
width: $size;
|
||||
height: $size;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border: 1px dashed #d9d9d9;
|
||||
border-radius: 8rpx;
|
||||
position: relative;
|
||||
.close{
|
||||
position: absolute;
|
||||
right: -10rpx;
|
||||
top: -10rpx;
|
||||
}
|
||||
.img {
|
||||
width: $size;
|
||||
height: $size;
|
||||
}
|
||||
.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;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
.upload-file {
|
||||
$size: 128rpx;
|
||||
width: $size;
|
||||
height: $size;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border: 1px dashed #d9d9d9;
|
||||
border-radius: 8rpx;
|
||||
position: relative;
|
||||
|
||||
.close {
|
||||
position: absolute;
|
||||
right: -10rpx;
|
||||
top: -10rpx;
|
||||
}
|
||||
|
||||
.img {
|
||||
width: $size;
|
||||
height: $size;
|
||||
}
|
||||
|
||||
.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;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
</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>
|
||||
222
components/my-components/my-user-select.vue
Normal file
222
components/my-components/my-user-select.vue
Normal file
@@ -0,0 +1,222 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
<view class="box" @click.stop="openPopup">
|
||||
<text class="u-font-28 color-999 u-p-r-16" v-if="!modelValue||list.length==0">请选择用户</text>
|
||||
<text class="u-font-28 color-333 u-p-r-16 u-line-1" v-else :style="{
|
||||
maxWidth: maxWidth+'rpx'
|
||||
}">{{returnLabel()}}</text>
|
||||
<view class="icon ">
|
||||
<up-icon name="arrow-down" size="14" color="#999"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<up-popup :show="show" placement="bottom" round="18rpx" closeOnClickOverlay @close="close">
|
||||
<view class="u-p-30">
|
||||
<view class="font-bold color-333 u-font-32">选择用户</view>
|
||||
<view class="u-m-t-24">
|
||||
<up-search v-model="query.key" @clear="search" @custom="search" @search="search"></up-search>
|
||||
</view>
|
||||
<scroll-view scroll-with-animation :scroll-into-view="selId" class="scroll-view u-m-t-30"
|
||||
scroll-y="true" style="max-height :60vh;" @scrolltolower="scrolltolower">
|
||||
<view class="u-m-b-10 u-flex item" v-for="item in list" :key="item.id" @click="itemClick(item)"
|
||||
:id="'item_'+item.id" :class="{active:selItem&&selItem.id==item.id}">
|
||||
<view class="checkbox">
|
||||
<up-icon name="checkbox-mark" color="#fff"></up-icon>
|
||||
</view>
|
||||
<view class="u-flex-1">{{item.nickName}}/{{item.phone}}</view>
|
||||
</view>
|
||||
<template v-if="search.key!==''">
|
||||
<up-empty v-if="list.length==0" text="未搜到相关用户"></up-empty>
|
||||
<up-loadmore v-else :status="isEnd?'nomore':'loading'"></up-loadmore>
|
||||
</template>
|
||||
<template v-else>
|
||||
<up-empty v-if="list.length==0" text="暂无用户"></up-empty>
|
||||
<up-loadmore v-else :status="isEnd?'nomore':'loading'"></up-loadmore>
|
||||
</template>
|
||||
</scroll-view>
|
||||
<view class="u-flex gap-20 u-m-t-30">
|
||||
<view class="u-flex-1">
|
||||
<my-button type="default" @click="close">取消</my-button>
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
<my-button type="primary" @click="submit">确定</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
onMounted,
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
getShopUser
|
||||
} from '@/http/api/market/index.js';
|
||||
|
||||
const customStyle = ref({
|
||||
marginRight: '20px'
|
||||
});
|
||||
|
||||
const show = ref(false);
|
||||
let modelValue = defineModel('modelValue', {
|
||||
default: '',
|
||||
});
|
||||
|
||||
const props = defineProps({
|
||||
maxWidth: {
|
||||
default: 240
|
||||
}
|
||||
})
|
||||
|
||||
const selId = ref('')
|
||||
|
||||
function returnLabel() {
|
||||
const findItem = list.value.find(v => v.id == modelValue.value)
|
||||
if (findItem) {
|
||||
return findItem.nickName + (findItem.phone ? ('/' + findItem.phone) : '')
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
const selItem = ref(null)
|
||||
|
||||
function itemClick(item) {
|
||||
selItem.value = item
|
||||
}
|
||||
|
||||
function returnShopName(id) {
|
||||
const item = list.value.find((v) => v.id == id);
|
||||
return item?.shopName || '';
|
||||
}
|
||||
|
||||
function close() {
|
||||
show.value = false;
|
||||
}
|
||||
|
||||
|
||||
const emits = defineEmits(['change'])
|
||||
|
||||
function submit() {
|
||||
if (!selItem.value) {
|
||||
return uni.showToast({
|
||||
title: '请选择用户'
|
||||
})
|
||||
}
|
||||
if (modelValue.value != selItem.value.id) {
|
||||
modelValue.value=selItem.value.id
|
||||
emits('change')
|
||||
}else{
|
||||
modelValue.value=selItem.value.id
|
||||
}
|
||||
show.value = false;
|
||||
}
|
||||
|
||||
|
||||
const list = ref([]);
|
||||
|
||||
function openPopup() {
|
||||
selId.value = 'item_' + modelValue.value
|
||||
init()
|
||||
show.value = true;
|
||||
|
||||
}
|
||||
const isEnd = ref(false)
|
||||
const query = reactive({
|
||||
page: 1,
|
||||
size: 10,
|
||||
key: ''
|
||||
})
|
||||
|
||||
function search() {
|
||||
isEnd.value = false
|
||||
query.page = 1
|
||||
selItem.value = null
|
||||
init()
|
||||
}
|
||||
async function init() {
|
||||
const res = await getShopUser(query);
|
||||
if (res) {
|
||||
isEnd.value = query.page >= res.totalPage * 1
|
||||
if (query.page == 1) {
|
||||
list.value = res.records
|
||||
} else {
|
||||
list.value.push(...res.records)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function scrolltolower() {
|
||||
if (!isEnd.value) {
|
||||
query.page++
|
||||
init()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.box {
|
||||
border-radius: 8upx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: top;
|
||||
flex-wrap: wrap;
|
||||
padding: 10rpx 24rpx;
|
||||
border: 2rpx solid #e5e5e5;
|
||||
position: relative;
|
||||
|
||||
.icon {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 24rpx;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
.shop-item {
|
||||
padding: 4rpx 8rpx 4rpx 16rpx;
|
||||
border-radius: 4rpx;
|
||||
border: 2rpx solid #f0f0f0;
|
||||
background-color: #f5f5f5;
|
||||
margin-bottom: 16rpx;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.scroll-view {
|
||||
.item {
|
||||
border: 1px solid #eee;
|
||||
padding: 20rpx;
|
||||
border-radius: 12rpx;
|
||||
|
||||
&.active {
|
||||
border-color: $my-main-color;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
margin-right: 10rpx;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 6rpx;
|
||||
border: 1px solid #999;
|
||||
|
||||
}
|
||||
|
||||
.item {
|
||||
&.active {
|
||||
.checkbox {
|
||||
background-color: $my-main-color;
|
||||
border-color: $my-main-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,63 +1,57 @@
|
||||
<template>
|
||||
<view>
|
||||
<up-checkbox-group v-model="selectedWeek" :options="week">
|
||||
<up-checkbox
|
||||
:customStyle="customStyle"
|
||||
:shape="shape"
|
||||
v-for="item in week"
|
||||
:key="item.value"
|
||||
:value="item.value"
|
||||
:name="item.value"
|
||||
:label="item.value"
|
||||
>{{ item.name }}</up-checkbox>
|
||||
</up-checkbox-group>
|
||||
</view>
|
||||
<view>
|
||||
<up-checkbox-group v-model="selectedWeek" :options="week">
|
||||
<up-checkbox :customStyle="customStyle" :shape="shape" v-for="item in week" :key="item.value" :value="item.value" :name="item.value" :label="item.value">
|
||||
{{ item.name }}
|
||||
</up-checkbox>
|
||||
</up-checkbox-group>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { ref } from 'vue';
|
||||
|
||||
const customStyle={
|
||||
marginRight: '40rpx',
|
||||
marginBottom: '16rpx',
|
||||
}
|
||||
const customStyle = {
|
||||
marginRight: '40rpx',
|
||||
marginBottom: '16rpx'
|
||||
};
|
||||
const props = defineProps({
|
||||
shape: {
|
||||
type: String,
|
||||
default: 'square' // circle
|
||||
},
|
||||
shape: {
|
||||
type: String,
|
||||
default: 'square' // circle
|
||||
}
|
||||
});
|
||||
const selectedWeek=defineModel({
|
||||
type: Array,
|
||||
default: () => [],
|
||||
const selectedWeek = defineModel({
|
||||
type: Array,
|
||||
default: () => []
|
||||
});
|
||||
const week = ref([
|
||||
{
|
||||
name: "周一",
|
||||
value:"周一",
|
||||
},
|
||||
{
|
||||
name: "周二",
|
||||
value:"周二",
|
||||
},
|
||||
{
|
||||
name: "周三",
|
||||
value:"周三",
|
||||
},
|
||||
{
|
||||
name: "周四",
|
||||
value:"周四",
|
||||
},
|
||||
{
|
||||
name: "周五",
|
||||
value:"周五",
|
||||
},
|
||||
{
|
||||
name: "周六",
|
||||
value:"周六",
|
||||
},
|
||||
{
|
||||
name: "周日",
|
||||
value:"周日",
|
||||
},
|
||||
{
|
||||
name: '周一',
|
||||
value: '周一'
|
||||
},
|
||||
{
|
||||
name: '周二',
|
||||
value: '周二'
|
||||
},
|
||||
{
|
||||
name: '周三',
|
||||
value: '周三'
|
||||
},
|
||||
{
|
||||
name: '周四',
|
||||
value: '周四'
|
||||
},
|
||||
{
|
||||
name: '周五',
|
||||
value: '周五'
|
||||
},
|
||||
{
|
||||
name: '周六',
|
||||
value: '周六'
|
||||
},
|
||||
{
|
||||
name: '周日',
|
||||
value: '周日'
|
||||
}
|
||||
]);
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -1,29 +1,108 @@
|
||||
//当前环境 test,prod
|
||||
export const ENV = 'test'
|
||||
export const ENV_BASE_URL = {
|
||||
java: {
|
||||
prod: 'https://cashier.sxczgkj.com/',
|
||||
test: 'http://192.168.1.42/',
|
||||
h5ProdProxy: '/prodJavaApi/',
|
||||
h5TestProxy: '/testJavaApi/',
|
||||
},
|
||||
php: {
|
||||
prod: 'https://cashier.sxczgkj.com/',
|
||||
test: 'http://192.168.1.42:8787/',
|
||||
h5ProdProxy: '/prodPhpApi/api/',
|
||||
h5TestProxy: '/testPhpApi/api/',
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {String} env 环境,测试或者正式
|
||||
* @param {String} apiType 语言,java或者php
|
||||
*/
|
||||
export function returnBaseUrl(param) {
|
||||
let {
|
||||
env,
|
||||
apiType
|
||||
} = param
|
||||
if(!env){
|
||||
env=ENV
|
||||
}
|
||||
console.log('env', env);
|
||||
console.log('apiType', apiType);
|
||||
if (env === 'prod') {
|
||||
//正式环境
|
||||
// #ifdef H5
|
||||
if (apiType === 'php') {
|
||||
return ENV_BASE_URL.php.h5ProdProxy
|
||||
}
|
||||
if (apiType === 'java') {
|
||||
return ENV_BASE_URL.java.h5ProdProxy
|
||||
}
|
||||
// #endif
|
||||
|
||||
if (apiType === 'php') {
|
||||
return ENV_BASE_URL.php.prod
|
||||
}
|
||||
if (apiType === 'java') {
|
||||
return ENV_BASE_URL.java.prod
|
||||
}
|
||||
|
||||
} else {
|
||||
//测试环境
|
||||
// #ifdef H5
|
||||
if (apiType === 'php') {
|
||||
return ENV_BASE_URL.php.h5TestProxy
|
||||
}
|
||||
if (apiType === 'java') {
|
||||
return ENV_BASE_URL.java.h5TestProxy
|
||||
}
|
||||
// #endif
|
||||
|
||||
if (apiType === 'php') {
|
||||
return ENV_BASE_URL.php.test
|
||||
}
|
||||
if (apiType === 'java') {
|
||||
return ENV_BASE_URL.java.test
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
const appConfig = {
|
||||
|
||||
|
||||
// 项目名称
|
||||
appName: '银收客',
|
||||
|
||||
|
||||
// token取值key
|
||||
tokenKey: 'iToken',
|
||||
// tokenKey: 'satoken',
|
||||
|
||||
|
||||
// 环境变量相关
|
||||
env: {},
|
||||
|
||||
|
||||
// wss: "wss://sockets.sxczgkj.com/wss", //测试环境
|
||||
wss: "wss://czgeatws.sxczgkj.com/wss", //正式环境
|
||||
// 环境变量常量
|
||||
ENV_ENUM: {
|
||||
DEVELOPMENT: 'development', // 本地调试地址
|
||||
DEVELOPMENT: 'development', // 本地调试地址
|
||||
TEST: 'test', // 测试地址
|
||||
DEMO: 'demo', // 演示环境
|
||||
PRODUCTION: 'production' // 生产环境
|
||||
PRODUCTION: 'production' // 生产环境
|
||||
},
|
||||
|
||||
|
||||
returnBaseUrl: returnBaseUrl,
|
||||
storeEnvEnumKey: 'currentEnvEnum', // 本地存储的envkey的值
|
||||
|
||||
encryptKey: '1234567890123456' // http数据加解密的key
|
||||
|
||||
|
||||
encryptKey: '1234567890123456', // http数据加解密的key
|
||||
baseUrl: "",
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export default appConfig;
|
||||
545
entryManager/add/add.vue
Normal file
545
entryManager/add/add.vue
Normal file
@@ -0,0 +1,545 @@
|
||||
<template>
|
||||
<view class="min-page bg-f7 u-font-28 color-333">
|
||||
<steps v-model="step" @itemClick="stepItemClick" />
|
||||
<view class="u-m-t-32">
|
||||
<basicInfo v-if="step==0" :data="form.merchantBaseInfo" :maxSize="maxSize"
|
||||
@update="update($event,'merchantBaseInfo')">
|
||||
</basicInfo>
|
||||
<legalPerpoleInfo v-if="step==1" :maxSize="maxSize" :data="form.legalPersonInfo"
|
||||
@update="update($event,'legalPersonInfo')">
|
||||
</legalPerpoleInfo>
|
||||
<businessLicenceInfo v-if="step==2" :maxSize="maxSize" :data="form.businessLicenceInfo"
|
||||
@update="update($event,'businessLicenceInfo')"></businessLicenceInfo>
|
||||
<storeInfo v-if="step==3" :maxSize="maxSize" :data="form.storeInfo" @update="update($event,'storeInfo')">
|
||||
</storeInfo>
|
||||
<settlementInfo v-if="step==4" :maxSize="maxSize" :data="form.settlementInfo"
|
||||
@update="update($event,'settlementInfo')">
|
||||
</settlementInfo>
|
||||
</view>
|
||||
<bottomBtnGroup @save="saveClick" @cancel="cancelClick" :cancelText="cancelText" :confirmText="confirmText">
|
||||
</bottomBtnGroup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import steps from './components/steps.vue'
|
||||
import basicInfo from './components/basic-info.vue'
|
||||
import legalPerpoleInfo from './components/legalPerpole-info.vue'
|
||||
import businessLicenceInfo from './components/business-licence-info.vue'
|
||||
import storeInfo from './components/store-info.vue'
|
||||
import settlementInfo from './components/settlement-info.vue'
|
||||
import bottomBtnGroup from './components/bottom-btn-group.vue'
|
||||
import dayjs from 'dayjs'
|
||||
import {
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
rules,
|
||||
isEmptyValue,
|
||||
returnKey,
|
||||
getNestedValue,
|
||||
verifyValue,
|
||||
verifyData
|
||||
} from './data.js'
|
||||
import {
|
||||
reactive,
|
||||
ref,
|
||||
watch,
|
||||
onMounted,
|
||||
computed
|
||||
} from 'vue';
|
||||
const form = reactive({
|
||||
"shopId": '',
|
||||
"merchantCode": '',
|
||||
"merchantBaseInfo": {
|
||||
"userType": "0",
|
||||
"shortName": "",
|
||||
"mccCode": "",
|
||||
"alipayAccount": "",
|
||||
"contactPersonType": "LEGAL",
|
||||
"contactName": "",
|
||||
"certType": "0",
|
||||
"contactPersonId": "",
|
||||
"contactPersonIdStartDate": dayjs().valueOf(),
|
||||
"contactPersonIdEndDate": dayjs().add(10, 'year').valueOf(),
|
||||
"contactIdCardBackPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"contactIdCardFrontPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"contactPhone": "",
|
||||
"contactAddr": "",
|
||||
"contactEmail": "",
|
||||
"companyChildType": "1"
|
||||
},
|
||||
"legalPersonInfo": {
|
||||
"legalPersonName": "",
|
||||
"legalPersonId": "",
|
||||
"legalIdPersonStartDate": dayjs().valueOf(),
|
||||
"legalPersonIdEndDate": dayjs().add(10, 'year').valueOf(),
|
||||
"legalPersonPhone": "",
|
||||
"legalPersonEmail": "",
|
||||
"legalGender": "",
|
||||
"legalAddress": "",
|
||||
"idCardHandPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"idCardFrontPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"idCardBackPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
}
|
||||
},
|
||||
"businessLicenceInfo": {
|
||||
"licenceName": "",
|
||||
"licenceNo": "",
|
||||
"licenceStartDate": dayjs().valueOf(),
|
||||
"licenceEndDate": dayjs().add(10, 'year').valueOf(),
|
||||
"registeredAddress": "",
|
||||
"licensePic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
}
|
||||
},
|
||||
"storeInfo": {
|
||||
"mercProvCode": "",
|
||||
"mercCityCode": "",
|
||||
"mercAreaCode": "",
|
||||
"mercProv": "",
|
||||
"mercCity": "",
|
||||
"mercArea": "",
|
||||
"businessAddress": "",
|
||||
"insidePic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"doorPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"cashierDeskPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
}
|
||||
},
|
||||
"settlementInfo": {
|
||||
"settlementType": "0",
|
||||
"noLegalName": "",
|
||||
"noLegalId": "",
|
||||
"settlementCardType": "21",
|
||||
"settlementCardNo": "",
|
||||
"settlementName": "",
|
||||
"bankMobile": "",
|
||||
"openAccProvinceId": "",
|
||||
"openAccCityId": "",
|
||||
"openAccAreaId": "",
|
||||
"openAccProvince": "",
|
||||
"openAccCity": "",
|
||||
"openAccArea": "",
|
||||
"bankName": "",
|
||||
"bankInstId": "",
|
||||
"bankType": "",
|
||||
"bankBranchName": "",
|
||||
"bankBranchCode": "",
|
||||
"bankCardFrontPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"bankCardBackPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"openAccountLicencePic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"noLegalHandSettleAuthPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"noLegalSettleAuthPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"noLegalIdCardFrontPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"noLegalIdCardBackPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
import {
|
||||
addEntryManager,
|
||||
getEntryManager
|
||||
} from '@/http/api/order/entryManager.js'
|
||||
onLoad((opt) => {
|
||||
if (opt.licenceNo && opt.shopId) {
|
||||
getEntryManager(opt).then(res => {
|
||||
|
||||
res.merchantBaseInfo.contactPersonIdEndDate = dayjs(res.merchantBaseInfo
|
||||
.contactPersonIdEndDate).valueOf()
|
||||
res.merchantBaseInfo.contactPersonIdStartDate = dayjs(res.merchantBaseInfo
|
||||
.contactPersonIdStartDate).valueOf()
|
||||
|
||||
res.legalPersonInfo.legalIdPersonStartDate = dayjs(res.legalPersonInfo
|
||||
.legalIdPersonStartDate).valueOf()
|
||||
res.legalPersonInfo.legalPersonIdEndDate = dayjs(res.legalPersonInfo
|
||||
.legalPersonIdEndDate).valueOf()
|
||||
res.businessLicenceInfo.licenceStartDate = dayjs(res.businessLicenceInfo
|
||||
.licenceStartDate).valueOf()
|
||||
res.businessLicenceInfo.licenceEndDate = dayjs(res.businessLicenceInfo
|
||||
.licenceEndDate).valueOf()
|
||||
|
||||
|
||||
Object.assign(form, res)
|
||||
})
|
||||
|
||||
} else {
|
||||
// const data = uni.getStorageSync('entryManager_submit_data')
|
||||
// if (data) {
|
||||
// Object.assign(form, data)
|
||||
// }
|
||||
form.shopId = opt.shopId || ''
|
||||
}
|
||||
|
||||
watch(() => form, (newval) => {
|
||||
uni.setStorageSync('entryManager_submit_data', form)
|
||||
}, {
|
||||
deep: true,
|
||||
immediate: true
|
||||
})
|
||||
})
|
||||
|
||||
function returnSettlementInfoRule() {
|
||||
let rule = {
|
||||
...rules.settlementInfo
|
||||
}
|
||||
if (form.settlementType * 1 == 0) {
|
||||
rule = {
|
||||
...rule,
|
||||
'noLegalHandSettleAuthPic.url': {
|
||||
required: true,
|
||||
errorMsg: '请上传非法人手持结算授权书',
|
||||
},
|
||||
'noLegalSettleAuthPic.url': {
|
||||
required: true,
|
||||
errorMsg: '请上传非法人结算授权书',
|
||||
},
|
||||
'noLegalIdCardFrontPic.url': {
|
||||
required: true,
|
||||
errorMsg: '请上传非法人身份证正面',
|
||||
},
|
||||
'noLegalIdCardBackPic.url': {
|
||||
required: true,
|
||||
errorMsg: '请上传非法人身份证反面',
|
||||
},
|
||||
noLegalName: {
|
||||
required: true,
|
||||
errorMsg: '请填写非法人姓名',
|
||||
},
|
||||
noLegalName: {
|
||||
required: true,
|
||||
errorMsg: '请填写非法人身份证号码',
|
||||
}
|
||||
}
|
||||
}
|
||||
if (form.settlementCardType * 1 == 21) {
|
||||
rule = {
|
||||
'bankCardBackPic.url': {
|
||||
required: true,
|
||||
errorMsg: '请上传银行卡反面照片',
|
||||
}
|
||||
}
|
||||
}
|
||||
return rule
|
||||
}
|
||||
|
||||
function returnMerchantBaseInfoRule() {
|
||||
let rule = rules.merchantBaseInfo
|
||||
if (form.merchantBaseInfo.contactPersonType == 'SUPER') {
|
||||
rule = {
|
||||
...rule,
|
||||
'contactIdCardFrontPic.url': {
|
||||
required: true,
|
||||
errorMsg: '请上传联系人身份证正面照片',
|
||||
},
|
||||
'contactIdCardBackPic.url': {
|
||||
required: true,
|
||||
errorMsg: '请上传联系人身份证反面照片',
|
||||
},
|
||||
contactName: {
|
||||
required: true,
|
||||
errorMsg: '请填写联系人姓名',
|
||||
},
|
||||
contactPersonId: {
|
||||
required: true,
|
||||
errorMsg: '请填写联系人身份证号',
|
||||
},
|
||||
contactPersonIdStartDate: {
|
||||
required: true,
|
||||
errorMsg: '请填写联系人身份证开始日期',
|
||||
},
|
||||
contactPersonIdEndDate: {
|
||||
required: true,
|
||||
errorMsg: '请填写联系人身份证到期日期',
|
||||
},
|
||||
contactPhone: {
|
||||
required: true,
|
||||
errorMsg: '请填写联系人电话',
|
||||
},
|
||||
contactAddr: {
|
||||
required: true,
|
||||
errorMsg: '请填写联系人通讯地址',
|
||||
},
|
||||
contactEmail: {
|
||||
required: true,
|
||||
errorMsg: '请填写联系人邮箱',
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log('rule', rule);
|
||||
return rule
|
||||
}
|
||||
const maxSize = ref(2)
|
||||
const step = ref(0)
|
||||
|
||||
|
||||
const ruleArr=['merchantBaseInfo','legalPersonInfo','businessLicenceInfo','storeInfo','settlementInfo']
|
||||
function stepItemClick(newStep) {
|
||||
|
||||
const arr=ruleArr.slice(0,newStep-1)
|
||||
let isPas = true
|
||||
let result = null
|
||||
for (let index in arr) {
|
||||
const key=arr[index]
|
||||
if (key == 'settlementInfo') {
|
||||
result = verifyData(form[key], returnSettlementInfoRule())
|
||||
} else if (key == 'merchantBaseInfo') {
|
||||
result = verifyData(form[key], returnMerchantBaseInfoRule())
|
||||
} else {
|
||||
result = verifyData(form[key], rules[key])
|
||||
}
|
||||
if (!result.ispas) {
|
||||
uni.showToast({
|
||||
title: result.errorMsg || '请完善必填内容',
|
||||
icon: 'none'
|
||||
})
|
||||
result.step = index
|
||||
return result
|
||||
}
|
||||
}
|
||||
step.value = newStep
|
||||
}
|
||||
|
||||
|
||||
|
||||
function verifyForm(step = null) {
|
||||
let result = {
|
||||
ispas: true,
|
||||
errorMsg: '',
|
||||
step: -1,
|
||||
}
|
||||
if (step != null) {
|
||||
if (step == 0) {
|
||||
result = verifyData(form.merchantBaseInfo, returnMerchantBaseInfoRule())
|
||||
result.step = 0;
|
||||
}
|
||||
if (step == 1) {
|
||||
result = verifyData(form.legalPersonInfo, rules.legalPersonInfo)
|
||||
result.step = 1;
|
||||
}
|
||||
if (step == 2) {
|
||||
result = verifyData(form.businessLicenceInfo, rules.businessLicenceInfo)
|
||||
result.step = 2;
|
||||
}
|
||||
if (step == 3) {
|
||||
result = verifyData(form.storeInfo, rules.storeInfo)
|
||||
result.step = 3;
|
||||
}
|
||||
if (step == 4) {
|
||||
result = verifyData(form.storeInfo, returnSettlementInfoRule())
|
||||
result.step = 4;
|
||||
}
|
||||
|
||||
} else {
|
||||
let isPas = true
|
||||
let errorMsg = '';
|
||||
let result = null
|
||||
let index = -1;
|
||||
for (let key in rules) {
|
||||
index++
|
||||
if (key == 'settlementInfo') {
|
||||
result = verifyData(form[key], returnSettlementInfoRule())
|
||||
} else if (key == 'merchantBaseInfo') {
|
||||
result = verifyData(form[key], returnMerchantBaseInfoRule())
|
||||
} else {
|
||||
result = verifyData(form[key], rules[key])
|
||||
}
|
||||
if (!result.ispas) {
|
||||
uni.showToast({
|
||||
title: errorMsg || '请完善必填内容',
|
||||
icon: 'none'
|
||||
})
|
||||
result.step = index
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function saveClick() {
|
||||
|
||||
if (step.value == 4) {
|
||||
const {
|
||||
ispas,
|
||||
errorMsg,
|
||||
step: errorStep
|
||||
} = verifyForm()
|
||||
console.log(form.settlementInfo);
|
||||
if (!ispas) {
|
||||
uni.showToast({
|
||||
title: errorMsg || '请完善必填内容',
|
||||
icon: 'none'
|
||||
})
|
||||
step.value = errorStep
|
||||
return
|
||||
}
|
||||
}
|
||||
if (step.value < 4) {
|
||||
const {
|
||||
ispas,
|
||||
errorMsg,
|
||||
step: errorStep
|
||||
} = verifyForm(step.value)
|
||||
console.log('ispas', ispas);
|
||||
console.log('errorMsg', errorMsg);
|
||||
console.log('errorStep', errorStep);
|
||||
if (!ispas) {
|
||||
uni.showToast({
|
||||
title: errorMsg || '请完善必填内容',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (step.value != 4) {
|
||||
step.value++
|
||||
return
|
||||
}
|
||||
|
||||
const merchantBaseInfo = {
|
||||
...form.merchantBaseInfo,
|
||||
contactPersonIdEndDate: dayjs(form.merchantBaseInfo.contactPersonIdEndDate).format('YYY-MM-DD'),
|
||||
contactPersonIdStartDate: dayjs(form.merchantBaseInfo.contactPersonIdStartDate).format('YYY-MM-DD'),
|
||||
}
|
||||
const legalPersonInfo = {
|
||||
...form.legalPersonInfo,
|
||||
legalIdPersonStartDate: dayjs(form.legalPersonInfo.legalIdPersonStartDate).format('YYYY-MM-DD'),
|
||||
legalPersonIdEndDate: dayjs(form.legalPersonInfo.legalPersonIdEndDate).format('YYYY-MM-DD'),
|
||||
}
|
||||
const businessLicenceInfo = {
|
||||
...form.businessLicenceInfo,
|
||||
licenceStartDate: dayjs(form.businessLicenceInfo.licenceStartDate).format('YYYY-MM-DD'),
|
||||
licenceEndDate: dayjs(form.businessLicenceInfo.licenceEndDate).format('YYYY-MM-DD'),
|
||||
}
|
||||
|
||||
addEntryManager({
|
||||
...form,
|
||||
merchantBaseInfo,
|
||||
legalPersonInfo,
|
||||
businessLicenceInfo
|
||||
}).then(res => {
|
||||
if (res) {
|
||||
uni.showToast({
|
||||
title: '提交成功',
|
||||
})
|
||||
uni.removeStorageSync('entryManager_submit_data')
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1000)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '提交失败',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
function cancelClick() {
|
||||
if (step.value == 0) {
|
||||
return uni.navigateBack()
|
||||
}
|
||||
step.value--;
|
||||
}
|
||||
|
||||
function update(value, key) {
|
||||
if (form.hasOwnProperty(key)) {
|
||||
form[key] = value
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const cancelText = computed(() => {
|
||||
if (step.value == 0) {
|
||||
return '返回'
|
||||
}
|
||||
return '上一步'
|
||||
})
|
||||
const confirmText = computed(() => {
|
||||
if (step.value == 4) {
|
||||
return '提交'
|
||||
}
|
||||
return '下一步'
|
||||
})
|
||||
onMounted(() => {
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.min-page {
|
||||
padding: 32rpx 28rpx;
|
||||
}
|
||||
|
||||
.container {
|
||||
padding: 32rpx 28rpx;
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 32rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
</style>
|
||||
253
entryManager/add/components/bank-select.vue
Normal file
253
entryManager/add/components/bank-select.vue
Normal file
@@ -0,0 +1,253 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
<view class="box" @click.stop="openPopup">
|
||||
<text class="u-font-28 color-999 u-p-r-16" v-if="!modelValue">请选择</text>
|
||||
<text class="u-font-28 color-333 u-p-r-16" v-else>{{returnLabel()}}</text>
|
||||
<view class="icon">
|
||||
<up-icon name="arrow-down" size="14" color="#999"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<up-popup :show="show" placement="bottom" round="18rpx" closeOnClickOverlay @close="close">
|
||||
<view class="u-p-30">
|
||||
<view class="font-bold color-333 u-font-32">选择银行</view>
|
||||
<view class="u-m-t-24">
|
||||
<up-search v-model="query.bankName" @search="search" @change="bankNameChange" @custom="search"
|
||||
@clear="search"></up-search>
|
||||
</view>
|
||||
<scroll-view @scrolltolower="scrolltolower" scroll-with-animation :scroll-into-view="selid"
|
||||
class="scroll-view u-m-t-30" scroll-y="true" style="max-height :60vh;">
|
||||
<view class="u-m-b-10 u-flex item" v-for="item in list" :key="item.id" @click="itemClick(item)"
|
||||
:id="'shop_'+item.id" :class="{active:selItem&&selItem.id==item.id}">
|
||||
<view class="checkbox">
|
||||
<up-icon name="checkbox-mark" color="#fff"></up-icon>
|
||||
</view>
|
||||
<view class="u-flex-1">{{item.bankAlias}}</view>
|
||||
</view>
|
||||
|
||||
<up-loadmore :status="isEnd?'nomore':'loading'"></up-loadmore>
|
||||
</scroll-view>
|
||||
<view class="u-flex gap-20 u-m-t-30">
|
||||
<view class="u-flex-1">
|
||||
<my-button type="default" @click="close">取消</my-button>
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
<my-button type="primary" @click="submit">确定</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
nextTick,
|
||||
onMounted,
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
bankInfo
|
||||
} from '@/http/api/system/common.js';
|
||||
const customStyle = ref({
|
||||
marginRight: '20px'
|
||||
});
|
||||
|
||||
const show = ref(false);
|
||||
const modelValue = defineModel();
|
||||
|
||||
const bankInstId = defineModel('bankInstId');
|
||||
|
||||
|
||||
const bankAliasCode=defineModel('bankAliasCode')
|
||||
|
||||
const wxProvinceCode=defineModel('wxProvinceCode')
|
||||
|
||||
|
||||
const selid = ref('')
|
||||
|
||||
function returnLabel() {
|
||||
const findShop = list.value.find(v => v.bankAlias == modelValue.value)
|
||||
return findShop ? findShop.bankAlias : ''
|
||||
}
|
||||
|
||||
const selItem = ref(null)
|
||||
|
||||
function itemClick(bank) {
|
||||
selItem.value = bank;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function close() {
|
||||
show.value = false;
|
||||
}
|
||||
|
||||
function submit() {
|
||||
modelValue.value = selItem.value.bankAlias
|
||||
bankInstId.value = selItem.value.bankCode
|
||||
bankAliasCode.value=selItem.value.bankAliasCode;
|
||||
console.log('modelValue', modelValue.value);
|
||||
console.log('bankInstId', bankInstId.value);
|
||||
show.value = false;
|
||||
|
||||
}
|
||||
|
||||
function search() {
|
||||
isEnd.value = false
|
||||
query.page = 1
|
||||
init()
|
||||
}
|
||||
|
||||
const list = ref([]);
|
||||
watch(() => modelValue.value, (newval) => {
|
||||
if (newval) {
|
||||
const findShop = list.value.find(v => v.bankAlias == modelValue.value)
|
||||
if (findShop) {
|
||||
selid.value = 'shop_' + findShop.id
|
||||
selItem.value = findShop
|
||||
bankInstId.value = findShop.bankCode
|
||||
bankAliasCode.value = findShop.bankAliasCode
|
||||
wxProvinceCode.value=findShop.wxProvinceCode
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
function openPopup() {
|
||||
const findShop = list.value.find(v => v.bankAlias == modelValue.value)
|
||||
if (findShop) {
|
||||
selid.value = 'shop_' + findShop.id
|
||||
selItem.value = findShop
|
||||
}
|
||||
show.value = true;
|
||||
|
||||
}
|
||||
|
||||
// --------------- 核心新增:节流函数实现 ---------------
|
||||
/**
|
||||
* 节流函数:限制函数在指定时间内只触发一次
|
||||
* @param {Function} fn - 要节流的函数
|
||||
* @param {number} delay - 节流延迟时间(毫秒)
|
||||
* @returns {Function} 节流后的函数
|
||||
*/
|
||||
function throttle(fn, delay = 300) {
|
||||
let timer = null; // 定时器标识
|
||||
return function(...args) {
|
||||
// 如果已有定时器,直接返回(未到触发时间)
|
||||
if (timer) return;
|
||||
// 执行函数并设置新定时器
|
||||
fn.apply(this, args);
|
||||
timer = setTimeout(() => {
|
||||
clearTimeout(timer);
|
||||
timer = null;
|
||||
}, delay);
|
||||
};
|
||||
}
|
||||
|
||||
// --------------- 核心修改:创建节流后的search方法 ---------------
|
||||
// 300ms内只触发一次search,可根据需求调整delay值(如500ms)
|
||||
const throttledSearch = throttle(search, 300);
|
||||
|
||||
// --------------- 改造bankNameChange:调用节流后的搜索 ---------------
|
||||
function bankNameChange() {
|
||||
// 输入变化时,调用节流后的搜索方法
|
||||
throttledSearch();
|
||||
}
|
||||
|
||||
const query = reactive({
|
||||
page: 1,
|
||||
size: 10,
|
||||
bankName: ''
|
||||
})
|
||||
const isEnd = ref(false)
|
||||
|
||||
function scrolltolower() {
|
||||
if (isEnd.value) {
|
||||
return
|
||||
}
|
||||
query.page++
|
||||
init()
|
||||
}
|
||||
|
||||
|
||||
async function init() {
|
||||
const res = await bankInfo(query);
|
||||
isEnd.value = query.page >= res.totalPage * 1 ? true : false
|
||||
if (res) {
|
||||
if (query.page == 1) {
|
||||
list.value = res.records
|
||||
} else {
|
||||
list.value = list.value.concat(res.records)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
onMounted(init);
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.box {
|
||||
border-radius: 8upx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: top;
|
||||
flex-wrap: wrap;
|
||||
padding: 20rpx 24rpx;
|
||||
border: 2rpx solid #e5e5e5;
|
||||
position: relative;
|
||||
|
||||
.icon {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 24rpx;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
.shop-item {
|
||||
padding: 4rpx 8rpx 4rpx 16rpx;
|
||||
border-radius: 4rpx;
|
||||
border: 2rpx solid #f0f0f0;
|
||||
background-color: #f5f5f5;
|
||||
margin-bottom: 16rpx;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.scroll-view {
|
||||
.item {
|
||||
border: 1px solid #eee;
|
||||
padding: 20rpx;
|
||||
border-radius: 12rpx;
|
||||
|
||||
&.active {
|
||||
border-color: $my-main-color;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
margin-right: 10rpx;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 6rpx;
|
||||
border: 1px solid #999;
|
||||
|
||||
}
|
||||
|
||||
.item {
|
||||
&.active {
|
||||
.checkbox {
|
||||
background-color: $my-main-color;
|
||||
border-color: $my-main-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
292
entryManager/add/components/bankBranchList.vue
Normal file
292
entryManager/add/components/bankBranchList.vue
Normal file
@@ -0,0 +1,292 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
<view class="box" @click.stop="openPopup">
|
||||
<text class="u-font-28 color-999 u-p-r-16" v-if="!modelValue">请选择</text>
|
||||
<text class="u-font-28 color-333 u-p-r-16" v-else>{{returnLabel()}}</text>
|
||||
<view class="icon">
|
||||
<up-icon name="arrow-down" size="14" color="#999"></up-icon>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<up-popup :show="show" placement="bottom" round="18rpx" closeOnClickOverlay @close="close">
|
||||
<view class="u-p-30">
|
||||
<view class="font-bold color-333 u-font-32">选择银行</view>
|
||||
<view class="u-m-t-24">
|
||||
<up-search v-model="keywords" @search="search" @change="search" @custom="search"
|
||||
@clear="search"></up-search>
|
||||
</view>
|
||||
<scroll-view scroll-with-animation :scroll-into-view="selid" class="scroll-view u-m-t-30"
|
||||
scroll-y="true" style="max-height :60vh;">
|
||||
<template v-if="list.length">
|
||||
<view class="u-m-b-10 u-flex item" v-for="item in list" :key="item.bankCode"
|
||||
@click="itemClick(item)" :id="'shop_'+item.bankCode"
|
||||
:class="{active:selItem&&selItem.bankCode==item.bankCode}">
|
||||
<view class="checkbox">
|
||||
<up-icon name="checkbox-mark" color="#fff"></up-icon>
|
||||
</view>
|
||||
<view class="u-flex-1">{{item.branchName}}</view>
|
||||
</view>
|
||||
<view class="u-p-20 u-flex u-row-center">
|
||||
<up-loadmore status="nomore"></up-loadmore>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="keywords">
|
||||
<up-empty text="未搜索到相关支行"></up-empty>
|
||||
</template>
|
||||
<up-empty v-else text="暂无支行"></up-empty>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
</scroll-view>
|
||||
<view class="u-flex gap-20 u-m-t-30">
|
||||
<view class="u-flex-1">
|
||||
<my-button type="default" @click="close">取消</my-button>
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
<my-button type="primary" @click="submit">确定</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
onMounted,
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
bankBranchList
|
||||
} from '@/http/api/order/entryManager.js';
|
||||
|
||||
const customStyle = ref({
|
||||
marginRight: '20px'
|
||||
});
|
||||
|
||||
const show = ref(false);
|
||||
const modelValue = defineModel();
|
||||
const bankBranchName = defineModel('bankBranchName', {
|
||||
default: '',
|
||||
});
|
||||
|
||||
const selid = ref('')
|
||||
|
||||
function returnLabel() {
|
||||
const findShop = list.value.find(v => v.bankCode == modelValue.value)
|
||||
return findShop ? findShop.branchName : ''
|
||||
}
|
||||
const selItem = ref(null)
|
||||
|
||||
function itemClick(data) {
|
||||
selItem.value = data
|
||||
}
|
||||
|
||||
function returnbranchName(bankCode) {
|
||||
const item = list.value.find((v) => v.bankCode == bankCode);
|
||||
return item?.branchName || '';
|
||||
}
|
||||
|
||||
function close() {
|
||||
show.value = false;
|
||||
}
|
||||
|
||||
function submit() {
|
||||
modelValue.value = selItem.value.bankCode
|
||||
bankBranchName.value = selItem.value.branchName
|
||||
show.value = false;
|
||||
}
|
||||
|
||||
const keywords = ref('')
|
||||
|
||||
function search() {
|
||||
list.value = matchStr(allList, keywords.value)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 模糊匹配对象数组中每个对象的全部属性,按匹配度由高到低排序返回,未匹配到的对象直接过滤(不返回)
|
||||
* @param {Array<Object>} arr - 待匹配的对象数组(必传,非数组返回空数组)
|
||||
* @param {string} str - 待匹配的目标字符串(空字符串返回原数组浅拷贝)
|
||||
* @returns {Array<Object>} 按匹配度降序排序后的对象数组(仅包含匹配项,不修改原数组)
|
||||
*/
|
||||
function matchStr(arr, str) {
|
||||
// ------------- 步骤1:严格边界处理,避免运行报错 -------------
|
||||
if (!Array.isArray(arr)) {
|
||||
console.warn('入参arr必须是对象数组');
|
||||
return [];
|
||||
}
|
||||
const targetStr = String(str || '').trim().toLowerCase();
|
||||
if (!targetStr) {
|
||||
return [...arr]; // 空字符串返回原数组浅拷贝(保持原有逻辑)
|
||||
}
|
||||
|
||||
// ------------- 步骤2:定义匹配度得分规则 -------------
|
||||
const getSinglePropScore = (propValue) => {
|
||||
const propStr = String(propValue).trim().toLowerCase();
|
||||
if (propStr === targetStr) return 3;
|
||||
if (propStr.startsWith(targetStr)) return 2;
|
||||
if (propStr.includes(targetStr)) return 1;
|
||||
return 0;
|
||||
};
|
||||
|
||||
// ------------- 步骤3:遍历数组,计算每个对象的总匹配度得分 -------------
|
||||
const arrWithScore = arr.map(item => {
|
||||
if (typeof item !== 'object' || item === null) {
|
||||
return {
|
||||
originItem: item,
|
||||
totalScore: 0
|
||||
};
|
||||
}
|
||||
|
||||
let totalScore = 0;
|
||||
Object.keys(item).forEach(propKey => {
|
||||
const propValue = item[propKey];
|
||||
totalScore += getSinglePropScore(propValue);
|
||||
});
|
||||
|
||||
return {
|
||||
originItem: item,
|
||||
totalScore: totalScore
|
||||
};
|
||||
});
|
||||
|
||||
// ------------- 步骤4:先过滤(仅保留得分>0的项),再排序,最后返回原对象格式 -------------
|
||||
return arrWithScore
|
||||
.filter(item => item.totalScore > 0) // 核心新增:过滤未匹配项(总得分=0的对象不保留)
|
||||
.sort((a, b) => b.totalScore - a.totalScore) // 仅对匹配项进行降序排序
|
||||
.map(item => item.originItem); // 剔除得分字段,返回原对象格式
|
||||
}
|
||||
|
||||
const list = ref([]);
|
||||
|
||||
function openPopup() {
|
||||
selid.value = 'shop_' + modelValue.value
|
||||
const findShop = list.value.find(v => v.bankCode == modelValue.value)
|
||||
selItem.value=findShop?findShop:null
|
||||
show.value = true;
|
||||
|
||||
}
|
||||
|
||||
// --------------- 核心新增:节流函数实现 ---------------
|
||||
/**
|
||||
* 节流函数:限制函数在指定时间内只触发一次
|
||||
* @param {Function} fn - 要节流的函数
|
||||
* @param {number} delay - 节流延迟时间(毫秒)
|
||||
* @returns {Function} 节流后的函数
|
||||
*/
|
||||
function throttle(fn, delay = 300) {
|
||||
let timer = null; // 定时器标识
|
||||
return function(...args) {
|
||||
// 如果已有定时器,直接返回(未到触发时间)
|
||||
if (timer) return;
|
||||
// 执行函数并设置新定时器
|
||||
fn.apply(this, args);
|
||||
timer = setTimeout(() => {
|
||||
clearTimeout(timer);
|
||||
timer = null;
|
||||
}, delay);
|
||||
};
|
||||
}
|
||||
|
||||
// --------------- 核心修改:创建节流后的search方法 ---------------
|
||||
// 300ms内只触发一次search,可根据需求调整delay值(如500ms)
|
||||
const throttledSearch = throttle(search, 300);
|
||||
|
||||
// --------------- 改造bankNameChange:调用节流后的搜索 ---------------
|
||||
function bankNameChange() {
|
||||
// 输入变化时,调用节流后的搜索方法
|
||||
throttledSearch();
|
||||
}
|
||||
|
||||
const props = defineProps({
|
||||
query: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
province: '',
|
||||
city: '',
|
||||
instId: '',
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
watch(() => show.value, (newval) => {
|
||||
init()
|
||||
})
|
||||
|
||||
let allList = []
|
||||
async function init() {
|
||||
const res = await bankBranchList(props.query);
|
||||
list.value = res
|
||||
allList = res
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.box {
|
||||
border-radius: 8upx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: top;
|
||||
flex-wrap: wrap;
|
||||
padding: 20rpx 40rpx 20rpx 24rpx;
|
||||
border: 2rpx solid #e5e5e5;
|
||||
position: relative;
|
||||
|
||||
.icon {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 24rpx;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
.shop-item {
|
||||
padding: 4rpx 8rpx 4rpx 16rpx;
|
||||
border-radius: 4rpx;
|
||||
border: 2rpx solid #f0f0f0;
|
||||
background-color: #f5f5f5;
|
||||
margin-bottom: 16rpx;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.scroll-view {
|
||||
.item {
|
||||
border: 1px solid #eee;
|
||||
padding: 20rpx;
|
||||
border-radius: 12rpx;
|
||||
|
||||
&.active {
|
||||
border-color: $my-main-color;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
margin-right: 10rpx;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 6rpx;
|
||||
border: 1px solid #999;
|
||||
|
||||
}
|
||||
|
||||
.item {
|
||||
&.active {
|
||||
.checkbox {
|
||||
background-color: $my-main-color;
|
||||
border-color: $my-main-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
306
entryManager/add/components/basic-info.vue
Normal file
306
entryManager/add/components/basic-info.vue
Normal file
@@ -0,0 +1,306 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="u-font-32 font-bold u-m-32 text-center">商户基础信息</view>
|
||||
<view class="container">
|
||||
<!-- <view class="form-item">
|
||||
<view class="font-bold u-m-b-16">店铺</view>
|
||||
<shopSelect></shopSelect>
|
||||
</view> -->
|
||||
<view class="form-item required">
|
||||
<view class="title">商户类型</view>
|
||||
<up-radio-group v-model="form.userType">
|
||||
<up-radio v-for="(value,key) in userTypes" :label="value" :name="key">
|
||||
</up-radio>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title">企业类型</view>
|
||||
<up-radio-group v-model="form.companyChildType">
|
||||
<up-radio v-for="(value,key) in companyChildTypes" :label="value" :name="key">
|
||||
</up-radio>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title">商户简称</view>
|
||||
<up-input placeholder="商户简称" :placeholder-class="placeholderClass" v-model="form.shortName"></up-input>
|
||||
</view>
|
||||
<view class="form-item required">
|
||||
<view class="title"> 行业类目</view>
|
||||
<mccCategory v-model="form.mccCode"></mccCategory>
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 支付宝账号</view>
|
||||
<up-input placeholder="支付宝账号" :placeholder-class="placeholderClass"
|
||||
v-model="form.alipayAccount"></up-input>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title">联系人类型</view>
|
||||
<up-radio-group v-model="form.contactPersonType">
|
||||
<up-radio v-for="(value,key) in contactPersonTypes" :label="value" :name="key">
|
||||
</up-radio>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
|
||||
<template v-if="form.contactPersonType=='SUPER'">
|
||||
<view class="form-item required">
|
||||
<view class="title"> 联系人身份证正面(国徽)</view>
|
||||
<my-upload-img v-model="form.contactIdCardFrontPic.url" :size="200"
|
||||
@uploadSuccess="uploadSuccess($event,'IdCard','contactIdCardFrontPic')"></my-upload-img>
|
||||
|
||||
</view>
|
||||
<view class="form-item required">
|
||||
<view class="title"> 联系人身份证背面(头像)</view>
|
||||
<my-upload-img v-model="form.contactIdCardBackPic.url" :size="200"
|
||||
@uploadSuccess="uploadSuccess($event,'IdCard','contactIdCardBackPic')"></my-upload-img>
|
||||
</view>
|
||||
|
||||
<!-- <view class="form-item required">
|
||||
<view class="title">证件类型</view>
|
||||
<up-radio-group v-model="form.certType">
|
||||
<up-radio v-for="(value,key) in certTypes" :label="value" :name="key">
|
||||
</up-radio>
|
||||
</up-radio-group>
|
||||
</view> -->
|
||||
<view class="form-item required">
|
||||
<view class="title"> 联系人姓名</view>
|
||||
<up-input placeholder="联系人姓名" :placeholder-class="placeholderClass"
|
||||
v-model="form.contactName"></up-input>
|
||||
</view>
|
||||
<view class="form-item required">
|
||||
<view class="title"> 联系人身份证号</view>
|
||||
<up-input placeholder="联系人身份证号" :placeholder-class="placeholderClass"
|
||||
v-model="form.contactPersonId"></up-input>
|
||||
</view>
|
||||
<view class="form-item required">
|
||||
<view class="title"> 联系人身份证开始日期</view>
|
||||
<up-datetime-picker hasInput :minDate="minDate" :maxDate="maxDate" format="YYYY-MM-DD"
|
||||
placeholder="请选择" v-model="form.contactPersonIdStartDate" mode="date">
|
||||
</up-datetime-picker>
|
||||
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 联系人身份证到期日期</view>
|
||||
<view class="u-m-b-16">
|
||||
<up-radio-group v-model="contactPersonIdEndDateType">
|
||||
<up-radio :name="1" label="有结束日期"></up-radio>
|
||||
<up-radio :name="2" label="长期有效"></up-radio>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
<template v-if="contactPersonIdEndDateType==1">
|
||||
<up-datetime-picker hasInput :minDate="endDataMinDate" :maxDate="maxDate" format="YYYY-MM-DD"
|
||||
placeholder="请选择" v-model="form.contactPersonIdEndDate" mode="date">
|
||||
</up-datetime-picker>
|
||||
</template>
|
||||
|
||||
|
||||
</view>
|
||||
<view class="form-item required ">
|
||||
<view class="title"> 联系人电话</view>
|
||||
<up-input placeholder="联系人电话" :placeholder-class="placeholderClass"
|
||||
v-model="form.contactPhone"></up-input>
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 联系人通讯地址</view>
|
||||
<up-input placeholder="联系人通讯地址" :placeholder-class="placeholderClass"
|
||||
v-model="form.contactAddr"></up-input>
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 联系人邮箱
|
||||
</view>
|
||||
<up-input placeholder="联系人邮箱" :placeholder-class="placeholderClass"
|
||||
v-model="form.contactEmail"></up-input>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
onMounted,
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import shopSelect from './shop-select.vue'
|
||||
import mccCategory from '@/entryManager/components/mcc-category.vue'
|
||||
import {
|
||||
userTypes,
|
||||
contactPersonTypes,
|
||||
companyChildTypes,
|
||||
certTypes
|
||||
} from '@/entryManager/data.js'
|
||||
import {
|
||||
getInfoByImg
|
||||
} from '@/http/api/order/entryManager.js'
|
||||
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
const minDate = dayjs('1970-01-01 00:00:00').valueOf()
|
||||
const maxDate = dayjs('2099-12-31 23:59:59').valueOf()
|
||||
const endDataMinDate = computed(() => {
|
||||
if (!form.contactPersonIdStartDate) {
|
||||
return minDate
|
||||
}
|
||||
if (form.contactPersonIdStartDate) {
|
||||
return dayjs(form.contactPersonIdStartDate).add(10, 'year').valueOf()
|
||||
}
|
||||
return minDate
|
||||
})
|
||||
|
||||
const contactPersonIdEndDateType = ref(1)
|
||||
watch(() => contactPersonIdEndDateType.value, (newval) => {
|
||||
if (newval == 2) {
|
||||
form.contactPersonIdEndDate = maxDate
|
||||
} else {
|
||||
form.contactPersonIdEndDate = dayjs().valueOf()
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
function uploadSuccess(url, type, key) {
|
||||
uni.showLoading({
|
||||
type: '识别中,请稍等……!'
|
||||
})
|
||||
getInfoByImg({
|
||||
url,
|
||||
type
|
||||
}).then(res => {
|
||||
uni.hideLoading()
|
||||
if (res) {
|
||||
const data = res.subImages[0].kvInfo.data
|
||||
if (key == 'contactIdCardFrontPic') {
|
||||
if (data.validPeriod) {
|
||||
const [start, end] = data.validPeriod.split('-')
|
||||
if (start) {
|
||||
form.contactPersonIdStartDate = dayjs(start).valueOf()
|
||||
}
|
||||
if (end) {
|
||||
if (end.includes('长期')) {
|
||||
contactPersonIdEndDateType.value = 2
|
||||
} else {
|
||||
form.contactPersonIdEndDate = dayjs(end).valueOf()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if (key == 'contactIdCardBackPic') {
|
||||
form.contactName = data.name
|
||||
form.contactPersonId = data.idNumber
|
||||
form.contactAddr = data.address
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
const form = reactive({
|
||||
userType: '0',
|
||||
shortName: '',
|
||||
mccCode: '',
|
||||
alipayAccount: '',
|
||||
contactPersonType: 'LEGAL',
|
||||
contactName: '',
|
||||
certType: '0',
|
||||
contactPersonId: '',
|
||||
contactPersonIdStartDate: '',
|
||||
contactPersonIdEndDate: '',
|
||||
contactIdCardBackPic: {
|
||||
url: ''
|
||||
},
|
||||
contactIdCardFrontPic: {
|
||||
url: ''
|
||||
},
|
||||
contactPhone: '',
|
||||
contactAddr: '',
|
||||
contactEmail: '',
|
||||
companyChildType: '1',
|
||||
})
|
||||
|
||||
const placeholderClass = ref('u-font-28')
|
||||
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
const emits = defineEmits(['update'])
|
||||
watch(() => form, (newval) => {
|
||||
console.log('form', form);
|
||||
emits('update', newval)
|
||||
}, {
|
||||
deep: true,
|
||||
immediate: true
|
||||
})
|
||||
|
||||
watch(() => props.data, (newval) => {
|
||||
for (let key in form) {
|
||||
if (props.data.hasOwnProperty(key)) {
|
||||
form[key] = props.data[key]
|
||||
}
|
||||
}
|
||||
}, {
|
||||
deep: true,
|
||||
immediate: true
|
||||
})
|
||||
watch(()=>form.contactPersonIdEndDate,(newval)=>{
|
||||
if(dayjs(newval).format('YYYY-MM-DD')==='2099-12-31'){
|
||||
contactPersonIdEndDateType.value=2
|
||||
}
|
||||
})
|
||||
onMounted(() => {
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
padding: 32rpx 28rpx;
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 32rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
margin-bottom: 32rpx;
|
||||
|
||||
.title {
|
||||
font-weight: 700;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
&.required {
|
||||
.title::before {
|
||||
content: '*';
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
81
entryManager/add/components/bottom-btn-group.vue
Normal file
81
entryManager/add/components/bottom-btn-group.vue
Normal file
@@ -0,0 +1,81 @@
|
||||
<template>
|
||||
<view v-if="isShow">
|
||||
<view class="zhanwei" :class="[direction == 'column' ? 'zhanwei1' : '']"></view>
|
||||
|
||||
<view class="fixed-bottom u-flex gap-20" :class="[direction == 'column' ? 'u-flex-column' : '']">
|
||||
<view class="u-flex-1">
|
||||
<my-button bgColor="#fff" type="default" @click="cancel" shape="circle">
|
||||
{{cancelText}}
|
||||
</my-button>
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
<my-button type="primary" @click="save" shape="circle">
|
||||
{{confirmText}}
|
||||
</my-button>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
computed
|
||||
} from "vue";
|
||||
const emit = defineEmits(["save", "cancel"]);
|
||||
import {
|
||||
isMainShop
|
||||
} from "@/store/account.js";
|
||||
|
||||
const props = defineProps({
|
||||
isOpenPermission: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
cancelText:{
|
||||
type: String,
|
||||
default: "上一步",
|
||||
},
|
||||
confirmText:{
|
||||
type: String,
|
||||
default: "下一步",
|
||||
},
|
||||
//方向 row横向布局 column 纵向布局
|
||||
direction: {
|
||||
type: String,
|
||||
default: "row",
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
const isShow = computed(() => {
|
||||
if (props.isOpenPermission) {
|
||||
return isMainShop();
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
function save() {
|
||||
emit("save");
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
emit("cancel");
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.zhanwei {
|
||||
height: 180rpx;
|
||||
}
|
||||
|
||||
.zhanwei1 {
|
||||
height: 240rpx;
|
||||
}
|
||||
|
||||
.fixed-bottom {
|
||||
&.u-flex-column {
|
||||
align-items: stretch;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
213
entryManager/add/components/business-licence-info.vue
Normal file
213
entryManager/add/components/business-licence-info.vue
Normal file
@@ -0,0 +1,213 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="u-font-32 font-bold u-m-32 text-center">营业执照信息</view>
|
||||
<view class="container">
|
||||
<view class="form-item " :class="isRequired">
|
||||
<view class="title"> 营业执照</view>
|
||||
<my-upload-img v-model="form.licensePic.url" :size="200"
|
||||
@uploadSuccess="uploadSuccess($event,'BusinessLicense')"></my-upload-img>
|
||||
</view>
|
||||
|
||||
<view class="form-item " :class="isRequired">
|
||||
<view class="title"> 营业执照全称</view>
|
||||
<up-input placeholder="营业执照全称" :placeholder-class="placeholderClass"
|
||||
v-model="form.licenceName"></up-input>
|
||||
</view>
|
||||
|
||||
<view class="form-item " :class="isRequired">
|
||||
<view class="title"> 营业执照号码</view>
|
||||
<up-input placeholder="营业执照号码" :placeholder-class="placeholderClass"
|
||||
v-model="form.licenceNo"></up-input>
|
||||
</view>
|
||||
|
||||
<view class="form-item " :class="isRequired">
|
||||
<view class="title"> 营业执照开始日期</view>
|
||||
<up-datetime-picker hasInput :minDate="minDate" :maxDate="dayjs().valueOf()" format="YYYY-MM-DD"
|
||||
placeholder="请选择" v-model="form.licenceStartDate" mode="date">
|
||||
</up-datetime-picker>
|
||||
<!-- <up-input placeholder="营业执照开始日期" :placeholder-class="placeholderClass"
|
||||
v-model="form.licenceStartDate"></up-input> -->
|
||||
</view>
|
||||
|
||||
<view class="form-item " :class="isRequired">
|
||||
<view class="title"> 营业执照结束日期</view>
|
||||
<view class="u-m-b-16">
|
||||
<up-radio-group v-model="licenceEndDateType">
|
||||
<up-radio :name="1" label="有结束日期"></up-radio>
|
||||
<up-radio :name="2" label="长期有效"></up-radio>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
<template v-if="licenceEndDateType==1">
|
||||
<up-datetime-picker hasInput :minDate="form.licenceStartDate||minDate" :maxDate="maxDate"
|
||||
format="YYYY-MM-DD" placeholder="请选择" v-model="form.licenceEndDate" mode="date">
|
||||
</up-datetime-picker>
|
||||
</template>
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
<view class="form-item " :class="isRequired">
|
||||
<view class="title"> 营业执照注册地址</view>
|
||||
<up-input placeholder="营业执照注册地址" :placeholder-class="placeholderClass"
|
||||
v-model="form.registeredAddress"></up-input>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import dayjs from 'dayjs';
|
||||
const minDate = dayjs('1970-01-01 00:00:00').valueOf()
|
||||
const maxDate = dayjs('2099-12-31 23:59:59').valueOf()
|
||||
const licenceEndDateType = ref(1)
|
||||
import {
|
||||
reactive,
|
||||
watch,
|
||||
ref
|
||||
} from 'vue';
|
||||
import shopSelect from './shop-select.vue'
|
||||
import {
|
||||
userTypes,
|
||||
sexs,
|
||||
contactPersonTypes,
|
||||
companyChildTypes,
|
||||
certTypes
|
||||
} from '@/entryManager/data.js'
|
||||
const form = reactive({
|
||||
"licenceName": "",
|
||||
"licenceNo": "",
|
||||
"licenceStartDate": "",
|
||||
"licenceEndDate": "",
|
||||
"registeredAddress": "",
|
||||
"licensePic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
import {
|
||||
getInfoByImg
|
||||
} from '@/http/api/order/entryManager.js'
|
||||
import {
|
||||
includes
|
||||
} from 'lodash';
|
||||
|
||||
watch(() => licenceEndDateType.value, (newval) => {
|
||||
if (newval == 2) {
|
||||
form.licenceEndDate = maxDate
|
||||
} else {
|
||||
form.licenceEndDate = dayjs().add(10, 'year').valueOf()
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
function uploadSuccess(url, type, key) {
|
||||
uni.showLoading({
|
||||
type: '识别中,请稍等……!'
|
||||
})
|
||||
getInfoByImg({
|
||||
url,
|
||||
type
|
||||
}).then(res => {
|
||||
uni.hideLoading()
|
||||
if (res) {
|
||||
const data = res.subImages[0].kvInfo.data
|
||||
form.licenceName = data.companyName
|
||||
form.licenceNo = data.creditCode
|
||||
form.registeredAddress = data.businessAddress
|
||||
if (data.validFromDate) {
|
||||
form.licenceStartDate = dayjs(data.validFromDate).valueOf()
|
||||
}
|
||||
if (data.validToDate) {
|
||||
form.licenceEndDate = dayjs(data.validToDate).valueOf()
|
||||
}
|
||||
// console.log(dayjs(form.licenceEndDate).format('YYYY-MM-DD'));
|
||||
if (data.validPeriod.includes('长期')) {
|
||||
licenceEndDateType.value = 2;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const placeholderClass = ref('u-font-28')
|
||||
|
||||
const isRequired = ref('required')
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
watch(() => props.data, (newval) => {
|
||||
console.log('触发父数据更新')
|
||||
for (let key in form) {
|
||||
if (props.data.hasOwnProperty(key)) {
|
||||
form[key] = props.data[key]
|
||||
}
|
||||
}
|
||||
}, {
|
||||
deep: true,
|
||||
immediate: true
|
||||
})
|
||||
|
||||
const emits = defineEmits(['update'])
|
||||
watch(() => form, (newval) => {
|
||||
|
||||
emits('update', newval)
|
||||
}, {
|
||||
deep: true
|
||||
})
|
||||
|
||||
watch(()=>form.licenceEndDate,(newval)=>{
|
||||
if(dayjs(newval).format('YYYY-MM-DD')==='2099-12-31'){
|
||||
licenceEndDateType.value=2
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
padding: 32rpx 28rpx;
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 32rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
margin-bottom: 32rpx;
|
||||
|
||||
.title {
|
||||
font-weight: 700;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
&.required {
|
||||
.title::before {
|
||||
content: '*';
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.input-box {
|
||||
padding: 9px 10px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #dadbde;
|
||||
}
|
||||
</style>
|
||||
289
entryManager/add/components/legalPerpole-info.vue
Normal file
289
entryManager/add/components/legalPerpole-info.vue
Normal file
@@ -0,0 +1,289 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="u-font-32 font-bold u-m-32 text-center">法人信息</view>
|
||||
<view class="container">
|
||||
|
||||
|
||||
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 身份证正面(国徽)</view>
|
||||
<my-upload-img v-model="form.idCardFrontPic.url" :size="200" :maxSize="maxSize"
|
||||
@uploadSuccess="uploadSuccess($event,'IdCard','idCardFrontPic')"
|
||||
></my-upload-img>
|
||||
</view>
|
||||
<view class="form-item required">
|
||||
<view class="title"> 身份证反面(国徽)</view>
|
||||
<my-upload-img v-model="form.idCardBackPic.url" :size="200" :maxSize="maxSize"
|
||||
@uploadSuccess="uploadSuccess($event,'IdCard','idCardBackPic')"
|
||||
></my-upload-img>
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 身份证手持 图片</view>
|
||||
<my-upload-img v-model="form.idCardHandPic.url" :size="200" :maxSize="maxSize"></my-upload-img>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 法人姓名</view>
|
||||
<up-input placeholder="法人姓名" :placeholder-class="placeholderClass"
|
||||
v-model="form.legalPersonName"></up-input>
|
||||
</view>
|
||||
<view class="form-item required">
|
||||
<view class="title">法人性别</view>
|
||||
<up-radio-group v-model="form.legalGender">
|
||||
<up-radio v-for="(value,key) in sexs" :label="value" :name="key">
|
||||
</up-radio>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 法人身份证号</view>
|
||||
<up-input placeholder="法人身份证号" :placeholder-class="placeholderClass"
|
||||
v-model="form.legalPersonId"></up-input>
|
||||
</view>
|
||||
<view class="form-item required">
|
||||
<view class="title"> 法人身份证开始日期</view>
|
||||
|
||||
<up-datetime-picker hasInput :minDate="minDate" :maxDate="dayjs().valueOf()" format="YYYY-MM-DD"
|
||||
placeholder="请选择" v-model="form.legalIdPersonStartDate" mode="date">
|
||||
</up-datetime-picker>
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 法人身份证到期日期</view>
|
||||
|
||||
<view class="u-m-b-16">
|
||||
<up-radio-group v-model="endDateType">
|
||||
<up-radio :name="1" label="有结束日期"></up-radio>
|
||||
<up-radio :name="2" label="长期有效"></up-radio>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
<template v-if="endDateType==1">
|
||||
<up-datetime-picker hasInput :minDate="endDataMinDate"
|
||||
:maxDate="maxDate" format="YYYY-MM-DD" placeholder="请选择"
|
||||
v-model="form.legalPersonIdEndDate" mode="date">
|
||||
</up-datetime-picker>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 法人电话</view>
|
||||
<up-input placeholder="法人电话" :placeholder-class="placeholderClass"
|
||||
v-model="form.legalPersonPhone"></up-input>
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title">法人地址 </view>
|
||||
<up-input placeholder="法人地址" :placeholder-class="placeholderClass"
|
||||
v-model="form.legalAddress"></up-input>
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title">法人邮箱 </view>
|
||||
<up-input placeholder="法人邮箱" :placeholder-class="placeholderClass"
|
||||
v-model="form.legalPersonEmail"></up-input>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
watch,computed ,
|
||||
ref
|
||||
} from 'vue';
|
||||
import shopSelect from './shop-select.vue'
|
||||
import {
|
||||
userTypes,
|
||||
sexs,
|
||||
contactPersonTypes,
|
||||
companyChildTypes,
|
||||
certTypes
|
||||
} from '@/entryManager/data.js'
|
||||
const form = reactive({
|
||||
"legalPersonName": "",
|
||||
"legalPersonId": "",
|
||||
"legalIdPersonStartDate":'',
|
||||
"legalPersonIdEndDate": '',
|
||||
"legalPersonPhone": "",
|
||||
"legalPersonEmail": "",
|
||||
"legalGender": "",
|
||||
"legalAddress": "",
|
||||
"idCardHandPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"idCardFrontPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"idCardBackPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
import {
|
||||
getInfoByImg
|
||||
} from '@/http/api/order/entryManager.js'
|
||||
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
import { includes } from 'lodash';
|
||||
const minDate = dayjs('1970-01-01 00:00:00').valueOf()
|
||||
const maxDate = dayjs('2099-12-31 23:59:59').valueOf()
|
||||
const endDataMinDate = computed(() => {
|
||||
if (!form.legalIdPersonStartDate) {
|
||||
return maxDate
|
||||
}
|
||||
if (form.legalIdPersonStartDate) {
|
||||
return dayjs(form.legalIdPersonStartDate).add(10, 'year').valueOf()
|
||||
}
|
||||
})
|
||||
|
||||
const endDateType = ref(1)
|
||||
watch(() => endDateType.value, (newval) => {
|
||||
if (newval == 2) {
|
||||
form.legalPersonIdEndDate = maxDate
|
||||
} else {
|
||||
form.legalPersonIdEndDate = dayjs().valueOf()
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function uploadSuccess(url, type, key) {
|
||||
uni.showLoading({
|
||||
type: '识别中,请稍等……!'
|
||||
})
|
||||
getInfoByImg({
|
||||
url,
|
||||
type
|
||||
}).then(res => {
|
||||
uni.hideLoading()
|
||||
if (res) {
|
||||
const data = res.subImages[0].kvInfo.data
|
||||
if (key == 'idCardFrontPic') {
|
||||
if (data.validPeriod) {
|
||||
const [start, end] = data.validPeriod.split('-')
|
||||
if (start) {
|
||||
form.legalIdPersonStartDate = dayjs(start).valueOf()
|
||||
}
|
||||
if (end) {
|
||||
if (end.includes('长期')) {
|
||||
endDateType.value = 2
|
||||
} else {
|
||||
form.legalPersonIdEndDate = dayjs(end).valueOf()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if (key == 'idCardBackPic') {
|
||||
form.legalPersonName = data.name
|
||||
form.legalPersonId = data.idNumber
|
||||
form.legalAddress = data.address
|
||||
if(data.sex.includes('男')){
|
||||
form.legalGender='0'
|
||||
}
|
||||
if(data.sex.includes('女')){
|
||||
form.legalGender='1'
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const placeholderClass = ref('u-font-28')
|
||||
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
|
||||
}
|
||||
},
|
||||
maxSize:{
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
watch(() => props.data, (newval) => {
|
||||
for (let key in form) {
|
||||
if (props.data.hasOwnProperty(key)) {
|
||||
form[key] = props.data[key]
|
||||
}
|
||||
}
|
||||
}, {
|
||||
deep: true,
|
||||
immediate: true
|
||||
})
|
||||
|
||||
const emits = defineEmits(['update'])
|
||||
watch(() => form, (newval) => {
|
||||
emits('update', newval)
|
||||
}, {
|
||||
deep: true
|
||||
})
|
||||
|
||||
watch(()=>form.legalPersonIdEndDate,(newval)=>{
|
||||
if(dayjs(newval).format('YYYY-MM-DD')==='2099-12-31'){
|
||||
endDateType.value=2
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
padding: 32rpx 28rpx;
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 32rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
margin-bottom: 32rpx;
|
||||
|
||||
.title {
|
||||
font-weight: 700;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
&.required {
|
||||
.title::before {
|
||||
content: '*';
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
362
entryManager/add/components/settlement-info.vue
Normal file
362
entryManager/add/components/settlement-info.vue
Normal file
@@ -0,0 +1,362 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="u-font-32 font-bold u-m-32 text-center">结算信息</view>
|
||||
<view class="container">
|
||||
<view class="form-item required">
|
||||
<view class="title"> 结算类型</view>
|
||||
<up-radio-group v-model="form.settlementType">
|
||||
<up-radio v-for="(value,key) in settlementTypes" :label="value" :name="key">
|
||||
</up-radio>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
|
||||
<template v-if="form.settlementType*1==0">
|
||||
<view class="form-item required">
|
||||
<view class="title"> 非法人手持结算授权书</view>
|
||||
<my-upload-img v-model="form.noLegalHandSettleAuthPic.url" :size="200"></my-upload-img>
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 非法人结算授权书</view>
|
||||
<my-upload-img v-model="form.noLegalSettleAuthPic.url" :size="200"></my-upload-img>
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 非法人身份证正面</view>
|
||||
<my-upload-img v-model="form.noLegalIdCardFrontPic.url" :size="200"></my-upload-img>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 非法人身份证反面</view>
|
||||
<my-upload-img v-model="form.noLegalIdCardBackPic.url" :size="200"></my-upload-img>
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 非法人姓名
|
||||
</view>
|
||||
|
||||
<up-input placeholder="非法人姓名" :placeholder-class="placeholderClass"
|
||||
v-model="form.noLegalName"></up-input>
|
||||
</view>
|
||||
<view class="form-item required">
|
||||
<view class="title"> 非法人身份证号码
|
||||
</view>
|
||||
|
||||
<up-input placeholder="非法人身份证号码" :placeholder-class="placeholderClass"
|
||||
v-model="form.noLegalId"></up-input>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
<view class="form-item required" >
|
||||
<view class="title"> 结算卡类型</view>
|
||||
<up-radio-group v-model="form.settlementCardType">
|
||||
<up-radio v-for="(value,key) in settlementCardTypes" :label="value" :name="key">
|
||||
</up-radio>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 银行卡正面</view>
|
||||
<my-upload-img @uploadSuccess="uploadSuccess($event,'BankCard','bankCardFrontPic')"
|
||||
v-model="form.bankCardFrontPic.url" :size="200"></my-upload-img>
|
||||
</view>
|
||||
|
||||
<view class="form-item " :class="{required:form.settlementCardType==11}">
|
||||
<view class="title"> 银行卡反面</view>
|
||||
<my-upload-img v-model="form.bankCardBackPic.url" :size="200"></my-upload-img>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 地区</view>
|
||||
<view class="input-box u-flex u-row-between u-col-center" @click="showCitySelect=true">
|
||||
<text class="color-999" v-if="!pro_city_area">请选择</text>
|
||||
<text class="color-333" v-else>{{pro_city_area}}</text>
|
||||
<up-icon name="arrow-down"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="form-item required">
|
||||
<view class="title"> 银行</view>
|
||||
<bankSelect v-model="form.bankName" v-model:bankInstId="form.bankInstId"
|
||||
v-model:wxProvinceCode="wxProvinceCode"
|
||||
v-model:bankAliasCode="form.bankType"
|
||||
></bankSelect>
|
||||
</view>
|
||||
<view class="form-item " v-if="pro_city_area&&form.bankName">
|
||||
<view class="title"> 支行</view>
|
||||
<bankBranchList :query="bankBranchListQuery" v-model:bankBranchName="form.bankBranchName"
|
||||
v-model:bankBranchCode="form.bankBranchCode"></bankBranchList>
|
||||
</view>
|
||||
<view class="form-item required">
|
||||
<view class="title"> 结算账户卡号</view>
|
||||
<up-input placeholder="结算账户卡号" :placeholder-class="placeholderClass"
|
||||
v-model="form.settlementCardNo"></up-input>
|
||||
</view>
|
||||
<view class="form-item required">
|
||||
<view class="title"> 结算账户户名</view>
|
||||
<up-input placeholder="结算账户户名" :placeholder-class="placeholderClass"
|
||||
v-model="form.settlementName"></up-input>
|
||||
</view>
|
||||
<view class="form-item required">
|
||||
<view class="title"> 结算银行预留手机号</view>
|
||||
<up-input placeholder="结算银行预留手机号" :placeholder-class="placeholderClass"
|
||||
v-model="form.bankMobile"></up-input>
|
||||
</view>
|
||||
<!-- <view class="form-item ">
|
||||
<view class="title"> 开户行行别名称</view>
|
||||
<up-input placeholder="开户行行别名称" :placeholder-class="placeholderClass"
|
||||
v-model="form.bankName"></up-input>
|
||||
</view> -->
|
||||
|
||||
<!--
|
||||
<view class="form-item ">
|
||||
<view class="title"> 开户行缩写</view>
|
||||
<up-input placeholder="开户行缩写" :placeholder-class="placeholderClass"></up-input>
|
||||
</view>
|
||||
<view class="form-item ">
|
||||
<view class="title"> 开户行编号
|
||||
</view>
|
||||
<up-input placeholder="开户行编号" :placeholder-class="placeholderClass" v-model="form.bankType"></up-input>
|
||||
</view>
|
||||
<view class="form-item ">
|
||||
<view class="title"> 支行开户行行别名称
|
||||
|
||||
</view>
|
||||
<up-input placeholder="支行开户行行别名称" :placeholder-class="placeholderClass"
|
||||
v-model="form.bankBranchName"></up-input>
|
||||
</view>
|
||||
|
||||
<view class="form-item ">
|
||||
<view class="title"> 支行开户行编号
|
||||
|
||||
</view>
|
||||
<up-input placeholder="支行开户行编号" :placeholder-class="placeholderClass"
|
||||
v-model="form.bankBranchCode"></up-input>
|
||||
</view>
|
||||
-->
|
||||
|
||||
|
||||
<template v-if="form.settlementCardType*1==21">
|
||||
<view class="form-item required">
|
||||
<view class="title"> 开户许可证</view>
|
||||
<my-upload-img v-model="form.openAccountLicencePic.url" :size="200"></my-upload-img>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
<citySelect v-model="showCitySelect" @city-change="cityChange"></citySelect>
|
||||
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
reactive,
|
||||
watch,
|
||||
ref
|
||||
} from 'vue';
|
||||
import shopSelect from './shop-select.vue'
|
||||
import citySelect from '../../components/u-city-select.vue'
|
||||
import bankSelect from './bank-select.vue'
|
||||
import bankBranchList from './bankBranchList.vue'
|
||||
import {
|
||||
userTypes,
|
||||
sexs,
|
||||
contactPersonTypes,
|
||||
companyChildTypes,
|
||||
settlementTypes,
|
||||
settlementCardTypes,
|
||||
certTypes
|
||||
} from '@/entryManager/data.js'
|
||||
import {
|
||||
getInfoByImg
|
||||
} from '@/http/api/order/entryManager.js'
|
||||
const showCitySelect = ref(false)
|
||||
const showBankSelect = ref(true)
|
||||
|
||||
const wxProvinceCode=ref('')
|
||||
|
||||
function uploadSuccess(url, type, key) {
|
||||
uni.showLoading({
|
||||
type: '识别中,请稍等……!'
|
||||
})
|
||||
getInfoByImg({
|
||||
url,
|
||||
type
|
||||
}).then(res => {
|
||||
uni.hideLoading()
|
||||
if (res) {
|
||||
form.bankName = res.subImages[0].kvInfo.data.bankName
|
||||
form.settlementCardNo = res.subImages[0].kvInfo.data.cardNumber
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function basicSelectChange(e) {
|
||||
|
||||
}
|
||||
|
||||
function cityChange(e) {
|
||||
console.log('cityChange', e);
|
||||
form.openAccProvince = e.province.regionName;
|
||||
form.openAccCity = e.city.regionName;
|
||||
form.openAccArea = e.area.regionName;
|
||||
|
||||
form.openAccProvinceId = e.province.regionId;
|
||||
form.openAccCityId = e.city.regionId;
|
||||
form.openAccAreaId = e.area.regionId;
|
||||
console.log('form', form);
|
||||
}
|
||||
|
||||
const pro_city_area = computed(() => {
|
||||
if (form.openAccProvince && form.openAccCity && form.openAccArea) {
|
||||
const text = form.openAccProvince + '-' + form.openAccCity + '-' + form.openAccArea
|
||||
console.log('text', text);
|
||||
return text
|
||||
}
|
||||
return ''
|
||||
})
|
||||
const form = reactive({
|
||||
"settlementType": "0",
|
||||
"noLegalName": "",
|
||||
"noLegalId": "",
|
||||
"settlementCardType": "11",
|
||||
"settlementCardNo": "",
|
||||
"settlementName": "",
|
||||
"bankMobile": "",
|
||||
"openAccProvinceId": "",
|
||||
"openAccCityId": "",
|
||||
"openAccAreaId": "",
|
||||
"openAccProvince": "",
|
||||
"openAccCity": "",
|
||||
"openAccArea": "",
|
||||
"bankName": "",
|
||||
"bankInstId": "",
|
||||
"bankType": "",
|
||||
"bankBranchName": "",
|
||||
"bankBranchCode": "",
|
||||
"bankCardFrontPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"bankCardBackPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"openAccountLicencePic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"noLegalHandSettleAuthPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"noLegalSettleAuthPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"noLegalIdCardFrontPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"noLegalIdCardBackPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
}
|
||||
})
|
||||
const placeholderClass = ref('u-font-28')
|
||||
|
||||
const isRequired = ref('required')
|
||||
const bankBranchListQuery = computed(() => {
|
||||
return {
|
||||
province: form.openAccProvince,
|
||||
city: form.openAccCity,
|
||||
instId: form.bankInstId,
|
||||
}
|
||||
})
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
watch(() => props.data, (newval) => {
|
||||
console.log('watch 变', newval);
|
||||
|
||||
for (let key in form) {
|
||||
if (props.data.hasOwnProperty(key)) {
|
||||
form[key] = props.data[key]
|
||||
}
|
||||
}
|
||||
console.log(form);
|
||||
}, {
|
||||
deep: true,
|
||||
immediate: true
|
||||
})
|
||||
|
||||
const emits = defineEmits(['update'])
|
||||
watch(() => form, (newval) => {
|
||||
emits('update', newval)
|
||||
}, {
|
||||
deep: true
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
padding: 32rpx 28rpx;
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 32rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
margin-bottom: 32rpx;
|
||||
|
||||
.title {
|
||||
font-weight: 700;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
&.required {
|
||||
.title::before {
|
||||
content: '*';
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.input-box {
|
||||
padding: 10px 10px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #dadbde;
|
||||
}
|
||||
</style>
|
||||
165
entryManager/add/components/shop-select.vue
Normal file
165
entryManager/add/components/shop-select.vue
Normal file
@@ -0,0 +1,165 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
<view class="box" @click.stop="openPopup">
|
||||
<text class="u-font-28 color-999 u-p-r-16" v-if="!modelValue">请选择</text>
|
||||
<text class="u-font-28 color-333 u-p-r-16" v-else>{{returnLabel()}}</text>
|
||||
<view class="icon">
|
||||
<up-icon name="arrow-down" size="14" color="#999"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<up-popup :show="show" placement="bottom" round="18rpx" closeOnClickOverlay @close="close">
|
||||
<view class="u-p-30">
|
||||
<view class="font-bold color-333 u-font-32">选择门店</view>
|
||||
<scroll-view scroll-with-animation :scroll-into-view="selShopId" class="scroll-view u-m-t-30"
|
||||
scroll-y="true" style="max-height :60vh;">
|
||||
<view class="u-m-b-10 u-flex item" v-for="item in list" :key="item.shopId" @click="itemClick(item)"
|
||||
:id="'shop_'+item.shopId" :class="{active:modelValue==item.shopId}">
|
||||
<view class="checkbox">
|
||||
<up-icon name="checkbox-mark" color="#fff"></up-icon>
|
||||
</view>
|
||||
<view class="u-flex-1">{{item.shopName}}</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="u-flex gap-20 u-m-t-30">
|
||||
<view class="u-flex-1">
|
||||
<my-button type="default" @click="close">取消</my-button>
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
<my-button type="primary" @click="submit">确定</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
onMounted,
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
adminShopList
|
||||
} from '@/http/api/shop.js';
|
||||
|
||||
const customStyle = ref({
|
||||
marginRight: '20px'
|
||||
});
|
||||
|
||||
const show = ref(false);
|
||||
let modelValue = defineModel('modelValue', {
|
||||
default: '',
|
||||
});
|
||||
|
||||
const selShopId = ref('')
|
||||
|
||||
function returnLabel() {
|
||||
const findShop = list.value.find(v => v.shopId == modelValue.value)
|
||||
return findShop ? findShop.shopName : ''
|
||||
}
|
||||
|
||||
function itemClick(shop) {
|
||||
modelValue.value = shop.shopId
|
||||
}
|
||||
|
||||
function returnShopName(shopId) {
|
||||
const item = list.value.find((v) => v.shopId == shopId);
|
||||
return item?.shopName || '';
|
||||
}
|
||||
|
||||
function close() {
|
||||
show.value = false;
|
||||
}
|
||||
|
||||
function submit() {
|
||||
show.value = false;
|
||||
}
|
||||
|
||||
|
||||
const list = ref([]);
|
||||
|
||||
function openPopup() {
|
||||
selShopId.value = 'shop_' + modelValue.value
|
||||
show.value = true;
|
||||
|
||||
}
|
||||
async function init() {
|
||||
const res = await adminShopList({
|
||||
page: 1,
|
||||
size: 99999
|
||||
});
|
||||
if (res) {
|
||||
list.value = res.records.map((item) => ({
|
||||
shopId: item.id,
|
||||
shopName: item.shopName,
|
||||
}));
|
||||
}
|
||||
}
|
||||
onMounted(init);
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.box {
|
||||
border-radius: 8upx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: top;
|
||||
flex-wrap: wrap;
|
||||
padding: 10rpx 24rpx;
|
||||
border: 2rpx solid #e5e5e5;
|
||||
position: relative;
|
||||
|
||||
.icon {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 24rpx;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
.shop-item {
|
||||
padding: 4rpx 8rpx 4rpx 16rpx;
|
||||
border-radius: 4rpx;
|
||||
border: 2rpx solid #f0f0f0;
|
||||
background-color: #f5f5f5;
|
||||
margin-bottom: 16rpx;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.scroll-view {
|
||||
.item {
|
||||
border: 1px solid #eee;
|
||||
padding: 20rpx;
|
||||
border-radius: 12rpx;
|
||||
|
||||
&.active {
|
||||
border-color: $my-main-color;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
margin-right: 10rpx;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 6rpx;
|
||||
border: 1px solid #999;
|
||||
|
||||
}
|
||||
|
||||
.item {
|
||||
&.active {
|
||||
.checkbox {
|
||||
background-color: $my-main-color;
|
||||
border-color: $my-main-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
193
entryManager/add/components/steps.vue
Normal file
193
entryManager/add/components/steps.vue
Normal file
@@ -0,0 +1,193 @@
|
||||
<template>
|
||||
<scroll-view scroll-x="true" scroll-with-animation :scroll-left="scrollLeft" class="steps-scroll-container"
|
||||
ref="scrollViewRef">
|
||||
<view class="steps-content" ref="contentRef">
|
||||
<view v-for="(item,index) in list" class="step-item" :key="index" :data-index="index"
|
||||
:class="'step_'+index"
|
||||
ref="stepItemRefs">
|
||||
<view class="step-inner">
|
||||
<view class="index" :class="{active:index<=cur}">
|
||||
<text>{{index+1}}</text>
|
||||
</view>
|
||||
<view class="step-text color-999" :class="{'color-main':index<=cur}" @click="handleClick(index)">
|
||||
{{item}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="step-arrow" v-if="index!=list.length-1">
|
||||
<up-icon name="arrow-rightward" size="16" :color="isActive(index)?'#318AFE':'#999'"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
nextTick,
|
||||
getCurrentInstance,
|
||||
watch
|
||||
} from 'vue';
|
||||
|
||||
const cur = defineModel({
|
||||
default: 0
|
||||
})
|
||||
const scrollLeft = ref(0)
|
||||
const scrollViewRef = ref(null)
|
||||
const contentRef = ref(null) // 内容容器ref
|
||||
const stepItemRefs = ref([]) // 步骤项ref数组
|
||||
const instance = getCurrentInstance()
|
||||
|
||||
function isActive(index) {
|
||||
return index <= cur.value
|
||||
}
|
||||
|
||||
// 核心:精准居中计算(基于元素相对于内容容器的偏移)
|
||||
const calcScrollCenter = async (index) => {
|
||||
try {
|
||||
console.log('calcScrollCenter');
|
||||
const query = uni.createSelectorQuery().in(instance)
|
||||
|
||||
// 1. 获取滚动容器宽度
|
||||
const [scrollViewRect] = await new Promise(resolve => {
|
||||
query.select('.steps-scroll-container').boundingClientRect(rect => resolve([
|
||||
rect
|
||||
])).exec()
|
||||
})
|
||||
const scrollViewWidth = scrollViewRect?.width || 0
|
||||
// 2. 获取当前步骤项的布局信息
|
||||
const [itemRect] = await new Promise(resolve => {
|
||||
query.select(`.step_${index}`).boundingClientRect(rect =>
|
||||
resolve([rect])).exec()
|
||||
})
|
||||
console.log('itemRect',itemRect);
|
||||
// 3. 获取内容容器的布局信息
|
||||
const [contentRect] = await new Promise(resolve => {
|
||||
query.select('.steps-content').boundingClientRect(rect => resolve([rect]))
|
||||
.exec()
|
||||
})
|
||||
|
||||
if (!itemRect || !contentRect) return
|
||||
|
||||
// 关键修正:元素相对于内容容器的左偏移(而非视口)
|
||||
const itemOffsetLeft = itemRect.left - contentRect.left
|
||||
// 居中公式:滚动距离 = 元素偏移 - (容器宽度/2) + (元素宽度/2)
|
||||
let targetScrollLeft = itemOffsetLeft - (scrollViewWidth / 2) + (itemRect.width / 2)
|
||||
|
||||
// 4. 计算最大可滚动距离(边界限制)
|
||||
const maxScrollLeft = Math.max(0, contentRect.width - scrollViewWidth)
|
||||
// 限制滚动范围,避免超出边界
|
||||
targetScrollLeft = Math.max(0, Math.min(targetScrollLeft, maxScrollLeft))
|
||||
|
||||
// 5. 设置滚动距离(强制整数,避免小数导致的偏移)
|
||||
scrollLeft.value = Math.round(targetScrollLeft)
|
||||
|
||||
console.log('scrollLeft', scrollLeft.value);
|
||||
} catch (e) {
|
||||
console.error('计算居中失败:', e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const emits = defineEmits(['itemClick'])
|
||||
// 点击事件
|
||||
const handleClick = (index) => {
|
||||
if (cur.value === index) return
|
||||
if (index > cur.value) {
|
||||
emits('itemClick', index)
|
||||
return
|
||||
}
|
||||
cur.value = index
|
||||
// calcScrollCenter(index)
|
||||
}
|
||||
|
||||
// 初始化居中
|
||||
nextTick(() => {
|
||||
calcScrollCenter(cur.value)
|
||||
})
|
||||
|
||||
watch(() => cur.value, (newval) => {
|
||||
calcScrollCenter(newval)
|
||||
})
|
||||
|
||||
// 步骤列表
|
||||
const list = ref(['基础信息', '法人信息', '营业执照信息', '门店信息', '结算信息'])
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 滚动容器:固定宽度,隐藏滚动条
|
||||
.steps-scroll-container {
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
box-sizing: border-box;
|
||||
overflow-x: auto;
|
||||
|
||||
// 隐藏滚动条(三端兼容)
|
||||
::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
-ms-overflow-style: none;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
// 内容容器:inline-flex,宽度自适应
|
||||
.steps-content {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 10rpx 0;
|
||||
}
|
||||
|
||||
// 单个步骤项:统一间距和布局
|
||||
.step-item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
margin: 0 10rpx; // 统一间距
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
// 步骤内部布局
|
||||
.step-inner {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
// 数字索引
|
||||
.index {
|
||||
border: 1px solid #999;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 50%;
|
||||
margin-right: 10rpx;
|
||||
color: #999;
|
||||
|
||||
&.active {
|
||||
border-color: $my-main-color;
|
||||
color: $my-main-color;
|
||||
}
|
||||
}
|
||||
|
||||
// 步骤文字
|
||||
.step-text {
|
||||
white-space: nowrap;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
// 箭头容器
|
||||
.step-arrow {
|
||||
padding: 0 10rpx;
|
||||
margin-top: 2rpx;
|
||||
}
|
||||
|
||||
// 样式补充
|
||||
.color-main {
|
||||
color: $my-main-color !important;
|
||||
}
|
||||
|
||||
.color-999 {
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
178
entryManager/add/components/store-info.vue
Normal file
178
entryManager/add/components/store-info.vue
Normal file
@@ -0,0 +1,178 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="u-font-32 font-bold u-m-32 text-center">门店信息</view>
|
||||
<view class="container">
|
||||
<view class="form-item required">
|
||||
<view class="title"> 归属地</view>
|
||||
<view class="input-box u-flex u-row-between u-col-center" @click="showCitySelect=true">
|
||||
<text class="color-999" v-if="!pro_city_area">请选择</text>
|
||||
<text class="color-333" v-else>{{pro_city_area}}</text>
|
||||
<up-icon name="arrow-down"></up-icon>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 营业地址</view>
|
||||
|
||||
<up-input placeholder="营业地址" :placeholder-class="placeholderClass"
|
||||
v-model="form.businessAddress"></up-input>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<view class="form-item required">
|
||||
<view class="title"> 经营场所内设照片</view>
|
||||
<my-upload-img v-model="form.insidePic.url" :size="200"></my-upload-img>
|
||||
</view>
|
||||
<view class="form-item required">
|
||||
<view class="title"> 门头照</view>
|
||||
<my-upload-img v-model="form.doorPic.url" :size="200"></my-upload-img>
|
||||
</view>
|
||||
<view class="form-item required">
|
||||
<view class="title"> 收银台照片</view>
|
||||
<my-upload-img v-model="form.cashierDeskPic.url" :size="200"></my-upload-img>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
<citySelect v-model="showCitySelect" @city-change="cityChange"></citySelect>
|
||||
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
reactive,
|
||||
ref,watch
|
||||
} from 'vue';
|
||||
import shopSelect from './shop-select.vue'
|
||||
import citySelect from '../../components/u-city-select.vue'
|
||||
import {
|
||||
userTypes,
|
||||
sexs,
|
||||
contactPersonTypes,
|
||||
companyChildTypes,
|
||||
certTypes
|
||||
} from '@/entryManager/data.js'
|
||||
const showCitySelect = ref(false)
|
||||
|
||||
function cityChange(e) {
|
||||
console.log('cityChange', e);
|
||||
form.mercProv = e.province.regionName;
|
||||
form.mercCity = e.city.regionName;
|
||||
form.mercArea = e.area.regionName;
|
||||
|
||||
form.mercProvCode = e.province.regionId;
|
||||
form.mercCityCode = e.city.regionId;
|
||||
form.mercAreaCode = e.area.regionId;
|
||||
console.log('form', form);
|
||||
}
|
||||
|
||||
const pro_city_area = computed(() => {
|
||||
if (form.mercProv && form.mercCity && form.mercArea) {
|
||||
const text = form.mercProv + '-' + form.mercCity + '-' + form.mercArea
|
||||
console.log('text', text);
|
||||
return text
|
||||
}
|
||||
return ''
|
||||
})
|
||||
const form = reactive({
|
||||
"mercProvCode": "",
|
||||
"mercCityCode": "",
|
||||
"mercAreaCode": "",
|
||||
"mercProv": "",
|
||||
"mercCity": "",
|
||||
"mercArea": "",
|
||||
"businessAddress": "",
|
||||
"insidePic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"doorPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
},
|
||||
"cashierDeskPic": {
|
||||
"url": "",
|
||||
"wechatId": "",
|
||||
"alipayId": ""
|
||||
}
|
||||
})
|
||||
|
||||
const placeholderClass = ref('u-font-28')
|
||||
|
||||
const isRequired = ref('required')
|
||||
|
||||
|
||||
|
||||
const props=defineProps({
|
||||
data:{
|
||||
type:Object,
|
||||
default:()=>{
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
watch(()=>props.data,(newval)=>{
|
||||
for(let key in form){
|
||||
if(props.data.hasOwnProperty(key)){
|
||||
form[key]=props.data[key]
|
||||
}
|
||||
}
|
||||
},{
|
||||
deep:true,immediate:true
|
||||
})
|
||||
|
||||
const emits=defineEmits(['update'])
|
||||
watch(()=>form,(newval)=>{
|
||||
emits('update',newval)
|
||||
},{
|
||||
deep:true
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
padding: 32rpx 28rpx;
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 32rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
margin-bottom: 32rpx;
|
||||
|
||||
.title {
|
||||
font-weight: 700;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
&.required {
|
||||
.title::before {
|
||||
content: '*';
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.input-box {
|
||||
padding: 10px 10px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #dadbde;
|
||||
}
|
||||
</style>
|
||||
288
entryManager/add/data.js
Normal file
288
entryManager/add/data.js
Normal file
@@ -0,0 +1,288 @@
|
||||
export const rules = {
|
||||
merchantBaseInfo: {
|
||||
userType: {
|
||||
required: true,
|
||||
errorMsg: '请选择商户类型',
|
||||
},
|
||||
shortName: {
|
||||
required: true,
|
||||
errorMsg: '请填写商户简称',
|
||||
},
|
||||
mccCode: {
|
||||
required: true,
|
||||
errorMsg: '请选择行业类目',
|
||||
},
|
||||
alipayAccount: {
|
||||
required: true,
|
||||
errorMsg: '请填写支付宝账号',
|
||||
}
|
||||
},
|
||||
legalPersonInfo: {
|
||||
'idCardHandPic.url': {
|
||||
required: true,
|
||||
errorMsg: '请上传身份证手持图片',
|
||||
},
|
||||
'idCardFrontPic.url': {
|
||||
required: true,
|
||||
errorMsg: '请上传身份证正面图片',
|
||||
},
|
||||
'idCardBackPic.url': {
|
||||
required: true,
|
||||
errorMsg: '请上传身份证反面图片',
|
||||
},
|
||||
legalPersonName: {
|
||||
required: true,
|
||||
errorMsg: '请填写法人姓名',
|
||||
},
|
||||
legalPersonId: {
|
||||
required: true,
|
||||
errorMsg: '请填写法人身份证号',
|
||||
},
|
||||
legalIdPersonStartDate: {
|
||||
required: true,
|
||||
errorMsg: '请填写法人身份证开始日期',
|
||||
},
|
||||
legalPersonIdEndDate: {
|
||||
required: true,
|
||||
errorMsg: '请填写法人身份证到期日期',
|
||||
},
|
||||
legalPersonPhone: {
|
||||
required: true,
|
||||
errorMsg: '请填写法人电话',
|
||||
},
|
||||
legalPersonEmail: {
|
||||
required: true,
|
||||
errorMsg: '请填写法人邮箱',
|
||||
},
|
||||
legalGender: {
|
||||
required: true,
|
||||
errorMsg: '请填写法人性别',
|
||||
},
|
||||
legalAddress: {
|
||||
required: true,
|
||||
errorMsg: '请填写法人地址',
|
||||
},
|
||||
|
||||
},
|
||||
businessLicenceInfo:{
|
||||
'licensePic.url':{
|
||||
required: true,
|
||||
errorMsg:'请上传营业执照照片'
|
||||
},
|
||||
licenceName:{
|
||||
required: true,
|
||||
errorMsg:'请输入营业执照全称'
|
||||
},
|
||||
licenceNo:{
|
||||
required: true,
|
||||
errorMsg:'请输入营业执照号码'
|
||||
},
|
||||
licenceStartDate:{
|
||||
required: true,
|
||||
errorMsg:'请选择营业执照开始日期'
|
||||
},
|
||||
registeredAddress:{
|
||||
required: true,
|
||||
errorMsg:'请填写营业执照注册地址'
|
||||
}
|
||||
},
|
||||
storeInfo: {
|
||||
mercProvCode: {
|
||||
required: true,
|
||||
errorMsg: '请选择归属地',
|
||||
},
|
||||
mercCityCode: {
|
||||
required: true,
|
||||
errorMsg: '请选择归属地',
|
||||
},
|
||||
mercAreaCode: {
|
||||
required: true,
|
||||
errorMsg: '请选择归属地',
|
||||
},
|
||||
mercProv: {
|
||||
required: true,
|
||||
errorMsg: '请选择归属地',
|
||||
},
|
||||
mercCity: {
|
||||
required: true,
|
||||
errorMsg: '请选择归属地',
|
||||
},
|
||||
mercArea: {
|
||||
required: true,
|
||||
errorMsg: '请选择归属地',
|
||||
},
|
||||
businessAddress: {
|
||||
required: true,
|
||||
errorMsg: '请填写营业地址',
|
||||
},
|
||||
'insidePic.url': {
|
||||
required: true,
|
||||
errorMsg: '请上传经营场所内设照片',
|
||||
},
|
||||
'doorPic.url': {
|
||||
required: true,
|
||||
errorMsg: '请上传门头照',
|
||||
},
|
||||
'cashierDeskPic.url': {
|
||||
required: true,
|
||||
errorMsg: '请上传收银台照片',
|
||||
}
|
||||
},
|
||||
settlementInfo: {
|
||||
settlementType: {
|
||||
required: true,
|
||||
errorMsg: '请选择结算类型',
|
||||
},
|
||||
settlementCardType: {
|
||||
required: true,
|
||||
errorMsg: '请选择结算卡类型',
|
||||
},
|
||||
'bankCardFrontPic.url': {
|
||||
required: true,
|
||||
errorMsg: '请上传银行卡正面照片',
|
||||
},
|
||||
openAccProvinceId: {
|
||||
required: true,
|
||||
errorMsg: '请选择地区',
|
||||
},
|
||||
openAccCityId: {
|
||||
required: true,
|
||||
errorMsg: '请选择地区',
|
||||
},
|
||||
openAccAreaId: {
|
||||
required: true,
|
||||
errorMsg: '请选择地区',
|
||||
},
|
||||
openAccProvince: {
|
||||
required: true,
|
||||
errorMsg: '请选择地区',
|
||||
},
|
||||
openAccCity: {
|
||||
required: true,
|
||||
errorMsg: '请选择地区',
|
||||
},
|
||||
openAccArea: {
|
||||
required: true,
|
||||
errorMsg: '请选择地区',
|
||||
},
|
||||
bankType: {
|
||||
required: true,
|
||||
errorMsg: '请选择银行',
|
||||
},
|
||||
bankInstId: {
|
||||
required: true,
|
||||
errorMsg: '请选择银行',
|
||||
},
|
||||
bankName: {
|
||||
required: true,
|
||||
errorMsg: '请选择银行',
|
||||
},
|
||||
settlementCardNo: {
|
||||
required: true,
|
||||
errorMsg: '请填写结算账户卡号',
|
||||
},
|
||||
settlementName: {
|
||||
required: true,
|
||||
errorMsg: '请填写结算账户户名',
|
||||
},
|
||||
bankMobile: {
|
||||
required: true,
|
||||
errorMsg: '请填写结算银行预留手机号',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function isEmptyValue(val) {
|
||||
if (val === '' || val === undefined || val === null) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
/**
|
||||
* 解析属性路径,返回数组格式的路径片段
|
||||
* @param {string} str - 属性路径(如 'userType' 或 'idCardHandPic.url')
|
||||
* @returns {Array<string>} 属性路径片段数组(如 ['userType'] 或 ['idCardHandPic', 'url'])
|
||||
*/
|
||||
export function returnKey(str) {
|
||||
// 无论是否包含'.',都返回数组,方便后续统一处理
|
||||
return str.includes('.') ? str.split('.') : [str];
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据属性路径数组,安全获取对象的嵌套属性值
|
||||
* @param {Object} obj - 目标对象(如 form.legalPersonInfo)
|
||||
* @param {Array<string>} keyPath - 属性路径数组(如 ['idCardHandPic', 'url'])
|
||||
* @returns {*} 嵌套属性的值(若路径不存在,返回 undefined)
|
||||
*/
|
||||
export function getNestedValue(obj, keyPath) {
|
||||
// 边界处理:obj不是对象,直接返回undefined
|
||||
if (typeof obj !== 'object' || obj === null) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// 逐层遍历属性路径,获取最终值
|
||||
return keyPath.reduce((currentObj, key) => {
|
||||
// 中间层级不存在,直接返回undefined,避免报错
|
||||
if (currentObj === undefined || currentObj === null) {
|
||||
return undefined;
|
||||
}
|
||||
return currentObj[key];
|
||||
}, obj);
|
||||
}
|
||||
|
||||
export function verifyValue(val, ruleItem) {
|
||||
const isEmpty = isEmptyValue(val)
|
||||
let result = {
|
||||
ispas: true,
|
||||
errorMsg: ''
|
||||
}
|
||||
if (ruleItem.required) {
|
||||
|
||||
if (isEmpty) {
|
||||
result.ispas = false
|
||||
result.errorMsg = ruleItem.errorMsg
|
||||
return result
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
export function verifyData(data, rule) {
|
||||
// 边界处理:data不是对象,直接返回校验失败(若有必填规则)
|
||||
if (typeof data !== 'object' || data === null) {
|
||||
// 遍历规则,返回第一个必填项的错误信息
|
||||
for (let ruleKey in rule) {
|
||||
const ruleItem = rule[ruleKey];
|
||||
if (ruleItem.required) {
|
||||
return {
|
||||
ispas: false,
|
||||
errorMsg: ruleItem.errorMsg || '数据格式错误,无法校验'
|
||||
};
|
||||
}
|
||||
}
|
||||
return {
|
||||
ispas: true,
|
||||
errorMsg: ''
|
||||
};
|
||||
}
|
||||
|
||||
for (let ruleKey in rule) {
|
||||
const ruleItem = rule[ruleKey];
|
||||
// 1. 获取属性路径数组(如 ['idCardHandPic', 'url'])
|
||||
const keyPath = returnKey(ruleKey);
|
||||
// 2. 安全获取嵌套属性值(核心:支持深层级属性)
|
||||
const targetValue = getNestedValue(data, keyPath);
|
||||
// 3. 校验属性值
|
||||
const result = verifyValue(targetValue, ruleItem);
|
||||
|
||||
// 4. 校验失败,直接返回结果
|
||||
if (!result.ispas) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
ispas: true,
|
||||
errorMsg: ''
|
||||
}
|
||||
}
|
||||
1
entryManager/common/all.js
Normal file
1
entryManager/common/all.js
Normal file
File diff suppressed because one or more lines are too long
1
entryManager/common/area.js
Normal file
1
entryManager/common/area.js
Normal file
File diff suppressed because one or more lines are too long
1
entryManager/common/city.js
Normal file
1
entryManager/common/city.js
Normal file
File diff suppressed because one or more lines are too long
1087
entryManager/common/classify.data.js
Normal file
1087
entryManager/common/classify.data.js
Normal file
File diff suppressed because it is too large
Load Diff
1
entryManager/common/province.js
Normal file
1
entryManager/common/province.js
Normal file
@@ -0,0 +1 @@
|
||||
var provinceData=[{"label":"北京市","value":"11"},{"label":"天津市","value":"12"},{"label":"河北省","value":"13"},{"label":"山西省","value":"14"},{"label":"内蒙古自治区","value":"15"},{"label":"辽宁省","value":"21"},{"label":"吉林省","value":"22"},{"label":"黑龙江省","value":"23"},{"label":"上海市","value":"31"},{"label":"江苏省","value":"32"},{"label":"浙江省","value":"33"},{"label":"安徽省","value":"34"},{"label":"福建省","value":"35"},{"label":"江西省","value":"36"},{"label":"山东省","value":"37"},{"label":"河南省","value":"41"},{"label":"湖北省","value":"42"},{"label":"湖南省","value":"43"},{"label":"广东省","value":"44"},{"label":"广西壮族自治区","value":"45"},{"label":"海南省","value":"46"},{"label":"重庆市","value":"50"},{"label":"四川省","value":"51"},{"label":"贵州省","value":"52"},{"label":"云南省","value":"53"},{"label":"西藏自治区","value":"54"},{"label":"陕西省","value":"61"},{"label":"甘肃省","value":"62"},{"label":"青海省","value":"63"},{"label":"宁夏回族自治区","value":"64"},{"label":"新疆维吾尔自治区","value":"65"},{"label":"台湾","value":"66"},{"label":"香港","value":"67"},{"label":"澳门","value":"68"}];export default provinceData;
|
||||
302
entryManager/components/mcc-category.vue
Normal file
302
entryManager/components/mcc-category.vue
Normal file
@@ -0,0 +1,302 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
<view class="box" @click.stop="openPopup">
|
||||
<text class="u-font-28 color-999 u-p-r-16" v-if="selArr[0]===null||selArr[1]===null">请选择</text>
|
||||
<text class="u-font-28 color-333 u-p-r-16" v-else>{{returnLabel()}}</text>
|
||||
<view class="icon">
|
||||
<up-icon name="arrow-down" size="14" color="#999"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<up-popup :show="show" placement="bottom" round="18rpx" closeOnClickOverlay @close="close">
|
||||
<view class="u-p-30">
|
||||
<view class="font-bold color-333 u-font-32">选择行业类目</view>
|
||||
<view class="u-m-t-24">
|
||||
<up-search v-model="query.bankName" @search="search" @change="bankNameChange" @custom="search"
|
||||
@clear="search"></up-search>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-30 gap-20 u-col-top">
|
||||
<view class="u-flex-1">
|
||||
<view class="u-p-b-24 font-bold text-center">一级类目</view>
|
||||
<scroll-view @scrolltolower="scrolltolower" scroll-with-animation :scroll-into-view="oneSelId"
|
||||
class="scroll-view " scroll-y="true" style="max-height :60vh;">
|
||||
<view class="u-m-b-10 u-flex item" v-for="(item,index) in list" :key="item.id"
|
||||
@click="oneCategoryClick(index)" :id="'cateOne_'+index"
|
||||
:class="{active:selArr[0]===index}">
|
||||
<view class="checkbox">
|
||||
<up-icon name="checkbox-mark" color="#fff"></up-icon>
|
||||
</view>
|
||||
<view class="u-flex-1">{{item.firstCategory}}</view>
|
||||
</view>
|
||||
<up-empty v-if="list.length==0" text="暂无相关分类"></up-empty>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
<view class="u-p-b-24 font-bold text-center">二级类目</view>
|
||||
<scroll-view @scrolltolower="scrolltolower" scroll-with-animation :scroll-into-view="twoSelId"
|
||||
class="scroll-view " scroll-y="true" style="max-height :60vh;">
|
||||
<view class="u-m-b-10 u-flex item" v-for="(item,index) in sendList" :key="item.id"
|
||||
@click="selArr[1]=index" :id="'cateTwo_'+index" :class="{active:selArr[1]==index}">
|
||||
<view class="checkbox">
|
||||
<up-icon name="checkbox-mark" color="#fff"></up-icon>
|
||||
</view>
|
||||
<view class="u-flex-1">{{item.secondCategory}}</view>
|
||||
</view>
|
||||
<up-empty v-if="list.length==0" text="暂无相关分类"></up-empty>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
<view class="u-flex gap-20 u-m-t-30">
|
||||
<view class="u-flex-1">
|
||||
<my-button type="default" @click="close">取消</my-button>
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
<my-button type="primary" @click="submit">确定</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
nextTick,
|
||||
onMounted,
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
mccCategory
|
||||
} from '@/http/api/system/common.js';
|
||||
const customStyle = ref({
|
||||
marginRight: '20px'
|
||||
});
|
||||
|
||||
const show = ref(false);
|
||||
const modelValue = defineModel();
|
||||
|
||||
|
||||
|
||||
|
||||
const oneSelId = ref('')
|
||||
const twoSelId = ref('')
|
||||
|
||||
const allCategoryArr = computed(() => {
|
||||
return list.value.reduce((prve, cur) => {
|
||||
prve.push(...cur.child)
|
||||
return prve
|
||||
}, [])
|
||||
})
|
||||
|
||||
function returnLabel() {
|
||||
const [index1, index2] = selArr.value
|
||||
console.log('selArr', selArr.value);
|
||||
if (index1 !== null && index2 !== null) {
|
||||
return list.value[index1].firstCategory + '/' + list.value[index1].child[index2].secondCategory
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
function oneCategoryClick(index) {
|
||||
selArr.value[0] = index
|
||||
selArr.value[1] = null
|
||||
}
|
||||
|
||||
const selItem = ref(null)
|
||||
|
||||
function itemClick(bank) {
|
||||
selItem.value = bank;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function close() {
|
||||
show.value = false;
|
||||
}
|
||||
|
||||
function submit() {
|
||||
if (selArr.value[0] === null || selArr.value[1] === null) {
|
||||
return uni.showToast({
|
||||
title: '请选择行业类目',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
const [oneIndex, twoIndex] = selArr.value
|
||||
const item = list.value[oneIndex].child[twoIndex]
|
||||
modelValue.value = item.firstCategoryCode + '_' + item.secondCategoryCode
|
||||
show.value = false;
|
||||
|
||||
}
|
||||
|
||||
function search() {
|
||||
init()
|
||||
}
|
||||
|
||||
const list = ref([]);
|
||||
|
||||
|
||||
function openPopup() {
|
||||
|
||||
show.value = true;
|
||||
|
||||
}
|
||||
|
||||
// --------------- 核心新增:节流函数实现 ---------------
|
||||
/**
|
||||
* 节流函数:限制函数在指定时间内只触发一次
|
||||
* @param {Function} fn - 要节流的函数
|
||||
* @param {number} delay - 节流延迟时间(毫秒)
|
||||
* @returns {Function} 节流后的函数
|
||||
*/
|
||||
function throttle(fn, delay = 300) {
|
||||
let timer = null; // 定时器标识
|
||||
return function(...args) {
|
||||
// 如果已有定时器,直接返回(未到触发时间)
|
||||
if (timer) return;
|
||||
// 执行函数并设置新定时器
|
||||
fn.apply(this, args);
|
||||
timer = setTimeout(() => {
|
||||
clearTimeout(timer);
|
||||
timer = null;
|
||||
}, delay);
|
||||
};
|
||||
}
|
||||
|
||||
// --------------- 核心修改:创建节流后的search方法 ---------------
|
||||
// 300ms内只触发一次search,可根据需求调整delay值(如500ms)
|
||||
const throttledSearch = throttle(search, 300);
|
||||
|
||||
// --------------- 改造bankNameChange:调用节流后的搜索 ---------------
|
||||
function bankNameChange() {
|
||||
// 输入变化时,调用节流后的搜索方法
|
||||
throttledSearch();
|
||||
}
|
||||
|
||||
const query = reactive({
|
||||
bankName: ''
|
||||
})
|
||||
const isEnd = ref(false)
|
||||
|
||||
function scrolltolower() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
async function init() {
|
||||
const res = await mccCategory(query);
|
||||
if (res) {
|
||||
list.value = res.map(v => {
|
||||
return {
|
||||
...v,
|
||||
firstCategoryCode: v.child[0].firstCategoryCode
|
||||
}
|
||||
})
|
||||
startWatch()
|
||||
}
|
||||
}
|
||||
|
||||
const selArr = ref([null, null])
|
||||
const sendList = computed(() => {
|
||||
if (selArr.value[0] !== null) {
|
||||
return list.value[selArr.value[0]].child
|
||||
}
|
||||
})
|
||||
|
||||
function startWatch() {
|
||||
watch(() => modelValue.value, (newval) => {
|
||||
if (newval) {
|
||||
const arr = modelValue.value.split('_')
|
||||
const [oneCode, twoCode] = arr
|
||||
console.log('oneCode',oneCode);
|
||||
console.log('twoCode',twoCode);
|
||||
const oneIndex = list.value.findIndex(v => v.firstCategoryCode == oneCode)
|
||||
if (oneIndex != -1) {
|
||||
selArr.value[0] = oneIndex
|
||||
oneSelId.value = 'cateOne_' + oneIndex
|
||||
const twoIndex = list.value[oneIndex].child.findIndex(v => v.secondCategoryCode==twoCode)
|
||||
if (twoIndex != -1) {
|
||||
selArr.value[1] = twoIndex
|
||||
twoSelId.value = 'cateTwo_' + twoIndex
|
||||
}
|
||||
}
|
||||
console.log('watch selArr',selArr.value);
|
||||
} else {
|
||||
selArr.value = [null, null]
|
||||
}
|
||||
}, {
|
||||
immediate: true
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
onMounted(init);
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.box {
|
||||
border-radius: 8upx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: top;
|
||||
flex-wrap: wrap;
|
||||
padding: 20rpx 24rpx;
|
||||
border: 2rpx solid #e5e5e5;
|
||||
position: relative;
|
||||
|
||||
.icon {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 24rpx;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
.shop-item {
|
||||
padding: 4rpx 8rpx 4rpx 16rpx;
|
||||
border-radius: 4rpx;
|
||||
border: 2rpx solid #f0f0f0;
|
||||
background-color: #f5f5f5;
|
||||
margin-bottom: 16rpx;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.scroll-view {
|
||||
.item {
|
||||
border: 1px solid #eee;
|
||||
padding: 20rpx;
|
||||
border-radius: 12rpx;
|
||||
|
||||
&.active {
|
||||
border-color: $my-main-color;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
margin-right: 10rpx;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 6rpx;
|
||||
border: 1px solid #999;
|
||||
|
||||
}
|
||||
|
||||
.item {
|
||||
&.active {
|
||||
.checkbox {
|
||||
background-color: $my-main-color;
|
||||
border-color: $my-main-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
203
entryManager/components/shop-select.vue
Normal file
203
entryManager/components/shop-select.vue
Normal file
@@ -0,0 +1,203 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
<up-popup :show="show" placement="bottom" round="18rpx" closeOnClickOverlay @close="close">
|
||||
<view class="u-p-30">
|
||||
<view class="font-bold color-333 u-font-32">选择门店</view>
|
||||
<view class="u-m-t-24">
|
||||
<up-search v-model="query.shopName" @search="search" @clear="search" @custom="search"></up-search>
|
||||
</view>
|
||||
<scroll-view @scrolltolower="scrolltolower" scroll-with-animation :scroll-into-view="selShopId"
|
||||
class="scroll-view u-m-t-30" scroll-y="true" style="max-height :60vh;">
|
||||
<view class="u-m-b-10 u-flex item" v-for="item in list" :key="item.shopId" @click="itemClick(item)"
|
||||
:id="'shop_'+item.shopId" :class="{active:selShop==item.shopId}">
|
||||
<view class="checkbox">
|
||||
<up-icon name="checkbox-mark" color="#fff"></up-icon>
|
||||
</view>
|
||||
<view class="u-flex-1">{{item.shopName}}</view>
|
||||
</view>
|
||||
<template v-if="query.shopName!==''">
|
||||
<up-empty v-if="list.length==0" text="未搜索到相关店铺"></up-empty>
|
||||
<up-loadmore v-else :status="isEnd?'nomor':'loading'"></up-loadmore>
|
||||
</template>
|
||||
<template v-else>
|
||||
<up-loadmore :status="isEnd?'nomor':'loading'"></up-loadmore>
|
||||
</template>
|
||||
</scroll-view>
|
||||
<view class="u-flex gap-20 u-m-t-30">
|
||||
<view class="u-flex-1">
|
||||
<my-button type="default" @click="close">取消</my-button>
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
<my-button type="primary" @click="submit">确定</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
onMounted,
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
adminShopList
|
||||
} from '@/http/api/shop.js';
|
||||
|
||||
const customStyle = ref({
|
||||
marginRight: '20px'
|
||||
});
|
||||
|
||||
const show = defineModel(false)
|
||||
let selShop = defineModel('selShop', {
|
||||
default: '',
|
||||
});
|
||||
|
||||
|
||||
|
||||
const selShopId = ref('')
|
||||
|
||||
function returnLabel() {
|
||||
const findShop = list.value.find(v => v.shopId == selShop.value)
|
||||
return findShop ? findShop.shopName : ''
|
||||
}
|
||||
|
||||
function itemClick(shop) {
|
||||
selShop.value = shop.shopId
|
||||
}
|
||||
|
||||
function returnShopName(shopId) {
|
||||
const item = list.value.find((v) => v.shopId == shopId);
|
||||
return item?.shopName || '';
|
||||
}
|
||||
|
||||
function close() {
|
||||
show.value = false;
|
||||
}
|
||||
|
||||
const emits=defineEmits(['confirm'])
|
||||
function submit() {
|
||||
show.value = false;
|
||||
if(!selShop.value){
|
||||
return uni.showToast({
|
||||
title:'请选择门店',
|
||||
icon:'none'
|
||||
})
|
||||
}
|
||||
const findShop = list.value.find(v => v.shopId == selShop.value)
|
||||
emits('confirm',findShop)
|
||||
}
|
||||
|
||||
|
||||
const list = ref([]);
|
||||
|
||||
function openPopup() {
|
||||
selShopId.value = 'shop_' + selShop.value
|
||||
show.value = true;
|
||||
|
||||
}
|
||||
|
||||
const query = reactive({
|
||||
page: 1,
|
||||
size: 10,
|
||||
shopName: '',
|
||||
})
|
||||
const isEnd = ref(false)
|
||||
|
||||
function scrolltolower() {
|
||||
if (!isEnd.value) {
|
||||
query.page++
|
||||
init()
|
||||
}
|
||||
}
|
||||
|
||||
function search() {
|
||||
selShop.value = '';
|
||||
query.page = 1;
|
||||
isEnd.value = false
|
||||
init()
|
||||
}
|
||||
async function init() {
|
||||
const res = await adminShopList(query);
|
||||
if (res) {
|
||||
const arr = res.records.map((item) => ({
|
||||
shopId: item.id,
|
||||
shopName: item.shopName,
|
||||
}));
|
||||
isEnd.value = query.page >= res.totalPage * 1
|
||||
if (query.page == 1) {
|
||||
list.value = arr
|
||||
} else {
|
||||
list.value.push(...arr)
|
||||
}
|
||||
}
|
||||
}
|
||||
onMounted(init);
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.box {
|
||||
border-radius: 8upx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: top;
|
||||
flex-wrap: wrap;
|
||||
padding: 10rpx 24rpx;
|
||||
border: 2rpx solid #e5e5e5;
|
||||
position: relative;
|
||||
|
||||
.icon {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 24rpx;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
.shop-item {
|
||||
padding: 4rpx 8rpx 4rpx 16rpx;
|
||||
border-radius: 4rpx;
|
||||
border: 2rpx solid #f0f0f0;
|
||||
background-color: #f5f5f5;
|
||||
margin-bottom: 16rpx;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.scroll-view {
|
||||
.item {
|
||||
border: 1px solid #eee;
|
||||
padding: 20rpx;
|
||||
border-radius: 12rpx;
|
||||
|
||||
&.active {
|
||||
border-color: $my-main-color;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
margin-right: 10rpx;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 6rpx;
|
||||
border: 1px solid #999;
|
||||
|
||||
}
|
||||
|
||||
.item {
|
||||
&.active {
|
||||
.checkbox {
|
||||
background-color: $my-main-color;
|
||||
border-color: $my-main-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
257
entryManager/components/u-city-select.vue
Normal file
257
entryManager/components/u-city-select.vue
Normal file
@@ -0,0 +1,257 @@
|
||||
<template>
|
||||
<up-popup :show="modelValue" mode="bottom" :popup="false"
|
||||
:mask="true" :closeable="true" :safe-area-inset-bottom="true"
|
||||
close-icon-color="#ffffff" :z-index="uZIndex"
|
||||
:maskCloseAble="maskCloseAble" @close="close">
|
||||
<up-tabs v-if="modelValue" :list="genTabsList"
|
||||
:scrollable="true" :current="tabsIndex" @change="tabsChange" ref="tabs"></up-tabs>
|
||||
<view class="area-box">
|
||||
<view class="u-flex" :class="{ 'change':isChange }">
|
||||
<view class="area-item">
|
||||
<view class="u-padding-10 u-bg-gray" style="height: 100%;">
|
||||
<scroll-view :scroll-y="true" style="height: 100%">
|
||||
<up-cell-group>
|
||||
<up-cell v-for="(item,index) in provinces"
|
||||
:title="item.regionName" :arrow="false"
|
||||
:index="index" :key="index"
|
||||
@click="provinceChange(index)">
|
||||
<template v-slot:right-icon>
|
||||
<up-icon v-if="isChooseP&&province===index"
|
||||
size="17" name="checkbox-mark"></up-icon>
|
||||
</template>
|
||||
</up-cell>
|
||||
</up-cell-group>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="area-item">
|
||||
<view class="u-padding-10 u-bg-gray" style="height: 100%;">
|
||||
<scroll-view :scroll-y="true" style="height: 100%">
|
||||
<up-cell-group v-if="isChooseP">
|
||||
<up-cell v-for="(item,index) in citys"
|
||||
:title="item.regionName" :arrow="false"
|
||||
:index="index" :key="index"
|
||||
@click="cityChange(index)">
|
||||
<template v-slot:right-icon>
|
||||
<up-icon v-if="isChooseC&&city===index"
|
||||
size="17" name="checkbox-mark"></up-icon>
|
||||
</template>
|
||||
</up-cell>
|
||||
</up-cell-group>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="area-item">
|
||||
<view class="u-padding-10 u-bg-gray" style="height: 100%;">
|
||||
<scroll-view :scroll-y="true" style="height: 100%">
|
||||
<up-cell-group v-if="isChooseC">
|
||||
<up-cell v-for="(item,index) in areas"
|
||||
:title="item.regionName" :arrow="false"
|
||||
:index="index" :key="index"
|
||||
@click="areaChange(index)">
|
||||
<template v-slot:right-icon>
|
||||
<up-icon v-if="isChooseA&&area===index"
|
||||
size="17" name="checkbox-mark"></up-icon>
|
||||
</template>
|
||||
</up-cell>
|
||||
</up-cell-group>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {region} from '@/http/api/system/region.js'
|
||||
import provinces from "../common/province.js";
|
||||
import citys from "../common/city.js";
|
||||
import areas from "../common/area.js";
|
||||
/**
|
||||
* city-select 省市区级联选择器
|
||||
* @property {String Number} z-index 弹出时的z-index值(默认1075)
|
||||
* @property {Boolean} mask-close-able 是否允许通过点击遮罩关闭Picker(默认true)
|
||||
* @property {String} default-region 默认选中的地区,中文形式
|
||||
* @property {String} default-code 默认选中的地区,编号形式
|
||||
*/
|
||||
export default {
|
||||
name: 'u-city-select',
|
||||
props: {
|
||||
// 通过双向绑定控制组件的弹出与收起
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
// 默认显示的地区,可传类似["河北省", "秦皇岛市", "北戴河区"]
|
||||
defaultRegion: {
|
||||
type: Array,
|
||||
default () {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
// 默认显示地区的编码,defaultRegion和areaCode同时存在,areaCode优先,可传类似["13", "1303", "130304"]
|
||||
areaCode: {
|
||||
type: Array,
|
||||
default () {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
// 是否允许通过点击遮罩关闭Picker
|
||||
maskCloseAble: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 弹出的z-index值
|
||||
zIndex: {
|
||||
type: [String, Number],
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
cityValue: "",
|
||||
isChooseP: false, //是否已经选择了省
|
||||
province: 0, //省级下标
|
||||
provinces: [],
|
||||
isChooseC: false, //是否已经选择了市
|
||||
city: 0, //市级下标
|
||||
citys: citys[0],
|
||||
isChooseA: false, //是否已经选择了区
|
||||
area: 0, //区级下标
|
||||
areas: areas[0][0],
|
||||
tabsIndex: 0,
|
||||
list:[]
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
await this.getRegon()
|
||||
this.init();
|
||||
},
|
||||
computed: {
|
||||
isChange() {
|
||||
return this.tabsIndex > 1;
|
||||
},
|
||||
genTabsList() {
|
||||
let tabsList = [{
|
||||
name: "请选择"
|
||||
}];
|
||||
if (this.isChooseP) {
|
||||
console.log(this.province)
|
||||
tabsList[0]['name'] = this.provinces[this.province]['regionName'];
|
||||
tabsList[1] = {
|
||||
name: "请选择"
|
||||
};
|
||||
}
|
||||
if (this.isChooseC) {
|
||||
tabsList[1]['name'] = this.citys[this.city]['regionName'];
|
||||
tabsList[2] = {
|
||||
name: "请选择"
|
||||
};
|
||||
}
|
||||
if (this.isChooseA) {
|
||||
tabsList[2]['name'] = this.areas[this.area]['regionName'];
|
||||
}
|
||||
return tabsList;
|
||||
},
|
||||
uZIndex() {
|
||||
// 如果用户有传递z-index值,优先使用
|
||||
return this.zIndex ? this.zIndex : this.$u.zIndex.popup;
|
||||
}
|
||||
},
|
||||
emits: ['city-change'],
|
||||
methods: {
|
||||
async getRegon(){
|
||||
const res=await region()
|
||||
this.provinces=res||[]
|
||||
},
|
||||
init() {
|
||||
if (this.areaCode.length == 3) {
|
||||
this.setProvince("", this.areaCode[0]);
|
||||
this.setCity("", this.areaCode[1]);
|
||||
this.setArea("", this.areaCode[2]);
|
||||
} else if (this.defaultRegion.length == 3) {
|
||||
this.setProvince(this.defaultRegion[0], "");
|
||||
this.setCity(this.defaultRegion[1], "");
|
||||
this.setArea(this.defaultRegion[2], "");
|
||||
};
|
||||
},
|
||||
setProvince(regionName = "", value = "") {
|
||||
this.provinces.map((v, k) => {
|
||||
if (value ? v.value == value : v.regionName == regionName) {
|
||||
this.provinceChange(k);
|
||||
}
|
||||
})
|
||||
},
|
||||
setCity(regionName = "", value = "") {
|
||||
this.citys.map((v, k) => {
|
||||
if (value ? v.value == value : v.regionName == regionName) {
|
||||
this.cityChange(k);
|
||||
}
|
||||
})
|
||||
},
|
||||
setArea(regionName = "", value = "") {
|
||||
this.areas.map((v, k) => {
|
||||
if (value ? v.value == value : v.regionName == regionName) {
|
||||
this.isChooseA = true;
|
||||
this.area = k;
|
||||
}
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.$emit('update:modelValue', false);
|
||||
},
|
||||
tabsChange(index) {
|
||||
this.tabsIndex = index;
|
||||
},
|
||||
provinceChange(index) {
|
||||
this.isChooseP = true;
|
||||
this.isChooseC = false;
|
||||
this.isChooseA = false;
|
||||
this.province = index;
|
||||
this.citys =this.provinces[index].children
|
||||
this.tabsIndex = 1;
|
||||
},
|
||||
cityChange(index) {
|
||||
this.isChooseC = true;
|
||||
this.isChooseA = false;
|
||||
this.city = index;
|
||||
this.areas =this.provinces[this.province].children[index].children
|
||||
this.tabsIndex = 2;
|
||||
},
|
||||
areaChange(index) {
|
||||
this.isChooseA = true;
|
||||
this.area = index;
|
||||
let result = {};
|
||||
result.province = this.provinces[this.province];
|
||||
result.city = this.citys[this.city];
|
||||
result.area = this.areas[this.area];
|
||||
this.$emit('city-change', result);
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.area-box {
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
height: 800rpx;
|
||||
|
||||
>view {
|
||||
width: 150%;
|
||||
transition: transform 0.3s ease-in-out 0s;
|
||||
transform: translateX(0);
|
||||
|
||||
&.change {
|
||||
transform: translateX(-33.3333333%);
|
||||
}
|
||||
}
|
||||
|
||||
.area-item {
|
||||
width: 33.3333333%;
|
||||
height: 800rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
35
entryManager/data.js
Normal file
35
entryManager/data.js
Normal file
@@ -0,0 +1,35 @@
|
||||
export const userTypes={
|
||||
'0':'个体商户',
|
||||
'1':'企业商户',
|
||||
}
|
||||
|
||||
export const contactPersonTypes={
|
||||
'LEGAL':'经营者/法定代表人',
|
||||
'SUPER':'经办人',
|
||||
}
|
||||
|
||||
export const certTypes={
|
||||
'0':'身份证'
|
||||
}
|
||||
|
||||
export const companyChildTypes={
|
||||
'1':'普通企业',
|
||||
'2':'事业单位',
|
||||
'3':'政府机关',
|
||||
'4':'社会组织',
|
||||
}
|
||||
|
||||
export const sexs={
|
||||
'0':'男',
|
||||
'1':'女'
|
||||
}
|
||||
|
||||
export const settlementTypes={
|
||||
'0':'非法人结算',
|
||||
'1':'法人结算'
|
||||
}
|
||||
|
||||
export const settlementCardTypes={
|
||||
'11':'对私借记卡',
|
||||
'21':'对公借记卡',
|
||||
}
|
||||
357
entryManager/index/index.vue
Normal file
357
entryManager/index/index.vue
Normal file
@@ -0,0 +1,357 @@
|
||||
<template>
|
||||
<view class="min-page bg-f7 u-font-28 color-333">
|
||||
<up-sticky>
|
||||
<view class="top u-flex">
|
||||
<up-select :options="statusList" @select="statusListSelect">
|
||||
<template #text>
|
||||
<text v-if="query.status">{{returnStatusLabel(query.status)}}</text>
|
||||
<text v-else>状态</text>
|
||||
</template>
|
||||
</up-select>
|
||||
<view class="u-flex-1 u-p-l-32">
|
||||
<up-search placeholder="店铺名称" v-model="query.shopName" @search="search" @clear="search"
|
||||
@custom="search"></up-search>
|
||||
</view>
|
||||
</view>
|
||||
</up-sticky>
|
||||
<view class="box">
|
||||
<view class="container" v-for="(item,index) in list" :key="index">
|
||||
<view>
|
||||
<view class="">
|
||||
<text class="color-666">商户号:</text>
|
||||
<text class="font-bold">{{item.merchantCode}}</text>
|
||||
</view>
|
||||
<view class="u-m-t-24">
|
||||
<text class="color-666">商户简称:</text>
|
||||
<text class="font-bold">{{item.shortName}}</text>
|
||||
</view>
|
||||
<view class="u-m-t-24">
|
||||
<text class="color-666">店铺名称:</text>
|
||||
<text class="font-bold">{{item.shopName}}</text>
|
||||
</view>
|
||||
<view class="u-m-t-24 u-flex u-col-center">
|
||||
<text class="color-666">商户类型:</text>
|
||||
<view class="types font-bold">{{returnType(item.userType)}}</view>
|
||||
</view>
|
||||
<view class="status">
|
||||
<view class="u-flex u-row-between ">
|
||||
<text class="font-bold">支付宝进件状态</text>
|
||||
<view class="state" :class="returnStatusClass(item.alipayStatus)">
|
||||
{{returnStatusLabel(item.alipayStatus)}}
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="item.alipayStatus==='SIGN'" class="u-m-t-16">
|
||||
<my-button @click="showCode(item,'aliPay')">查看签约码</my-button>
|
||||
</view>
|
||||
<view class="u-m-t-14" v-if="item.alipayErrorMsg">
|
||||
<up-alert title="拒绝原因" type="error" :description="item.alipayErrorMsg"></up-alert>
|
||||
</view>
|
||||
</view>
|
||||
<view class="status">
|
||||
<view class="">
|
||||
<view class="u-flex u-row-between">
|
||||
<text class="font-bold">微信进件状态</text>
|
||||
<view class="state" :class="returnStatusClass(item.wechatStatus)">
|
||||
{{returnStatusLabel(item.wechatStatus)}}
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="item.wechatStatus==='SIGN'" class="u-m-t-16">
|
||||
<my-button @click="showCode(item,'wx')">查看签约码</my-button>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="u-m-t-14" v-if="item.wechatErrorMsg">
|
||||
<up-alert title="拒绝原因" type="error" :description="item.wechatErrorMsg"></up-alert>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="u-m-t-24 u-flex u-col-center">
|
||||
<text class="color-666">最后提交时间:</text>
|
||||
<view class=" font-bold">{{item.updateTime}}</view>
|
||||
</view>
|
||||
<view class="u-m-t-24 u-flex u-col-center">
|
||||
<text class="color-666">创建时间:</text>
|
||||
<view class=" font-bold">{{item.createTime}}</view>
|
||||
</view>
|
||||
|
||||
<view class="u-flex u-m-t-32 u-row-right gap-20">
|
||||
<view style="min-width: 160rpx;" v-if="
|
||||
item.wechatStatus == 'INIT' || item.wechatStatus == 'AUDIT'||item.wechatStatus == 'SIGN' || item.alipayStatus == 'INIT' || item.alipayStatus == 'AUDIT' ||item.alipayStatus == 'SIGN'
|
||||
">
|
||||
<my-button @click="queryStatus(item)">查询</my-button>
|
||||
</view>
|
||||
<view style="min-width: 160rpx;">
|
||||
<my-button @click="toEdit(item)">编辑</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<template v-if="query.shopName">
|
||||
<up-empty v-if="list.length<=0" text="未搜索到相关信息"></up-empty>
|
||||
<up-loadmore :status="isEnd?'nomore':'loading'" v-else></up-loadmore>
|
||||
</template>
|
||||
<template v-else>
|
||||
<up-empty v-if="list.length<=0" text="未搜索到相关信息"></up-empty>
|
||||
<up-loadmore v-else :status="isEnd?'nomore':'loading'"></up-loadmore>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
<view style="height: 140rpx;"></view>
|
||||
<view class="bottom">
|
||||
<my-button @click="showShopSelect=true">添加进件</my-button>
|
||||
</view>
|
||||
|
||||
<shopSelect v-model="showShopSelect" @confirm="toAdd"></shopSelect>
|
||||
<up-popup :show="codeShow" mode="center" @close="codeShow=false"
|
||||
round="16rpx"
|
||||
:close-on-click-overlay="true">
|
||||
<view style="border-radius: 16rpx;overflow: hidden;" class="u-p-b-30">
|
||||
<up-image width="200" height="200" :src="code"></up-image>
|
||||
<view class="u-m-t-0 text-center" v-if="codeType=='wx'">请打开微信扫码</view>
|
||||
<view class="u-m-t-0 text-center" v-if="codeType=='aliPay'">请打开支付宝扫码</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
userTypes
|
||||
} from '../data.js'
|
||||
|
||||
const code = ref('')
|
||||
const codeShow = ref(false)
|
||||
const codeType=ref('')
|
||||
|
||||
function returnType(type) {
|
||||
if (userTypes[type]) {
|
||||
return userTypes[type]
|
||||
}
|
||||
return ''
|
||||
}
|
||||
import {
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import shopSelect from '../components/shop-select.vue'
|
||||
import {
|
||||
onReachBottom,
|
||||
onShow
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
getList,
|
||||
queryEntry
|
||||
} from '@/http/api/order/entryManager.js'
|
||||
|
||||
// WAIT 待提交
|
||||
// INIT 待处理
|
||||
// AUDIT 待审核
|
||||
// SIGN 待签约
|
||||
// FINISH 已完成
|
||||
// REJECTED 失败
|
||||
const statusList = [{
|
||||
value: 'WAIT',
|
||||
name: '待提交',
|
||||
class: 'gray'
|
||||
},
|
||||
{
|
||||
value: 'INIT',
|
||||
name: '待处理',
|
||||
class: 'warning'
|
||||
},
|
||||
{
|
||||
value: 'AUDIT',
|
||||
name: '待审核',
|
||||
class: 'warning'
|
||||
},
|
||||
{
|
||||
value: 'SIGN',
|
||||
name: '待签约',
|
||||
class: 'warning'
|
||||
},
|
||||
{
|
||||
value: 'FINISH',
|
||||
name: '已完成',
|
||||
class: 'success'
|
||||
},
|
||||
{
|
||||
value: 'REJECTED',
|
||||
name: '失败',
|
||||
class: 'error'
|
||||
},
|
||||
]
|
||||
|
||||
function statusListSelect(e) {
|
||||
query.status = e.value
|
||||
}
|
||||
const statusLabelJson = {
|
||||
'REJECTED': '已拒绝'
|
||||
}
|
||||
const statusClassJson = {
|
||||
'REJECTED': 'error'
|
||||
}
|
||||
|
||||
function returnStatusLabel(state) {
|
||||
const item = statusList.find(v => v.value == state)
|
||||
if (item) {
|
||||
return item.name
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
function returnStatusClass(state) {
|
||||
const item = statusList.find(v => v.value == state)
|
||||
if (item) {
|
||||
return item.class
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
function showCode(item, type) {
|
||||
if (type == 'wx') {
|
||||
code.value = item.wechatSignUrl
|
||||
}
|
||||
if (type == 'aliPay') {
|
||||
code.value = item.alipaySignUrl
|
||||
}
|
||||
codeType.value=type
|
||||
codeShow.value = true
|
||||
|
||||
}
|
||||
|
||||
const showShopSelect = ref(false)
|
||||
|
||||
const query = reactive({
|
||||
page: 1,
|
||||
size: 10,
|
||||
shopName: '',
|
||||
status: ''
|
||||
})
|
||||
watch(() => query.status, (newval) => {
|
||||
search()
|
||||
})
|
||||
const isEnd = ref(false)
|
||||
const list = ref([])
|
||||
|
||||
function search() {
|
||||
isEnd.value = false
|
||||
query.page = 1
|
||||
getData()
|
||||
}
|
||||
|
||||
function toAdd(shop) {
|
||||
console.log(shop)
|
||||
uni.navigateTo({
|
||||
url: '/entryManager/add/add?shopId=' + shop.shopId
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function toEdit(shop) {
|
||||
console.log(shop)
|
||||
uni.navigateTo({
|
||||
url: '/entryManager/add/add?shopId=' + shop.shopId + '&licenceNo=' + shop.licenceNo
|
||||
})
|
||||
}
|
||||
|
||||
function getData() {
|
||||
getList(query).then(res => {
|
||||
isEnd.value = query.page >= res.totalPage * 1
|
||||
if (query.page == 1) {
|
||||
list.value = res.records
|
||||
} else {
|
||||
list.value.push(...res.records)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function queryStatus(item) {
|
||||
queryEntry({
|
||||
licenceNo: item.licenceNo,
|
||||
shopId: item.shopId
|
||||
}).then(res => {
|
||||
isEnd.value = false
|
||||
query.page = 1;
|
||||
getData()
|
||||
})
|
||||
}
|
||||
onReachBottom(() => {
|
||||
if (!isEnd.value) {
|
||||
query.page++
|
||||
}
|
||||
|
||||
})
|
||||
onShow(getData)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.min-page {
|
||||
.box {
|
||||
padding: 32rpx 28rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.container {
|
||||
padding: 32rpx 28rpx;
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 32rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.bottom {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background-color: #fff;
|
||||
z-index: 100;
|
||||
padding: 32rpx 28rpx;
|
||||
padding-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.types {}
|
||||
|
||||
.status {
|
||||
margin-top: 24rpx;
|
||||
background-color: #f7f7f7;
|
||||
padding: 24rpx 28rpx;
|
||||
border-radius: 4rpx;
|
||||
|
||||
.state {
|
||||
padding: 8rpx 18rpx;
|
||||
border-radius: 8rpx;
|
||||
border: 2rpx solid #333;
|
||||
|
||||
&.success {
|
||||
border-color: rgba(123, 209, 54, 1);
|
||||
color: rgba(123, 209, 54, 1);
|
||||
background: rgba(123, 209, 54, 0.12);
|
||||
}
|
||||
|
||||
&.warning {
|
||||
border-color: rgba(255, 141, 40, 1);
|
||||
color: rgba(255, 141, 40, 1);
|
||||
background: rgba(255, 141, 40, 0.12);
|
||||
}
|
||||
|
||||
&.error {
|
||||
border-color: #FF1C1C;
|
||||
color: #FF1C1C;
|
||||
background: rgba(255, 28, 28, 0.18);
|
||||
}
|
||||
|
||||
&.gray {
|
||||
color: #bbb;
|
||||
background-color: #f7f7f7;
|
||||
border-color: #bbb;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.top {
|
||||
padding: 32rpx 28rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
</style>
|
||||
@@ -188,4 +188,13 @@ export function shopUserFlow(data) {
|
||||
method: 'get',
|
||||
data
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export function getShopUser(data) {
|
||||
return request({
|
||||
url: `account/admin/shopUser`,
|
||||
method: 'get',
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
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
|
||||
})
|
||||
}
|
||||
17
http/api/market/points.js
Normal file
17
http/api/market/points.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import http from '@/http/http.js'
|
||||
const request = http.request
|
||||
const MARKET_URL = 'market'
|
||||
const ORDER_URL = 'order'
|
||||
|
||||
/**
|
||||
* 积分:配置:新增/更新
|
||||
* @param {Object} data
|
||||
*/
|
||||
export function pointsConfig(data) {
|
||||
return request({
|
||||
url: MARKET_URL+`/admin/points/config`,
|
||||
method: "GET",
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
71
http/api/order/entryManager.js
Normal file
71
http/api/order/entryManager.js
Normal file
@@ -0,0 +1,71 @@
|
||||
import http from "@/http/http.js";
|
||||
const request = http.request;
|
||||
const urlType = "order";
|
||||
|
||||
|
||||
|
||||
export function getList(data) {
|
||||
return request({
|
||||
url: urlType + '/admin/data/entryManager/list',
|
||||
method: "GET",
|
||||
data: {
|
||||
...data,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// ocr识别填充
|
||||
export function getInfoByImg(data) {
|
||||
return request({
|
||||
url: urlType + '/admin/data/entryManager/getInfoByImg',
|
||||
method: "GET",
|
||||
data: {
|
||||
...data,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// 查询银行支行列表
|
||||
export function bankBranchList(data) {
|
||||
return request({
|
||||
url: urlType + '/admin/data/entryManager/bankBranchList',
|
||||
method: "GET",
|
||||
data: {
|
||||
...data,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// 获取进件信息
|
||||
export function getEntryManager(data) {
|
||||
return request({
|
||||
url: urlType + '/admin/data/entryManager',
|
||||
method: "GET",
|
||||
data: {
|
||||
...data,
|
||||
},
|
||||
});
|
||||
}
|
||||
//主动查询进件信息状态
|
||||
export function queryEntry(data) {
|
||||
return request({
|
||||
url: urlType + '/admin/data/entryManager/queryEntry',
|
||||
method: "GET",
|
||||
data: {
|
||||
...data,
|
||||
},
|
||||
});
|
||||
}
|
||||
//申请进件
|
||||
|
||||
|
||||
export function addEntryManager(data) {
|
||||
return request({
|
||||
url: urlType + '/admin/data/entryManager',
|
||||
method: "POST",
|
||||
data: {
|
||||
...data,
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -5,7 +5,7 @@ const request = http.request
|
||||
* 获取商品分页
|
||||
* @returns
|
||||
*/
|
||||
export function getProductPage(data, urlType = 'product' ,showLoading) {
|
||||
export function getProductPage(data, urlType = 'product', showLoading) {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/page`,
|
||||
method: "GET",
|
||||
@@ -20,7 +20,7 @@ export function getProductPage(data, urlType = 'product' ,showLoading) {
|
||||
* 获取商品列表
|
||||
* @returns
|
||||
*/
|
||||
export function getProductList(data, urlType = 'product' ,showLoading) {
|
||||
export function getProductList(data, urlType = 'product', showLoading) {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/list`,
|
||||
method: "GET",
|
||||
@@ -36,11 +36,11 @@ export function getProductList(data, urlType = 'product' ,showLoading) {
|
||||
* 获取商品详情
|
||||
* @returns
|
||||
*/
|
||||
export function getProductDetail (id, urlType = 'product') {
|
||||
export function getProductDetail(id, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/${id}`,
|
||||
method: "GET",
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ export function delProduct(id, urlType = 'product') {
|
||||
* 商品上下架
|
||||
* @returns
|
||||
*/
|
||||
export function productOnOff (data, urlType = 'product') {
|
||||
export function productOnOff(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/onOff`,
|
||||
method: "POST",
|
||||
@@ -87,7 +87,7 @@ export function productOnOff (data, urlType = 'product') {
|
||||
* 商品售罄
|
||||
* @returns
|
||||
*/
|
||||
export function productMarkIsSoldOut (data, urlType = 'product') {
|
||||
export function productMarkIsSoldOut(data, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/product/markIsSoldOut`,
|
||||
method: "POST",
|
||||
@@ -262,7 +262,7 @@ export function delSpec(id, urlType = 'product') {
|
||||
return request({
|
||||
url: `${urlType}/admin/prod/spec/${id}`,
|
||||
method: "DELETE",
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
@@ -343,4 +343,28 @@ export function delProdGroup(id, urlType = 'product') {
|
||||
url: `${urlType}/admin/prod/group/${id}`,
|
||||
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,17 @@ export function getShopInfo(data, urlType = 'account') {
|
||||
})
|
||||
}
|
||||
|
||||
export function adminShopList(data, urlType = 'account') {
|
||||
return request({
|
||||
url: `${urlType}/admin/shopInfo`,
|
||||
method: "get",
|
||||
data: {
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改店铺详情
|
||||
* @returns
|
||||
|
||||
23
http/api/system/common.js
Normal file
23
http/api/system/common.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import http from "@/http/http.js";
|
||||
const request = http.request;
|
||||
const urlType = "system";
|
||||
export function bankInfo(data) {
|
||||
return request({
|
||||
url: urlType + '/admin/common/bankInfo',
|
||||
method: "GET",
|
||||
data: {
|
||||
...data,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
export function mccCategory(data) {
|
||||
return request({
|
||||
url: urlType + '/admin/common/category',
|
||||
method: "GET",
|
||||
data: {
|
||||
...data,
|
||||
},
|
||||
});
|
||||
}
|
||||
12
http/api/system/region.js
Normal file
12
http/api/system/region.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import http from "@/http/http.js";
|
||||
const request = http.request;
|
||||
const urlType = "system";
|
||||
export function region(data) {
|
||||
return request({
|
||||
url: urlType + '/admin/common/region',
|
||||
method: "GET",
|
||||
data: {
|
||||
...data,
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -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
|
||||
@@ -52,5 +64,4 @@ export function delVendor(id, urlType = 'product') {
|
||||
url: `${urlType}/admin/product/vendor/${id}`,
|
||||
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
|
||||
}
|
||||
});
|
||||
}
|
||||
17
http/http.js
17
http/http.js
@@ -15,23 +15,10 @@ import infoBox from "@/commons/utils/infoBox.js";
|
||||
import go from "@/commons/utils/go.js";
|
||||
import { reject } from "lodash";
|
||||
// 设置node环境
|
||||
envConfig.changeEnv(storageManage.env('production')) //正式
|
||||
// envConfig.changeEnv(storageManage.env('production')) //正式
|
||||
// envConfig.changeEnv(storageManage.env("development")); //测试
|
||||
|
||||
// 测试服
|
||||
// #ifdef H5
|
||||
let baseUrl = "/javaapi/";
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
// let baseUrl = 'https://tapi.cashier.sxczgkj.cn/'
|
||||
//预发布
|
||||
// let baseUrl = 'https://pre-cashieradmin.sxczgkj.cn'
|
||||
|
||||
//正式
|
||||
// let baseUrl = 'https://cashier.sxczgkj.com/'
|
||||
let baseUrl = appConfig.env.JEEPAY_BASE_URL;
|
||||
// #endif
|
||||
|
||||
let baseUrl = appConfig.returnBaseUrl({apiType:'java'});
|
||||
const loadingShowTime = 200;
|
||||
|
||||
function getHeader() {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// const baseURL : string = 'https://newblockwlx.sxczgkj.cn/index.php/api/'
|
||||
let baseURL: string = "http://192.168.1.42:8787/api/";
|
||||
// #ifdef H5
|
||||
baseURL = "/phpapi/api/";
|
||||
baseURL = "/prodPhpApi/api/";
|
||||
// #endif
|
||||
|
||||
import go from "@/commons/utils/go.js";
|
||||
|
||||
@@ -14,24 +14,7 @@ import storageManage from '@/commons/utils/storageManage.js'
|
||||
import infoBox from "@/commons/utils/infoBox.js"
|
||||
import go from '@/commons/utils/go.js';
|
||||
import { reject } from 'lodash';
|
||||
// 设置node环境
|
||||
envConfig.changeEnv(storageManage.env('production'))
|
||||
// envConfig.changeEnv(storageManage.env('development'))
|
||||
|
||||
// 测试服
|
||||
// #ifdef H5
|
||||
let baseUrl = '/api/'
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
// let baseUrl = 'https://tapi.cashier.sxczgkj.cn/'
|
||||
//预发布
|
||||
// let baseUrl = 'https://pre-cashieradmin.sxczgkj.cn'
|
||||
|
||||
//正式
|
||||
// let baseUrl = 'https://cashier.sxczgkj.com/'
|
||||
let baseUrl = appConfig.env.JEEPAY_BASE_URL
|
||||
// #endif
|
||||
|
||||
let baseUrl = appConfig.returnBaseUrl({apiType:'java'});
|
||||
const loadingShowTime = 200
|
||||
|
||||
function getHeader(){
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"pinia-plugin-unistorage": "^0.1.2",
|
||||
"to-arraybuffer": "^1.0.1",
|
||||
"uview-plus": "^3.3.32",
|
||||
"ysk-utils": "^1.0.78"
|
||||
"ysk-utils": "^1.0.82"
|
||||
},
|
||||
"devDependencies": {
|
||||
"copy-webpack-plugin": "^12.0.2",
|
||||
|
||||
@@ -1,188 +1,288 @@
|
||||
<template>
|
||||
<view class="topTitle">
|
||||
耗材信息
|
||||
</view>
|
||||
<view class="topTitle">耗材信息</view>
|
||||
<view class="addConsumables">
|
||||
<view>
|
||||
<view>
|
||||
<view> 单位 </view>
|
||||
<view> <input type="text" placeholder="请输入单位" v-model="datas.form.conUnit" name="" id=""> </view>
|
||||
<view>单位</view>
|
||||
<view><input type="text" placeholder="请输入单位" v-model="datas.form.conUnit" name="" id="" /></view>
|
||||
</view>
|
||||
<view>
|
||||
<view> 耗材名称 </view>
|
||||
<view> <input type="text" placeholder="请输入耗材名称" v-model="datas.form.conName" name="" id=""> </view>
|
||||
<view>耗材名称</view>
|
||||
<view><input type="text" placeholder="请输入耗材名称" v-model="datas.form.conName" name="" id="" /></view>
|
||||
</view>
|
||||
<view>
|
||||
<view> 耗材价格 </view>
|
||||
<view> <input class="uni-input" placeholder="请输入耗材价格" type="digit" v-model="datas.form.price" > </view>
|
||||
<view>耗材价格</view>
|
||||
<view><input class="uni-input" placeholder="请输入耗材价格" type="digit" v-model="datas.form.price" /></view>
|
||||
</view>
|
||||
<view>
|
||||
<view> 预警值 </view>
|
||||
<view> <input type="number" placeholder="请输入预警值" v-model="datas.form.conWarning" name="" id=""> </view>
|
||||
<view>预警值</view>
|
||||
<view><input type="number" placeholder="请输入预警值" v-model="datas.form.conWarning" name="" id="" /></view>
|
||||
</view>
|
||||
<view v-if="!datas.form.id" style="justify-content: space-between;">
|
||||
<view> 耗材类型 </view>
|
||||
<view style="width: 54%;" @tap="datas.show = !datas.show">
|
||||
{{datas.consGroupName||'请选择耗材类型'}}
|
||||
<view v-if="!datas.form.id" style="justify-content: space-between">
|
||||
<view>耗材类型</view>
|
||||
<view style="width: 54%" @tap="datas.show = !datas.show">
|
||||
{{ datas.consGroupName || '请选择耗材类型' }}
|
||||
</view>
|
||||
<uni-icons type="bottom" size="16"></uni-icons>
|
||||
</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">
|
||||
<up-button type="primary" style="background-color: #318AFE;color: #fff;" @tap="sumbit" :plain="true"
|
||||
text="保存"></up-button>
|
||||
<up-button type="primary" style="background-color: #318afe; color: #fff" @tap="sumbit" :plain="true" text="保存"></up-button>
|
||||
</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>
|
||||
<u-picker :show="unitShow" :columns="unitList"></u-picker>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive } from 'vue';
|
||||
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]
|
||||
})
|
||||
}
|
||||
import { ref, reactive } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
|
||||
function confirmConsGroup(e){
|
||||
datas.show = false
|
||||
datas.form.consGroupId = e.value[0].id
|
||||
datas.consGroupName = e.value[0].name
|
||||
}
|
||||
import { getConsGrpupList, addCons, editCons } from '@/http/api/cons.js';
|
||||
|
||||
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()
|
||||
}
|
||||
let datas = reactive({
|
||||
show: false,
|
||||
form: {
|
||||
conUnit: '',
|
||||
conName: '',
|
||||
price: '',
|
||||
conWarning: 999,
|
||||
consGroupId: null,
|
||||
conUnitTwo: '', // 第二单位
|
||||
conUnitTwoConvert: '', // 第二单位转换数量
|
||||
defaultUnit: 2
|
||||
},
|
||||
consGroupName: '',
|
||||
typeList: []
|
||||
});
|
||||
|
||||
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>
|
||||
<style>
|
||||
page {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
page {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
</style>
|
||||
<style scoped lang="less">
|
||||
.topTitle {
|
||||
font-weight: 400;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
margin: 32rpx 28rpx;
|
||||
}
|
||||
.topTitle {
|
||||
font-weight: 400;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
margin: 32rpx 28rpx;
|
||||
}
|
||||
|
||||
.addConsumables {
|
||||
width: 694rpx;
|
||||
height: 640rpx;
|
||||
background: #FFFFFF;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
margin: 32rpx;
|
||||
padding: 1rpx 24rpx;
|
||||
box-sizing: border-box;
|
||||
.addConsumables {
|
||||
width: 694rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
margin: 32rpx;
|
||||
padding: 24rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
>view {
|
||||
>view {
|
||||
width: 646rpx;
|
||||
> view {
|
||||
> view {
|
||||
width: 646rpx;
|
||||
height: 84rpx;
|
||||
background: #fcfcfc;
|
||||
border: 2rpx solid #f9f9f9;
|
||||
margin-top: 32rpx;
|
||||
.df;
|
||||
|
||||
> view:first-child {
|
||||
width: 190rpx;
|
||||
height: 84rpx;
|
||||
background: #fcfcfc;
|
||||
border: 2rpx solid #F9F9F9;
|
||||
margin-top: 32rpx;
|
||||
.df;
|
||||
|
||||
>view:first-child {
|
||||
width: 190rpx;
|
||||
height: 84rpx;
|
||||
line-height: 84rpx;
|
||||
// text-align: left;
|
||||
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;
|
||||
}
|
||||
line-height: 84rpx;
|
||||
// text-align: left;
|
||||
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 {
|
||||
margin-top: 84rpx;
|
||||
padding: 0 24rpx;
|
||||
.bottombutton {
|
||||
margin-top: 84rpx;
|
||||
padding: 0 24rpx;
|
||||
|
||||
>button {
|
||||
width: 530rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 56rpx 56rpx 56rpx 56rpx;
|
||||
}
|
||||
> button {
|
||||
width: 530rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 56rpx 56rpx 56rpx 56rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.status {
|
||||
margin: 0 32rpx;
|
||||
position: absolute;
|
||||
// top: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 10;
|
||||
background-color: #fff;
|
||||
}
|
||||
.status {
|
||||
margin: 0 32rpx;
|
||||
position: absolute;
|
||||
// top: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 10;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.df() {
|
||||
.df() {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.tips-wrap {
|
||||
--pColor: #e6a23c;
|
||||
--iColor: #fdf6ec;
|
||||
padding: 0 28upx;
|
||||
.content {
|
||||
display: flex;
|
||||
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>
|
||||
<view class="ConsumablesTop">
|
||||
<view @tap="pageData.show = !pageData.show" style="display: flex;align-items: center;">
|
||||
{{pageData.title}}<up-icon name="arrow-down" size="12"></up-icon>
|
||||
<view @tap="pageData.show = !pageData.show" style="display: flex; align-items: center">
|
||||
{{ pageData.title }}
|
||||
<up-icon name="arrow-down" size="12"></up-icon>
|
||||
</view>
|
||||
<view>
|
||||
<input v-model="pageData.query.conName" @input="inputEvent" type="text" placeholder="请输入耗材名称" />
|
||||
</view>
|
||||
<view @tap="toUrl('PAGES_ADD_TYPE') ">
|
||||
新增类别
|
||||
</view>
|
||||
<view @tap="toUrl('PAGES_ADD_TYPE')">新增类别</view>
|
||||
</view>
|
||||
|
||||
<view class="ConsumablesConent" v-if="pageData.list.length">
|
||||
<view v-for="(item,index) in pageData.list" :key="index">
|
||||
<view> {{item.conName}}
|
||||
<view> {{item.consGroupName}} </view>
|
||||
<view v-for="(item, index) in pageData.list" :key="index">
|
||||
<view>
|
||||
{{ item.conName }}
|
||||
<view>{{ item.consGroupName }}</view>
|
||||
</view>
|
||||
<view>
|
||||
<view>
|
||||
<view style="color: #333333;"> {{item.conUnit}} </view>
|
||||
<view> 耗材单位 </view>
|
||||
<view style="color: #333333">{{ item.conUnit }}</view>
|
||||
<view>耗材单位</view>
|
||||
</view>
|
||||
<view>
|
||||
<view style="color: #318AFE;"> {{item.stockNumber}} </view>
|
||||
<view> 剩余库存 </view>
|
||||
<view style="color: #318afe">{{ item.stockNumber }}</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 class="">
|
||||
<up-button shape="circle" type="primary" size="mini" 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>
|
||||
<up-button
|
||||
shape="circle"
|
||||
type="primary"
|
||||
size="mini"
|
||||
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 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 v-else style="text-align: center;">
|
||||
<image src="./bg.png" style="width: 325rpx;height: 335rpx;" mode=""></image>
|
||||
<view style="font-size: 28rpx;color: #999;">暂无数据</view>
|
||||
<view v-else style="text-align: center">
|
||||
<image src="./bg.png" style="width: 325rpx; height: 335rpx" mode=""></image>
|
||||
<view style="font-size: 28rpx; color: #999">暂无数据</view>
|
||||
</view>
|
||||
<view class="ConsumablesBottom">
|
||||
<view @tap="toUrl('PAGES_ADD_CONSUMABLES')"> 新增耗材 </view>
|
||||
<view @tap="toUrl('PAGES_SUPPLIER')"> 供应商管理 </view>
|
||||
<view @tap="toUrl('PAGES_ADD_CONSUMABLES')">新增耗材</view>
|
||||
<view @tap="toUrl('PAGES_SUPPLIER')">供应商管理</view>
|
||||
</view>
|
||||
<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="">
|
||||
<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 class="">
|
||||
{{showData}}
|
||||
{{ showData }}
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
<up-action-sheet :round="10" @select="actionSelect" @close="actions.show = false" cancelText="取消" :actions="actions.list"
|
||||
: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-action-sheet :round="10" @select="actionSelect" @close="actions.show = false" cancelText="取消" :actions="actions.list" :show="actions.show"></up-action-sheet>
|
||||
<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>
|
||||
|
||||
<script setup>
|
||||
import { onShow, onLoad } from '@dcloudio/uni-app'
|
||||
import { ref, reactive, computed } from 'vue';
|
||||
import myReportDamage from './components/my-reportDamage';
|
||||
import { onShow, onLoad } from '@dcloudio/uni-app';
|
||||
import { ref, reactive, computed } from 'vue';
|
||||
import myReportDamage from './components/my-reportDamage';
|
||||
|
||||
import go from '@/commons/utils/go.js';
|
||||
import { hasPermission } from '@/commons/utils/hasPermission.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: '耗材类型'
|
||||
})
|
||||
import go from '@/commons/utils/go.js';
|
||||
import { hasPermission } from '@/commons/utils/hasPermission.js';
|
||||
import { getConsPage, getConsGrpupList } from '@/http/api/cons.js';
|
||||
|
||||
/**
|
||||
* 更多操作列表
|
||||
*/
|
||||
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,
|
||||
})
|
||||
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: '耗材类型'
|
||||
});
|
||||
|
||||
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
|
||||
});
|
||||
|
||||
/**
|
||||
* 获取耗材列表
|
||||
*/
|
||||
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()
|
||||
}
|
||||
onShow(() => {
|
||||
getList();
|
||||
gettbConsTypeList();
|
||||
});
|
||||
|
||||
/**
|
||||
* 报损确认
|
||||
*/
|
||||
function affirm() {
|
||||
uni.showToast({
|
||||
title:'操作成功',
|
||||
icon:'none'
|
||||
})
|
||||
getList()
|
||||
// 获取分类列表
|
||||
gettbConsTypeList()
|
||||
}
|
||||
// 跳转去批量入库
|
||||
function toBatchPage() {
|
||||
uni.navigateTo({
|
||||
url: '/pageConsumables/batch_in'
|
||||
});
|
||||
}
|
||||
|
||||
let toggle = (d) => {
|
||||
// refMoreSheet.value.open()
|
||||
actions.show = true;
|
||||
actions.actions = d
|
||||
report.data.consId = d.id
|
||||
}
|
||||
/**
|
||||
* 获取耗材列表
|
||||
*/
|
||||
async function getList() {
|
||||
getConsPage(pageData.query).then((res) => {
|
||||
pageData.list = res.records;
|
||||
});
|
||||
}
|
||||
|
||||
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()
|
||||
}
|
||||
/**
|
||||
* 获取耗材类别
|
||||
*/
|
||||
let gettbConsTypeList = () => {
|
||||
getConsGrpupList({
|
||||
page: 1,
|
||||
size: 30
|
||||
}).then((res) => {
|
||||
pageData.typeList = [[{ name: '全部', id: '' }, ...res]];
|
||||
});
|
||||
};
|
||||
|
||||
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)
|
||||
function confirmConsGroup(e) {
|
||||
pageData.show = false;
|
||||
pageData.query.consGroupId = e.value[0].id;
|
||||
pageData.title = e.value[0].name;
|
||||
getList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 报损确认
|
||||
*/
|
||||
function affirm() {
|
||||
uni.showToast({
|
||||
title: '操作成功',
|
||||
icon: 'none'
|
||||
});
|
||||
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>
|
||||
<style>
|
||||
page {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
page {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
</style>
|
||||
<style scoped lang="less">
|
||||
ul,
|
||||
li {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
ul,
|
||||
li {
|
||||
list-style: none;
|
||||
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 {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
padding-bottom: 22rpx;
|
||||
background-color: #fff;
|
||||
> view:last-child {
|
||||
color: #318afe;
|
||||
}
|
||||
|
||||
>view:first-child,
|
||||
>view:last-child {
|
||||
font-size: 24rpx;
|
||||
> view:nth-child(2) {
|
||||
width: 414rpx;
|
||||
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-weight: 500;
|
||||
font-size: 24rpx;
|
||||
color: #333333;
|
||||
}
|
||||
.df;
|
||||
|
||||
>view:last-child {
|
||||
color: #318AFE;
|
||||
}
|
||||
|
||||
>view:nth-child(2) {
|
||||
width: 414rpx;
|
||||
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-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;
|
||||
> 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: #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;
|
||||
justify-content: space-between;
|
||||
|
||||
>view:last-child {
|
||||
.df;
|
||||
> button {
|
||||
width: 128rpx;
|
||||
height: 48rpx;
|
||||
background: #ffffff;
|
||||
// border-radius: 28rpx 28rpx 28rpx 28rpx;
|
||||
}
|
||||
|
||||
>button {
|
||||
width: 128rpx;
|
||||
height: 48rpx;
|
||||
background: #FFFFFF;
|
||||
// border-radius: 28rpx 28rpx 28rpx 28rpx;
|
||||
}
|
||||
|
||||
>button:last-child {
|
||||
margin-left: 24rpx;
|
||||
}
|
||||
> button:last-child {
|
||||
margin-left: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.ConsumablesBottom {
|
||||
.df;
|
||||
position: fixed;
|
||||
bottom: 20rpx;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
.ConsumablesBottom {
|
||||
.df;
|
||||
position: fixed;
|
||||
bottom: 20rpx;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
|
||||
>view {
|
||||
width: 346rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
border: 2rpx solid #318AFE;
|
||||
> view {
|
||||
width: 346rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
border: 2rpx solid #318afe;
|
||||
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: 500;
|
||||
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;
|
||||
}
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: 500;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.popup-content {
|
||||
padding: 15px;
|
||||
> view:first-child {
|
||||
border-radius: 56rpx 0rpx 0rpx 56rpx;
|
||||
color: #318afe;
|
||||
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;
|
||||
line-height: 88rpx;
|
||||
width: 660rpx;
|
||||
border-top: 10rpx solid #f9f9f9;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.operate {
|
||||
>view {
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
text-align: center;
|
||||
width: 660rpx;
|
||||
border-bottom: 2rpx solid #E5E5E5;
|
||||
|
||||
}
|
||||
width: 660rpx;
|
||||
border-bottom: 2rpx solid #e5e5e5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.status {
|
||||
position: absolute;
|
||||
// top: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 10;
|
||||
background-color: #fff;
|
||||
}
|
||||
.status {
|
||||
position: absolute;
|
||||
// top: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 10;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.zhezhaopop {
|
||||
padding: 34rpx 32rpx;
|
||||
width: 594rpx;
|
||||
.zhezhaopop {
|
||||
padding: 34rpx 32rpx;
|
||||
width: 594rpx;
|
||||
|
||||
>view:first-child {
|
||||
> view:first-child {
|
||||
.df;
|
||||
justify-content: space-between;
|
||||
|
||||
.df;
|
||||
justify-content: space-between;
|
||||
|
||||
>span:nth-child(2) {
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
> span:nth-child(2) {
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: bold;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.df() {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.df() {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.fixed-in-btn {
|
||||
position: fixed;
|
||||
right: 20upx;
|
||||
bottom: 20%;
|
||||
z-index: 999;
|
||||
.img {
|
||||
width: 120upx;
|
||||
}
|
||||
</style>
|
||||
}
|
||||
</style>
|
||||
|
||||
219
pageMarket/distribution/components/fenxiao-user-select.vue
Normal file
219
pageMarket/distribution/components/fenxiao-user-select.vue
Normal file
@@ -0,0 +1,219 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
<view class="box" @click.stop="openPopup">
|
||||
<text class="u-font-28 color-999 u-p-r-16" v-if="!modelValue||list.length==0">请选择用户</text>
|
||||
<text class="u-font-28 color-333 u-p-r-16 u-line-1" v-else :style="{
|
||||
maxWidth: maxWidth+'rpx'
|
||||
}">{{returnLabel()}}</text>
|
||||
<view class="icon ">
|
||||
<up-icon name="arrow-down" size="14" color="#999"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<up-popup :show="show" placement="bottom" round="18rpx" closeOnClickOverlay @close="close">
|
||||
<view class="u-p-30">
|
||||
<view class="font-bold color-333 u-font-32">选择用户</view>
|
||||
<view class="u-m-t-24">
|
||||
<up-search v-model="query.key" @clear="search" @custom="search" @search="search"></up-search>
|
||||
</view>
|
||||
<scroll-view scroll-with-animation :scroll-into-view="selId" class="scroll-view u-m-t-30"
|
||||
scroll-y="true" style="max-height :60vh;" @scrolltolower="scrolltolower">
|
||||
<view class="u-m-b-10 u-flex item" v-for="item in list" :key="item.id" @click="itemClick(item)"
|
||||
:id="'item_'+item.id" :class="{active:selItem&&selItem.id==item.id}">
|
||||
<view class="checkbox">
|
||||
<up-icon name="checkbox-mark" color="#fff"></up-icon>
|
||||
</view>
|
||||
<view class="u-flex-1">{{item.nickName}}/{{item.phone}}</view>
|
||||
</view>
|
||||
<template v-if="search.key!==''">
|
||||
<up-empty v-if="list.length==0" text="未搜到相关用户"></up-empty>
|
||||
<up-loadmore v-else :status="isEnd?'nomore':'loading'"></up-loadmore>
|
||||
</template>
|
||||
<template v-else>
|
||||
<up-empty v-if="list.length==0" text="暂无用户"></up-empty>
|
||||
<up-loadmore v-else :status="isEnd?'nomore':'loading'"></up-loadmore>
|
||||
</template>
|
||||
</scroll-view>
|
||||
<view class="u-flex gap-20 u-m-t-30">
|
||||
<view class="u-flex-1">
|
||||
<my-button type="default" @click="close">取消</my-button>
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
<my-button type="primary" @click="submit">确定</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
onMounted,
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
getShopUser
|
||||
} from '@/http/api/market/index.js';
|
||||
|
||||
const customStyle = ref({
|
||||
marginRight: '20px'
|
||||
});
|
||||
|
||||
const show = ref(false);
|
||||
let modelValue = defineModel('modelValue', {
|
||||
default: '',
|
||||
});
|
||||
|
||||
const props=defineProps({
|
||||
maxWidth:{
|
||||
default:240
|
||||
}
|
||||
})
|
||||
|
||||
const selId = ref('')
|
||||
|
||||
function returnLabel() {
|
||||
const findItem = list.value.find(v => v.id == modelValue.value)
|
||||
if(findItem){
|
||||
return findItem.nickName+(findItem.phone?('/'+findItem.phone):'')
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
const selItem=ref(null)
|
||||
function itemClick(item) {
|
||||
selItem.value=item
|
||||
}
|
||||
|
||||
function returnShopName(id) {
|
||||
const item = list.value.find((v) => v.id == id);
|
||||
return item?.shopName || '';
|
||||
}
|
||||
|
||||
function close() {
|
||||
show.value = false;
|
||||
}
|
||||
|
||||
|
||||
const emits=defineEmits(['change'])
|
||||
|
||||
function submit() {
|
||||
if(!selItem.value){
|
||||
return uni.showToast({
|
||||
title:'请选择用户'
|
||||
})
|
||||
}
|
||||
|
||||
modelValue.value = selItem.value.id
|
||||
if(modelValue.value!=selItem.value.id){
|
||||
emits('change')
|
||||
}
|
||||
show.value = false;
|
||||
}
|
||||
|
||||
|
||||
const list = ref([]);
|
||||
|
||||
function openPopup() {
|
||||
selId.value = 'item_' + modelValue.value
|
||||
init()
|
||||
show.value = true;
|
||||
|
||||
}
|
||||
const isEnd = ref(false)
|
||||
const query = reactive({
|
||||
page: 1,
|
||||
size: 10,
|
||||
key: ''
|
||||
})
|
||||
|
||||
function search() {
|
||||
isEnd.value = false
|
||||
query.page = 1
|
||||
selItem.value=null
|
||||
init()
|
||||
}
|
||||
async function init() {
|
||||
const res = await getShopUser(query);
|
||||
if (res) {
|
||||
isEnd.value = query.page >= res.totalPage * 1
|
||||
if (query.page == 1) {
|
||||
list.value = res.records
|
||||
} else {
|
||||
list.value.push(...res.records)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function scrolltolower() {
|
||||
if (!isEnd.value) {
|
||||
query.page++
|
||||
init()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.box {
|
||||
border-radius: 8upx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: top;
|
||||
flex-wrap: wrap;
|
||||
padding: 10rpx 24rpx;
|
||||
border: 2rpx solid #e5e5e5;
|
||||
position: relative;
|
||||
.icon {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 24rpx;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
.shop-item {
|
||||
padding: 4rpx 8rpx 4rpx 16rpx;
|
||||
border-radius: 4rpx;
|
||||
border: 2rpx solid #f0f0f0;
|
||||
background-color: #f5f5f5;
|
||||
margin-bottom: 16rpx;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.scroll-view {
|
||||
.item {
|
||||
border: 1px solid #eee;
|
||||
padding: 20rpx;
|
||||
border-radius: 12rpx;
|
||||
|
||||
&.active {
|
||||
border-color: $my-main-color;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
margin-right: 10rpx;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 6rpx;
|
||||
border: 1px solid #999;
|
||||
|
||||
}
|
||||
|
||||
.item {
|
||||
&.active {
|
||||
.checkbox {
|
||||
background-color: $my-main-color;
|
||||
border-color: $my-main-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,34 +1,25 @@
|
||||
<template>
|
||||
<view class="min-page u-font-28">
|
||||
<up-sticky>
|
||||
<view class="bg-fff top">
|
||||
<view class="bg-fff container u-flex u-m-b-48">
|
||||
<image
|
||||
style="width: 60rpx; height: 60rpx"
|
||||
src="/pageMarket/static/images/distribution.png"
|
||||
></image>
|
||||
<view class="u-flex-1 u-flex u-p-l-24">
|
||||
<view class="u-font-28 u-flex-1 u-p-r-4">
|
||||
<view class="color-333 font-bold">分销</view>
|
||||
<view class="color-666 u-m-t-4 u-font-24"
|
||||
>用户成为业务员,可促进消费
|
||||
</view>
|
||||
</view>
|
||||
<up-switch
|
||||
v-model="distributionStore.config.isEnable"
|
||||
size="18"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
></up-switch>
|
||||
</view>
|
||||
</view>
|
||||
<my-tabs v-model="active" :list="tabs" textKey="label"></my-tabs>
|
||||
<view
|
||||
v-if="active == 1 || active == 2"
|
||||
class="u-flex u-row-between u-m-t-32"
|
||||
style="gap: 58rpx"
|
||||
>
|
||||
<view class="u-flex-1 filter-box" style="border-radius: 100rpx">
|
||||
<view class="min-page u-font-28">
|
||||
<up-sticky>
|
||||
<view class="bg-fff top">
|
||||
<view class="bg-fff container u-flex u-m-b-48">
|
||||
<image style="width: 60rpx; height: 60rpx" src="/pageMarket/static/images/distribution.png"></image>
|
||||
<view class="u-flex-1 u-flex u-p-l-24">
|
||||
<view class="u-font-28 u-flex-1 u-p-r-4">
|
||||
<view class="color-333 font-bold">分销</view>
|
||||
<view class="color-666 u-m-t-4 u-font-24">用户成为业务员,可促进消费
|
||||
</view>
|
||||
</view>
|
||||
<up-switch v-model="distributionStore.config.isEnable" size="18" :active-value="1"
|
||||
:inactive-value="0"></up-switch>
|
||||
</view>
|
||||
</view>
|
||||
<my-tabs v-model="active" :list="tabs" textKey="label"></my-tabs>
|
||||
<view v-if="active == 1 || active == 2" class="u-flex u-row-between u-m-t-32" style="gap: 58rpx">
|
||||
<view class="u-flex-1">
|
||||
<fenXiaoUserSelect v-model="userId" @change="getList()" />
|
||||
</view>
|
||||
<!-- <view class="u-flex-1 filter-box" style="border-radius: 100rpx">
|
||||
<up-icon name="search" size="18"></up-icon>
|
||||
<input
|
||||
class="u-m-l-10 u-font-28"
|
||||
@@ -39,476 +30,439 @@
|
||||
@blur="keyWordBlur"
|
||||
/>
|
||||
<up-icon v-if="keyWord" name="close" size="14" @click="clearKeyWord"></up-icon>
|
||||
</view>
|
||||
<view
|
||||
class="u-flex-1 u-font-28 filter-box u-flex u-row-between"
|
||||
@click="showTimeArea = true"
|
||||
>
|
||||
<template
|
||||
v-if="userComponentQuery.startTime && userComponentQuery.endTime"
|
||||
>
|
||||
<text class="u-font-20">
|
||||
{{ userComponentQuery.startTime }} -
|
||||
{{ userComponentQuery.endTime }}
|
||||
</text>
|
||||
<view @click.stop="clearTime">
|
||||
<up-icon name="close" size="14"></up-icon>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<text class="color-999">请选择日期范围</text>
|
||||
<up-icon name="arrow-right" size="12"></up-icon>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
v-if="active == 3"
|
||||
class="u-flex u-row-between u-m-t-32"
|
||||
style="gap: 30rpx"
|
||||
>
|
||||
<view
|
||||
class="u-font-28 filter-box u-flex u-row-between"
|
||||
@click="showActions = true"
|
||||
>
|
||||
<template v-if="selActions && selActions.value">
|
||||
<text class="u-font-28 u-m-r-10">{{ selActions.name }} </text>
|
||||
</template>
|
||||
<template v-else>
|
||||
<text class="color-999 u-m-r-10">全部</text>
|
||||
</template>
|
||||
<up-icon name="arrow-down" size="12"></up-icon>
|
||||
</view>
|
||||
<view class="u-flex-1 filter-box" style="border-radius: 100rpx">
|
||||
<up-icon name="search" size="18"></up-icon>
|
||||
<input
|
||||
class="u-m-l-10 u-font-28"
|
||||
type="text"
|
||||
placeholder-class="color-999 u-font-28"
|
||||
placeholder="分销员昵称/手机号"
|
||||
v-model="keyWord"
|
||||
@blur="keyWordBlur"
|
||||
/>
|
||||
</view>
|
||||
<view
|
||||
class="u-flex-1 u-font-28 filter-box u-flex u-row-between"
|
||||
@click="showTimeArea = true"
|
||||
>
|
||||
<template
|
||||
v-if="userComponentQuery.startTime && userComponentQuery.endTime"
|
||||
>
|
||||
<text class="u-font-20">
|
||||
{{ userComponentQuery.startTime }} -
|
||||
{{ userComponentQuery.endTime }}
|
||||
</text>
|
||||
<view @click.stop="clearTime">
|
||||
<up-icon name="close" size="14"></up-icon>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<text class="color-999">请选择日期</text>
|
||||
<up-icon name="arrow-right" size="12"></up-icon>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="active == 2" class="u-flex u-p-l-32 u-p-r-32 u-m-t-32">
|
||||
<view class="u-flex-1 u-text-center">
|
||||
<view class="u-font-32 color-main font-bold">{{
|
||||
</view> -->
|
||||
<view class="u-flex-1 u-font-28 filter-box u-flex u-row-between" @click="showTimeArea = true">
|
||||
<template v-if="userComponentQuery.startTime && userComponentQuery.endTime">
|
||||
<text class="u-font-20">
|
||||
{{ userComponentQuery.startTime }} -
|
||||
{{ userComponentQuery.endTime }}
|
||||
</text>
|
||||
<view @click.stop="clearTime">
|
||||
<up-icon name="close" size="14"></up-icon>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<text class="color-999">请选择日期范围</text>
|
||||
<up-icon name="arrow-right" size="12"></up-icon>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="active == 3" class="u-flex u-row-between u-m-t-32" style="gap: 30rpx">
|
||||
<view class="u-font-28 filter-box u-flex u-row-between" @click="showActions = true">
|
||||
<template v-if="selActions && selActions.value">
|
||||
<text class="u-font-28 u-m-r-10">{{ selActions.name }} </text>
|
||||
</template>
|
||||
<template v-else>
|
||||
<text class="color-999 u-m-r-10">全部</text>
|
||||
</template>
|
||||
<up-icon name="arrow-down" size="12"></up-icon>
|
||||
</view>
|
||||
<view class="u-flex-1">
|
||||
<fenXiaoUserSelect v-model="userId" :maxWidth="200" @change="getList()" />
|
||||
</view>
|
||||
<!-- <view class="u-flex-1 filter-box" style="border-radius: 100rpx">
|
||||
<up-icon name="search" size="18"></up-icon>
|
||||
<input class="u-m-l-10 u-font-28" type="text" placeholder-class="color-999 u-font-28"
|
||||
placeholder="分销员昵称/手机号" v-model="keyWord" @blur="keyWordBlur" />
|
||||
</view> -->
|
||||
<view class="u-flex-1 u-font-28 filter-box u-flex u-row-between" @click="showTimeArea = true">
|
||||
<template v-if="userComponentQuery.startTime && userComponentQuery.endTime">
|
||||
<text class="u-font-20">
|
||||
{{ userComponentQuery.startTime }} -
|
||||
{{ userComponentQuery.endTime }}
|
||||
</text>
|
||||
<view @click.stop="clearTime">
|
||||
<up-icon name="close" size="14"></up-icon>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<text class="color-999">请选择日期</text>
|
||||
<up-icon name="arrow-right" size="12"></up-icon>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="active == 2" class="u-flex u-p-l-32 u-p-r-32 u-m-t-32">
|
||||
<view class="u-flex-1 u-text-center">
|
||||
<view class="u-font-32 color-main font-bold">{{
|
||||
listRes.totalCount
|
||||
}}</view>
|
||||
<view class="u-font-24 color-666 u-m-t-16">支付开通人数</view>
|
||||
</view>
|
||||
<view class="u-flex-1 u-text-center">
|
||||
<view class="u-font-32 color-main font-bold">{{
|
||||
<view class="u-font-24 color-666 u-m-t-16">支付开通人数</view>
|
||||
</view>
|
||||
<view class="u-flex-1 u-text-center">
|
||||
<view class="u-font-32 color-main font-bold">{{
|
||||
listRes.totalAmount
|
||||
}}</view>
|
||||
<view class="u-font-24 color-666 u-m-t-16">已支付金额(元)</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="active == 3" class="u-flex u-m-t-32">
|
||||
<view class="u-flex-1 u-text-center">
|
||||
<view class="u-font-32 color-main font-bold">{{
|
||||
<view class="u-font-24 color-666 u-m-t-16">已支付金额(元)</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="active == 3" class="u-flex u-m-t-32">
|
||||
<view class="u-flex-1 u-text-center">
|
||||
<view class="u-font-32 color-main font-bold">{{
|
||||
listRes.successAmount
|
||||
}}</view>
|
||||
<view class="u-font-24 color-666 u-m-t-16">已入账金额(元)</view>
|
||||
</view>
|
||||
<view class="u-flex-1 u-text-center">
|
||||
<view class="u-font-32 color-main font-bold">{{
|
||||
<view class="u-font-24 color-666 u-m-t-16">已入账金额(元)</view>
|
||||
</view>
|
||||
<view class="u-flex-1 u-text-center">
|
||||
<view class="u-font-32 color-main font-bold">{{
|
||||
listRes.pendingAmount || 0
|
||||
}}</view>
|
||||
<view class="u-font-24 color-666 u-m-t-16">待入账金额(元)</view>
|
||||
</view>
|
||||
<view class="u-flex-1 u-text-center">
|
||||
<view class="u-font-32 color-main font-bold">{{
|
||||
<view class="u-font-24 color-666 u-m-t-16">待入账金额(元)</view>
|
||||
</view>
|
||||
<view class="u-flex-1 u-text-center">
|
||||
<view class="u-font-32 color-main font-bold">{{
|
||||
listRes.balanceAmount
|
||||
}}</view>
|
||||
<view class="u-font-24 color-666 u-m-t-16">
|
||||
<text>运营余额(元)</text>
|
||||
<text class="color-main" @click="go.to('PAGES_PAY')"
|
||||
>充值{{ ">" }}</text
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-sticky>
|
||||
<configVue v-if="active == 0"></configVue>
|
||||
<fenxiaoUserListVue
|
||||
v-if="active == 1"
|
||||
:list="list"
|
||||
:isEnd="isEnd"
|
||||
@refresh="refresh"
|
||||
></fenxiaoUserListVue>
|
||||
<view class="u-font-24 color-666 u-m-t-16">
|
||||
<text>运营余额(元)</text>
|
||||
<text class="color-main" @click="go.to('PAGES_PAY')">充值{{ ">" }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-sticky>
|
||||
<configVue v-if="active == 0"></configVue>
|
||||
<fenxiaoUserListVue v-if="active == 1" :list="list" :isEnd="isEnd" @refresh="refresh"></fenxiaoUserListVue>
|
||||
|
||||
<openListVue
|
||||
v-if="active == 2"
|
||||
:list="list"
|
||||
:isEnd="isEnd"
|
||||
@refresh="refresh"
|
||||
></openListVue>
|
||||
<fenxiaoMingxiVue
|
||||
v-if="active == 3"
|
||||
:list="list"
|
||||
:isEnd="isEnd"
|
||||
@refresh="refresh"
|
||||
></fenxiaoMingxiVue>
|
||||
<!-- 选择门店 -->
|
||||
<shopSelActionSheetVue
|
||||
@choose="chooseShop"
|
||||
v-model="showShopSelActionSheet"
|
||||
title="选择门店"
|
||||
>
|
||||
</shopSelActionSheetVue>
|
||||
<openListVue v-if="active == 2" :list="list" :isEnd="isEnd" @refresh="refresh"></openListVue>
|
||||
<fenxiaoMingxiVue v-if="active == 3" :list="list" :isEnd="isEnd" @refresh="refresh"></fenxiaoMingxiVue>
|
||||
<!-- 选择门店 -->
|
||||
<shopSelActionSheetVue @choose="chooseShop" v-model="showShopSelActionSheet" title="选择门店">
|
||||
</shopSelActionSheetVue>
|
||||
|
||||
<dateAreaSel
|
||||
:show="showTimeArea"
|
||||
:minYear="2022"
|
||||
@close="showTimeArea = false"
|
||||
@confirm="confirmTimeArea"
|
||||
></dateAreaSel>
|
||||
<dateAreaSel :show="showTimeArea" :minYear="2022" @close="showTimeArea = false" @confirm="confirmTimeArea">
|
||||
</dateAreaSel>
|
||||
|
||||
<!-- 分销明细状态 -->
|
||||
<up-action-sheet
|
||||
:show="showActions"
|
||||
:actions="actions"
|
||||
@select="handleSelect"
|
||||
@close="showActions = false"
|
||||
cancel-text="取消"
|
||||
></up-action-sheet>
|
||||
</view>
|
||||
<!-- 分销明细状态 -->
|
||||
<up-action-sheet :show="showActions" :actions="actions" @select="handleSelect" @close="showActions = false"
|
||||
cancel-text="取消"></up-action-sheet>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import {
|
||||
onLoad,
|
||||
onReady,
|
||||
onShow,
|
||||
onPageScroll,
|
||||
onReachBottom,
|
||||
onBackPress,
|
||||
} from "@dcloudio/uni-app";
|
||||
import go from "@/commons/utils/go.js";
|
||||
import { ref, onMounted, watch, provide } from "vue";
|
||||
import * as consumeCashbackApi from "@/http/api/market/consumeCashback.js";
|
||||
import * as distributionApi from "@/http/api/market/distribution.js";
|
||||
import configVue from "./components/config.vue";
|
||||
import shopSelActionSheetVue from "@/pageMarket/components/shop-sel-action-sheet.vue";
|
||||
import dateAreaSel from "@/components/date-range-picker/date-range-picker.vue";
|
||||
import fenxiaoUserListVue from "./components/fenxiao-user-list.vue";
|
||||
import openListVue from "./components/open-list.vue";
|
||||
import fenxiaoMingxiVue from "./components/fenxiao-mingxi.vue";
|
||||
import {
|
||||
onLoad,
|
||||
onReady,
|
||||
onShow,
|
||||
onPageScroll,
|
||||
onReachBottom,
|
||||
onBackPress,
|
||||
} from "@dcloudio/uni-app";
|
||||
import go from "@/commons/utils/go.js";
|
||||
import {
|
||||
ref,
|
||||
onMounted,
|
||||
watch,
|
||||
provide
|
||||
} from "vue";
|
||||
import * as consumeCashbackApi from "@/http/api/market/consumeCashback.js";
|
||||
import * as distributionApi from "@/http/api/market/distribution.js";
|
||||
import fenXiaoUserSelect from './components/fenxiao-user-select.vue'
|
||||
import configVue from "./components/config.vue";
|
||||
import shopSelActionSheetVue from "@/pageMarket/components/shop-sel-action-sheet.vue";
|
||||
import dateAreaSel from "@/components/date-range-picker/date-range-picker.vue";
|
||||
import fenxiaoUserListVue from "./components/fenxiao-user-list.vue";
|
||||
import openListVue from "./components/open-list.vue";
|
||||
import fenxiaoMingxiVue from "./components/fenxiao-mingxi.vue";
|
||||
|
||||
import { useDistributionStore } from "@/store/market.js";
|
||||
import { reactive } from "vue";
|
||||
import {
|
||||
useDistributionStore
|
||||
} from "@/store/market.js";
|
||||
import {
|
||||
reactive
|
||||
} from "vue";
|
||||
|
||||
const actions = [
|
||||
{
|
||||
name: "全部",
|
||||
value: "",
|
||||
},
|
||||
{
|
||||
name: "已入账",
|
||||
value: "success",
|
||||
},
|
||||
{
|
||||
name: "待入账",
|
||||
value: "pending",
|
||||
},
|
||||
{
|
||||
name: "已退款",
|
||||
value: "refund",
|
||||
},
|
||||
];
|
||||
function clearKeyWord() {
|
||||
keyWord.value = "";
|
||||
userComponentQuery.user = "";
|
||||
}
|
||||
function clearTime() {
|
||||
userComponentQuery.startTime = "";
|
||||
userComponentQuery.endTime = "";
|
||||
}
|
||||
const selActions = ref("");
|
||||
const showActions = ref(false);
|
||||
function handleSelect(e) {
|
||||
selActions.value = e;
|
||||
}
|
||||
const actions = [{
|
||||
name: "全部",
|
||||
value: "",
|
||||
},
|
||||
{
|
||||
name: "已入账",
|
||||
value: "success",
|
||||
},
|
||||
{
|
||||
name: "待入账",
|
||||
value: "pending",
|
||||
},
|
||||
{
|
||||
name: "已退款",
|
||||
value: "refund",
|
||||
},
|
||||
];
|
||||
|
||||
const distributionStore = useDistributionStore();
|
||||
distributionStore.getConfig();
|
||||
provide("distributionStore", distributionStore);
|
||||
provide("distributionApi", distributionApi);
|
||||
const showTimeArea = ref(false);
|
||||
function confirmTimeArea(e) {
|
||||
console.log(e);
|
||||
userComponentQuery.startTime = e[0];
|
||||
userComponentQuery.endTime = e[1];
|
||||
}
|
||||
const tabs = [
|
||||
{
|
||||
label: "基础设置",
|
||||
value: "basic",
|
||||
},
|
||||
{
|
||||
label: "分销员",
|
||||
value: "user",
|
||||
},
|
||||
{
|
||||
label: "开通记录",
|
||||
value: "recoders",
|
||||
},
|
||||
{
|
||||
label: "分销明细",
|
||||
value: "details",
|
||||
},
|
||||
];
|
||||
|
||||
const keyWord = ref("");
|
||||
function keyWordBlur() {
|
||||
userComponentQuery.user = keyWord.value;
|
||||
}
|
||||
const userComponentQuery = reactive({
|
||||
user: "",
|
||||
startTime: "",
|
||||
endTime: "",
|
||||
});
|
||||
const userId = ref('')
|
||||
|
||||
const form = ref({
|
||||
isEnable: 0,
|
||||
});
|
||||
function clearKeyWord() {
|
||||
keyWord.value = "";
|
||||
userComponentQuery.user = "";
|
||||
}
|
||||
|
||||
const list = ref([]);
|
||||
const pageNum = ref(1);
|
||||
const isEnd = ref(false);
|
||||
const selShop = ref({
|
||||
shopId: "",
|
||||
shopName: "",
|
||||
});
|
||||
const searchText = ref("");
|
||||
function clearTime() {
|
||||
userComponentQuery.startTime = "";
|
||||
userComponentQuery.endTime = "";
|
||||
}
|
||||
const selActions = ref("");
|
||||
const showActions = ref(false);
|
||||
|
||||
function search() {
|
||||
pageNum.value = 1;
|
||||
getList();
|
||||
}
|
||||
function handleSelect(e) {
|
||||
selActions.value = e;
|
||||
}
|
||||
|
||||
function chooseShop(e) {
|
||||
selShop.value = e;
|
||||
}
|
||||
const distributionStore = useDistributionStore();
|
||||
distributionStore.getConfig();
|
||||
provide("distributionStore", distributionStore);
|
||||
provide("distributionApi", distributionApi);
|
||||
const showTimeArea = ref(false);
|
||||
|
||||
watch(
|
||||
() => selShop.value.shopId,
|
||||
(newval) => {
|
||||
pageNum.value = 1;
|
||||
getList();
|
||||
}
|
||||
);
|
||||
function confirmTimeArea(e) {
|
||||
console.log(e);
|
||||
userComponentQuery.startTime = e[0];
|
||||
userComponentQuery.endTime = e[1];
|
||||
}
|
||||
const tabs = [{
|
||||
label: "基础设置",
|
||||
value: "basic",
|
||||
},
|
||||
{
|
||||
label: "分销员",
|
||||
value: "user",
|
||||
},
|
||||
{
|
||||
label: "开通记录",
|
||||
value: "recoders",
|
||||
},
|
||||
{
|
||||
label: "分销明细",
|
||||
value: "details",
|
||||
},
|
||||
];
|
||||
|
||||
watch(
|
||||
() => userComponentQuery,
|
||||
(newval) => {
|
||||
isEnd.value = false;
|
||||
pageNum.value = 1;
|
||||
const keyWord = ref("");
|
||||
|
||||
getList();
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
}
|
||||
);
|
||||
function keyWordBlur() {
|
||||
userComponentQuery.user = keyWord.value;
|
||||
}
|
||||
const userComponentQuery = reactive({
|
||||
user: "",
|
||||
startTime: "",
|
||||
endTime: "",
|
||||
});
|
||||
|
||||
function refresh() {
|
||||
isEnd.value = false;
|
||||
pageNum.value = 1;
|
||||
getList();
|
||||
}
|
||||
const form = ref({
|
||||
isEnable: 0,
|
||||
});
|
||||
|
||||
const listRes = ref({});
|
||||
async function getList() {
|
||||
let res = null;
|
||||
if (active.value == 1) {
|
||||
//分销员列表
|
||||
res = await distributionApi.distributionUser({
|
||||
page: pageNum.value,
|
||||
size: 10,
|
||||
user: userComponentQuery.user,
|
||||
startTime: userComponentQuery.startTime
|
||||
? userComponentQuery.startTime + " 00:00:00"
|
||||
: "",
|
||||
endTime: userComponentQuery.endTime
|
||||
? userComponentQuery.endTime + " 23:59:59"
|
||||
: "",
|
||||
});
|
||||
}
|
||||
if (active.value == 2) {
|
||||
//开通记录
|
||||
res = await distributionApi.openFlow({
|
||||
page: pageNum.value,
|
||||
size: 10,
|
||||
key: userComponentQuery.user,
|
||||
startTime: userComponentQuery.startTime
|
||||
? userComponentQuery.startTime + " 00:00:00"
|
||||
: "",
|
||||
endTime: userComponentQuery.endTime
|
||||
? userComponentQuery.endTime + " 23:59:59"
|
||||
: "",
|
||||
});
|
||||
}
|
||||
if (active.value == 3) {
|
||||
//分销明细
|
||||
res = await distributionApi.distributionFlow({
|
||||
page: pageNum.value,
|
||||
size: 10,
|
||||
key: userComponentQuery.user,
|
||||
status: selActions.value?.value || "",
|
||||
startTime: userComponentQuery.startTime
|
||||
? userComponentQuery.startTime + " 00:00:00"
|
||||
: "",
|
||||
endTime: userComponentQuery.endTime
|
||||
? userComponentQuery.endTime + " 23:59:59"
|
||||
: "",
|
||||
});
|
||||
}
|
||||
if (res) {
|
||||
listRes.value = res;
|
||||
if (pageNum.value == 1) {
|
||||
list.value = res.records || [];
|
||||
} else {
|
||||
list.value = [...list.value, ...(res.records || [])];
|
||||
}
|
||||
isEnd.value = pageNum.value >= res.totalPage * 1 ? true : false;
|
||||
console.log(isEnd.value);
|
||||
}
|
||||
}
|
||||
const list = ref([]);
|
||||
const pageNum = ref(1);
|
||||
const isEnd = ref(false);
|
||||
const selShop = ref({
|
||||
shopId: "",
|
||||
shopName: "",
|
||||
});
|
||||
const searchText = ref("");
|
||||
|
||||
// 显示选择门店弹窗
|
||||
const showShopSelActionSheet = ref(false);
|
||||
function search() {
|
||||
pageNum.value = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
function showShopSelActionSheetFun() {
|
||||
showShopSelActionSheet.value = true;
|
||||
}
|
||||
const active = ref(0);
|
||||
watch(
|
||||
() => active.value,
|
||||
(newval) => {
|
||||
userComponentQuery.startTime = "";
|
||||
userComponentQuery.endTime = "";
|
||||
keyWord.value = "";
|
||||
console.log(newval);
|
||||
pageNum.value = 1;
|
||||
getList();
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => active.value,
|
||||
(newval) => {
|
||||
function chooseShop(e) {
|
||||
selShop.value = e;
|
||||
}
|
||||
|
||||
refresh();
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => selActions.value,
|
||||
() => {
|
||||
refresh();
|
||||
}
|
||||
);
|
||||
onReachBottom(() => {
|
||||
if (!isEnd.value) {
|
||||
pageNum.value++;
|
||||
getList();
|
||||
}
|
||||
});
|
||||
watch(
|
||||
() => distributionStore.config.isEnable,
|
||||
() => {
|
||||
distributionStore.editConfig();
|
||||
}
|
||||
);
|
||||
onShow(() => {
|
||||
pageNum.value = 1;
|
||||
getList();
|
||||
});
|
||||
watch(
|
||||
() => selShop.value.shopId,
|
||||
(newval) => {
|
||||
pageNum.value = 1;
|
||||
getList();
|
||||
}
|
||||
);
|
||||
|
||||
watch(
|
||||
() => userComponentQuery,
|
||||
(newval) => {
|
||||
isEnd.value = false;
|
||||
pageNum.value = 1;
|
||||
|
||||
getList();
|
||||
}, {
|
||||
deep: true,
|
||||
}
|
||||
);
|
||||
|
||||
function refresh() {
|
||||
isEnd.value = false;
|
||||
pageNum.value = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
const listRes = ref({});
|
||||
async function getList() {
|
||||
let res = null;
|
||||
if (active.value == 1) {
|
||||
//分销员列表
|
||||
res = await distributionApi.distributionUser({
|
||||
page: pageNum.value,
|
||||
size: 10,
|
||||
user: userComponentQuery.user,
|
||||
id:userId.value,
|
||||
startTime: userComponentQuery.startTime ?
|
||||
userComponentQuery.startTime + " 00:00:00" : "",
|
||||
endTime: userComponentQuery.endTime ?
|
||||
userComponentQuery.endTime + " 23:59:59" : "",
|
||||
});
|
||||
}
|
||||
if (active.value == 2) {
|
||||
//开通记录
|
||||
res = await distributionApi.openFlow({
|
||||
page: pageNum.value,
|
||||
size: 10,
|
||||
id:userId.value,
|
||||
key: userComponentQuery.user,
|
||||
startTime: userComponentQuery.startTime ?
|
||||
userComponentQuery.startTime + " 00:00:00" : "",
|
||||
endTime: userComponentQuery.endTime ?
|
||||
userComponentQuery.endTime + " 23:59:59" : "",
|
||||
});
|
||||
}
|
||||
if (active.value == 3) {
|
||||
//分销明细
|
||||
res = await distributionApi.distributionFlow({
|
||||
page: pageNum.value,
|
||||
size: 10,
|
||||
id:userId.value,
|
||||
key: userComponentQuery.user,
|
||||
status: selActions.value?.value || "",
|
||||
startTime: userComponentQuery.startTime ?
|
||||
userComponentQuery.startTime + " 00:00:00" : "",
|
||||
endTime: userComponentQuery.endTime ?
|
||||
userComponentQuery.endTime + " 23:59:59" : "",
|
||||
});
|
||||
}
|
||||
if (res) {
|
||||
listRes.value = res;
|
||||
if (pageNum.value == 1) {
|
||||
list.value = res.records || [];
|
||||
} else {
|
||||
list.value = [...list.value, ...(res.records || [])];
|
||||
}
|
||||
isEnd.value = pageNum.value >= res.totalPage * 1 ? true : false;
|
||||
console.log(isEnd.value);
|
||||
}
|
||||
}
|
||||
|
||||
// 显示选择门店弹窗
|
||||
const showShopSelActionSheet = ref(false);
|
||||
|
||||
function showShopSelActionSheetFun() {
|
||||
showShopSelActionSheet.value = true;
|
||||
}
|
||||
const active = ref(0);
|
||||
watch(
|
||||
() => active.value,
|
||||
(newval) => {
|
||||
userComponentQuery.startTime = "";
|
||||
userComponentQuery.endTime = "";
|
||||
keyWord.value = "";
|
||||
userId.value="";
|
||||
console.log(newval);
|
||||
pageNum.value = 1;
|
||||
getList();
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => active.value,
|
||||
(newval) => {
|
||||
|
||||
refresh();
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => selActions.value,
|
||||
() => {
|
||||
refresh();
|
||||
}
|
||||
);
|
||||
onReachBottom(() => {
|
||||
if (!isEnd.value) {
|
||||
pageNum.value++;
|
||||
getList();
|
||||
}
|
||||
});
|
||||
watch(
|
||||
() => distributionStore.config.isEnable,
|
||||
() => {
|
||||
distributionStore.editConfig();
|
||||
}
|
||||
);
|
||||
onShow(() => {
|
||||
pageNum.value = 1;
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.min-page {
|
||||
background: #f7f7f7;
|
||||
}
|
||||
.min-page {
|
||||
background: #f7f7f7;
|
||||
}
|
||||
|
||||
.box {
|
||||
}
|
||||
.box {}
|
||||
|
||||
.top {
|
||||
padding: 32rpx 24rpx;
|
||||
}
|
||||
.top {
|
||||
padding: 32rpx 24rpx;
|
||||
}
|
||||
|
||||
.list {
|
||||
padding: 0 30rpx;
|
||||
.list {
|
||||
padding: 0 30rpx;
|
||||
|
||||
.item {
|
||||
padding: 32rpx 24rpx;
|
||||
border-radius: 14rpx;
|
||||
background-color: #fff;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
.item {
|
||||
padding: 32rpx 24rpx;
|
||||
border-radius: 14rpx;
|
||||
background-color: #fff;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.tag {
|
||||
border-radius: 12rpx;
|
||||
padding: 8rpx 22rpx;
|
||||
font-size: 28rpx;
|
||||
.tag {
|
||||
border-radius: 12rpx;
|
||||
padding: 8rpx 22rpx;
|
||||
font-size: 28rpx;
|
||||
|
||||
&.success {
|
||||
background-color: #edfff0;
|
||||
color: #5bbc6d;
|
||||
}
|
||||
&.success {
|
||||
background-color: #edfff0;
|
||||
color: #5bbc6d;
|
||||
}
|
||||
|
||||
&.end {
|
||||
background-color: #f7f7f7;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
&.end {
|
||||
background-color: #f7f7f7;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.my-btn {
|
||||
font-size: 28rpx;
|
||||
line-height: 36rpx;
|
||||
padding: 8rpx 32rpx;
|
||||
border-radius: 12rpx;
|
||||
margin: 0;
|
||||
}
|
||||
.my-btn {
|
||||
font-size: 28rpx;
|
||||
line-height: 36rpx;
|
||||
padding: 8rpx 32rpx;
|
||||
border-radius: 12rpx;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.edit-btn {
|
||||
background: #e6f0ff;
|
||||
color: $my-main-color;
|
||||
}
|
||||
.edit-btn {
|
||||
background: #e6f0ff;
|
||||
color: $my-main-color;
|
||||
}
|
||||
|
||||
.delete-btn {
|
||||
background: #ffe7e6;
|
||||
color: #ff1c1c;
|
||||
}
|
||||
.filter-box {
|
||||
display: flex;
|
||||
padding: 8rpx 24rpx;
|
||||
align-items: center;
|
||||
border-radius: 8rpx;
|
||||
border: 2rpx solid #d9d9d9;
|
||||
background: #f7f7f7;
|
||||
min-height: 62rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
.delete-btn {
|
||||
background: #ffe7e6;
|
||||
color: #ff1c1c;
|
||||
}
|
||||
|
||||
.filter-box {
|
||||
display: flex;
|
||||
padding: 8rpx 24rpx;
|
||||
align-items: center;
|
||||
border-radius: 8rpx;
|
||||
border: 2rpx solid #d9d9d9;
|
||||
background: #f7f7f7;
|
||||
min-height: 62rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
@@ -1,366 +1,432 @@
|
||||
<template>
|
||||
<view class="boxconstant min-page">
|
||||
<view class="bg-fff u-flex u-m-b-32 top">
|
||||
<image
|
||||
style="width: 60rpx; height: 60rpx"
|
||||
src="/pageMarket/static/images/cost.png"
|
||||
></image>
|
||||
<view class="u-flex-1 u-flex u-p-l-24">
|
||||
<view class="u-font-28 u-flex-1 u-p-r-4">
|
||||
<view class="color-333 font-bold">私域引流</view>
|
||||
<view class="color-666 u-m-t-4 u-font-24"
|
||||
>可设置用户下单后展示的群二维码</view
|
||||
>
|
||||
</view>
|
||||
<up-switch
|
||||
v-model="form.isEnable"
|
||||
size="18"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
></up-switch>
|
||||
</view>
|
||||
</view>
|
||||
<view class="boxconstantbox">
|
||||
<view class="boxconstantbox_one"> 可使用类型 </view>
|
||||
<view class="u-m-t-16">
|
||||
<my-dine-types v-model="form.useType"></my-dine-types>
|
||||
</view>
|
||||
</view>
|
||||
<view class="boxconstant min-page">
|
||||
<view class="bg-fff u-flex u-m-b-32 top">
|
||||
<image style="width: 60rpx; height: 60rpx" src="/pageMarket/static/images/cost.png"></image>
|
||||
<view class="u-flex-1 u-flex u-p-l-24">
|
||||
<view class="u-font-28 u-flex-1 u-p-r-4">
|
||||
<view class="color-333 font-bold">私域引流</view>
|
||||
<view class="color-666 u-m-t-4 u-font-24">可设置用户下单后展示的群二维码</view>
|
||||
</view>
|
||||
<!-- <up-switch v-model="form.isEnable" size="18" :active-value="1" :inactive-value="0"></up-switch> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="boxconstantbox" style="padding: 32rpx 0">
|
||||
<view class="u-flex u-row-between x-padding">
|
||||
<view class="boxconstantbox_one">群二维码</view>
|
||||
<button class="upload" @click="uploadImage">上传</button>
|
||||
</view>
|
||||
<view class="u-m-t-24 u-flex u-row-center">
|
||||
<view class="code" @click="uploadImage">
|
||||
<up-icon name="plus" v-if="!form.qrCode" size="20" color="#999"></up-icon>
|
||||
<image v-else style="width: 260rpx; height: 260rpx" :src="form.qrCode" mode="scaleToFill" />
|
||||
</view>
|
||||
</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.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="u-flex u-row-between x-padding">
|
||||
<view class="boxconstantbox_one"> 群二维码</view>
|
||||
<button class="upload" @click="uploadImage">上传</button>
|
||||
</view>
|
||||
<view class="u-m-t-24 u-flex u-row-center">
|
||||
<view class="code" @click="uploadImage">
|
||||
<up-icon
|
||||
name="plus"
|
||||
v-if="!form.qrCode"
|
||||
size="20"
|
||||
color="#999"
|
||||
></up-icon>
|
||||
<image
|
||||
v-else
|
||||
style="width: 260rpx; height: 260rpx"
|
||||
:src="form.qrCode"
|
||||
mode="scaleToFill"
|
||||
/>
|
||||
</view>
|
||||
</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.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>
|
||||
<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> -->
|
||||
<view class="new_preview">
|
||||
<view class="header">{{ shopInfo.shopName }}</view>
|
||||
<view class="content">
|
||||
<view class="title">{{ form.title }}</view>
|
||||
<view class="img_wrap">
|
||||
<image class="img" :src="form.qrCode"></image>
|
||||
</view>
|
||||
<view class="intro">
|
||||
{{ form.content }}
|
||||
</view>
|
||||
<view class="foot">
|
||||
{{ form.note }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="close" @click="showPreview = false">
|
||||
<u-icon name="close" color="#fff" size="14"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
<my-bottom-btn-group @cancel="cancel" @save="editFreeDing"></my-bottom-btn-group>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onShow, onLoad } from "@dcloudio/uni-app";
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { uploadFile } from "@/http/api/index.js";
|
||||
import { onShow, onLoad } from '@dcloudio/uni-app';
|
||||
import { reactive, ref, watch } from 'vue';
|
||||
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 defaultNote = ref('如果长按不能识别,可截图或保存二维码图片至相册,通过微信扫码入群');
|
||||
const form = reactive({
|
||||
content: "",
|
||||
isEnable: 0,
|
||||
note: "长按识别,微信内扫一扫加好友",
|
||||
qrCode: "",
|
||||
title: "扫码进取,优惠多多",
|
||||
useType: [],
|
||||
});
|
||||
onLoad(() => {
|
||||
// uni.$utils.inputReg.bind()()
|
||||
});
|
||||
onShow(() => {
|
||||
getlist();
|
||||
id: '',
|
||||
orderType: [], // 订单页显示类型: 堂食 dine-in 外带 take-out 外卖 take-away
|
||||
homeType: '', // 首页显示类型:only 仅显示 1 次,day 每天显示一次,every 每次进入小程序
|
||||
qrCode: '',
|
||||
title: '',
|
||||
content: '', //
|
||||
note: defaultNote.value,
|
||||
orderEnable: 1, // 订单页是否开启
|
||||
homeEnable: 1 // 首页是否开启
|
||||
});
|
||||
|
||||
/**
|
||||
* 获取配置信息
|
||||
*/
|
||||
const getlist = async () => {
|
||||
let res = await getConfig();
|
||||
res.useType = res.useType || [];
|
||||
res.note=res.note||"长按识别,微信内扫一扫加好友"
|
||||
res.title=res.title||"扫码进取,优惠多多"
|
||||
Object.assign(form, res);
|
||||
const getConfigAjax = async () => {
|
||||
let res = await getConfig();
|
||||
res.useType = res.useType || [];
|
||||
res.note = res.note || '长按识别,微信内扫一扫加好友';
|
||||
res.title = res.title || '扫码进取,优惠多多';
|
||||
Object.assign(form, res);
|
||||
};
|
||||
|
||||
/**
|
||||
* 修改配置信息
|
||||
*/
|
||||
const editFreeDing = async () => {
|
||||
if(form.useType.length == 0){
|
||||
return uni.showToast({
|
||||
icon: "none",
|
||||
title: "请选择可使用类型",
|
||||
});
|
||||
}
|
||||
if (!form.qrCode) {
|
||||
return uni.showToast({
|
||||
icon: "none",
|
||||
title: "请上传群二维码",
|
||||
});
|
||||
}
|
||||
if (!form.title) {
|
||||
return uni.showToast({
|
||||
icon: "none",
|
||||
title: "请输入模块标题",
|
||||
});
|
||||
}
|
||||
|
||||
let res = await update(form);
|
||||
uni.showToast({
|
||||
title: "保存成功",
|
||||
});
|
||||
Object.assign(form, res);
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 1500);
|
||||
if (form.orderEnable == 1 && form.orderType.length == 0) {
|
||||
return uni.showToast({
|
||||
icon: 'none',
|
||||
title: '请选择可使用类型'
|
||||
});
|
||||
}
|
||||
if (!form.qrCode) {
|
||||
return uni.showToast({
|
||||
icon: 'none',
|
||||
title: '请上传群二维码'
|
||||
});
|
||||
}
|
||||
if (!form.title) {
|
||||
return uni.showToast({
|
||||
icon: 'none',
|
||||
title: '请输入模块标题'
|
||||
});
|
||||
}
|
||||
if (form.homeEnable == 1 && form.homeType.length == 0) {
|
||||
return uni.showToast({
|
||||
icon: 'none',
|
||||
title: '请选择首页显示类型'
|
||||
});
|
||||
}
|
||||
form.note = defaultNote.value;
|
||||
let res = await update(form);
|
||||
uni.showToast({
|
||||
title: '保存成功'
|
||||
});
|
||||
Object.assign(form, res);
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 1500);
|
||||
};
|
||||
|
||||
function uploadImage() {
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
success: (res) => {
|
||||
console.log(res);
|
||||
uploadFile(res.tempFiles[0]).then((res) => {
|
||||
if (res) {
|
||||
form.qrCode = res;
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "上传失败",
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
success: (res) => {
|
||||
console.log(res);
|
||||
uploadFile(res.tempFiles[0]).then((res) => {
|
||||
if (res) {
|
||||
form.qrCode = res;
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '上传失败'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
uni.navigateBack();
|
||||
uni.navigateBack();
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
shopInfo.value = uni.getStorageSync('shopInfo');
|
||||
// uni.$utils.inputReg.bind()()
|
||||
});
|
||||
|
||||
onShow(() => {
|
||||
getConfigAjax();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.x-padding {
|
||||
padding-left: 28rpx;
|
||||
padding-right: 28rpx;
|
||||
padding-left: 28rpx;
|
||||
padding-right: 28rpx;
|
||||
}
|
||||
.boxconstant {
|
||||
padding: 32rpx 28rpx;
|
||||
padding: 32rpx 28rpx;
|
||||
background: #f7f7f7;
|
||||
.boxconstantbox {
|
||||
padding: 32rpx 24rpx;
|
||||
border-radius: 16rpx;
|
||||
margin-top: 32rpx;
|
||||
width: 100%;
|
||||
background: #ffffff;
|
||||
.boxconstantbox {
|
||||
padding: 32rpx 24rpx;
|
||||
border-radius: 16rpx;
|
||||
margin-top: 32rpx;
|
||||
width: 100%;
|
||||
background: #ffffff;
|
||||
|
||||
.boxconstantbox_one {
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
.boxconstantbox_one {
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.boxconstantbox_tow {
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
// display: flex;
|
||||
// justify-content: flex-start;
|
||||
// align-items: center;
|
||||
// flex-wrap: wrap;
|
||||
// align-content: flex-start;
|
||||
.text {
|
||||
display: inline-flex;
|
||||
text-align: center;
|
||||
margin: 0 12rpx;
|
||||
width: 118rpx;
|
||||
height: 48rpx;
|
||||
line-height: 48rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||
border: 2rpx solid #e5e5e5;
|
||||
}
|
||||
}
|
||||
}
|
||||
.boxconstantbox_tow {
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
// display: flex;
|
||||
// justify-content: flex-start;
|
||||
// align-items: center;
|
||||
// flex-wrap: wrap;
|
||||
// align-content: flex-start;
|
||||
.text {
|
||||
display: inline-flex;
|
||||
text-align: center;
|
||||
margin: 0 12rpx;
|
||||
width: 118rpx;
|
||||
height: 48rpx;
|
||||
line-height: 48rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||
border: 2rpx solid #e5e5e5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.oneboxconstant {
|
||||
margin-top: 32rpx;
|
||||
width: 100%;
|
||||
background: #ffffff;
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
padding: 32rpx 24rpx;
|
||||
.oneboxconstant {
|
||||
margin-top: 32rpx;
|
||||
width: 100%;
|
||||
background: #ffffff;
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
padding: 32rpx 24rpx;
|
||||
|
||||
.oneboxconstant_one {
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
.oneboxconstant_one {
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
|
||||
.save {
|
||||
margin: 100rpx auto 50rpx auto;
|
||||
width: 530rpx;
|
||||
height: 80rpx;
|
||||
background: #318afe;
|
||||
border-radius: 56rpx 56rpx 56rpx 56rpx;
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: 500;
|
||||
font-size: 32rpx;
|
||||
color: #ffffff;
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
}
|
||||
.save {
|
||||
margin: 100rpx auto 50rpx auto;
|
||||
width: 530rpx;
|
||||
height: 80rpx;
|
||||
background: #318afe;
|
||||
border-radius: 56rpx 56rpx 56rpx 56rpx;
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: 500;
|
||||
font-size: 32rpx;
|
||||
color: #ffffff;
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
.top {
|
||||
padding: 24rpx 20rpx 28rpx 28rpx;
|
||||
padding: 24rpx 20rpx 28rpx 28rpx;
|
||||
}
|
||||
.number-box {
|
||||
width: 260rpx;
|
||||
font-size: 28rpx;
|
||||
padding: 10rpx 26rpx;
|
||||
border-radius: 6rpx 0 0 6rpx;
|
||||
border-top: 2rpx solid #d9d9d9;
|
||||
border-bottom: 2rpx solid #d9d9d9;
|
||||
border-left: 2rpx solid #d9d9d9;
|
||||
background: #fff;
|
||||
width: 260rpx;
|
||||
font-size: 28rpx;
|
||||
padding: 10rpx 26rpx;
|
||||
border-radius: 6rpx 0 0 6rpx;
|
||||
border-top: 2rpx solid #d9d9d9;
|
||||
border-bottom: 2rpx solid #d9d9d9;
|
||||
border-left: 2rpx solid #d9d9d9;
|
||||
background: #fff;
|
||||
}
|
||||
.bei {
|
||||
display: flex;
|
||||
padding: 10rpx 38rpx;
|
||||
align-items: center;
|
||||
border-radius: 0 6rpx 6rpx 0;
|
||||
border: 2rpx solid #d9d9d9;
|
||||
background: #f7f7fa;
|
||||
font-size: 28rpx;
|
||||
color: #999999;
|
||||
display: flex;
|
||||
padding: 10rpx 38rpx;
|
||||
align-items: center;
|
||||
border-radius: 0 6rpx 6rpx 0;
|
||||
border: 2rpx solid #d9d9d9;
|
||||
background: #f7f7fa;
|
||||
font-size: 28rpx;
|
||||
color: #999999;
|
||||
}
|
||||
.upload {
|
||||
padding: 8rpx 32rpx;
|
||||
border-radius: 60rpx;
|
||||
background: $my-main-color;
|
||||
font-size: 28rpx;
|
||||
color: #ffffff;
|
||||
line-height: 40rpx;
|
||||
margin: 0;
|
||||
padding: 8rpx 32rpx;
|
||||
border-radius: 60rpx;
|
||||
background: $my-main-color;
|
||||
font-size: 28rpx;
|
||||
color: #ffffff;
|
||||
line-height: 40rpx;
|
||||
margin: 0;
|
||||
}
|
||||
.code {
|
||||
display: flex;
|
||||
width: 264rpx;
|
||||
height: 264rpx;
|
||||
padding: 108rpx;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
border: 3rpx dashed #d9d9d9;
|
||||
background: #fff;
|
||||
padding: 2rpx;
|
||||
display: flex;
|
||||
width: 264rpx;
|
||||
height: 264rpx;
|
||||
padding: 108rpx;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
border: 3rpx dashed #d9d9d9;
|
||||
background: #fff;
|
||||
padding: 2rpx;
|
||||
}
|
||||
.preview {
|
||||
padding: 8rpx 32rpx;
|
||||
border-radius: 12rpx;
|
||||
background: $my-main-color;
|
||||
color: #ffffff;
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
line-height: 40rpx;
|
||||
padding: 8rpx 32rpx;
|
||||
border-radius: 12rpx;
|
||||
background: $my-main-color;
|
||||
color: #ffffff;
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
.preview-box {
|
||||
width: 700rpx;
|
||||
padding: 32rpx 28rpx;
|
||||
width: 700rpx;
|
||||
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>
|
||||
@@ -14,10 +14,13 @@
|
||||
</view>
|
||||
<my-tabs v-model="active" :list="tabs" textKey="label"></my-tabs>
|
||||
<view v-if="active == 2" class="u-flex u-row-between u-m-t-32" style="gap: 58rpx">
|
||||
<view class="u-flex-1 filter-box" style="border-radius: 100rpx">
|
||||
<!-- <view class="u-flex-1 filter-box" style="border-radius: 100rpx">
|
||||
<up-icon name="search" size="18"></up-icon>
|
||||
<input class="u-m-l-10 u-font-28" type="text" placeholder-class="color-999 u-font-28" placeholder="搜索关键词" v-model="keyWord" @blur="keyWordBlur" />
|
||||
<up-icon v-if="keyWord" name="close" size="14" @click="clearKeyWord"></up-icon>
|
||||
</view> -->
|
||||
<view class="u-flex-1">
|
||||
<my-user-select v-model="userId" @change="search()" ></my-user-select>
|
||||
</view>
|
||||
<view class="u-flex-1 u-font-28 filter-box u-flex u-row-between" @click="showTimeArea = true">
|
||||
<template v-if="userComponentQuery.startTime && userComponentQuery.endTime">
|
||||
@@ -215,6 +218,7 @@ function refresh() {
|
||||
}
|
||||
|
||||
const listRes = ref({});
|
||||
const userId=ref('')
|
||||
async function getList() {
|
||||
let res = null;
|
||||
if (active.value == 1) {
|
||||
@@ -232,7 +236,8 @@ async function getList() {
|
||||
res = await memberApi.orderList({
|
||||
page: pageNum.value,
|
||||
size: 10,
|
||||
key: userComponentQuery.user,
|
||||
// key: userComponentQuery.user,
|
||||
key: userId.value,
|
||||
startTime: userComponentQuery.startTime ? userComponentQuery.startTime + ' 00:00:00' : '',
|
||||
endTime: userComponentQuery.endTime ? userComponentQuery.endTime + ' 23:59:59' : ''
|
||||
});
|
||||
@@ -264,6 +269,7 @@ watch(
|
||||
userComponentQuery.startTime = '';
|
||||
userComponentQuery.endTime = '';
|
||||
keyWord.value = '';
|
||||
userId.value=''
|
||||
refresh();
|
||||
}
|
||||
);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
113
pages.json
113
pages.json
@@ -257,6 +257,13 @@
|
||||
"style": {
|
||||
"navigationBarTitleText": "添加临时菜"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "stick/stick",
|
||||
"pageId": "PAGES_CREATE_ORDER_STICK",
|
||||
"style": {
|
||||
"navigationBarTitleText": "编辑"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -533,6 +540,12 @@
|
||||
"style": {
|
||||
"navigationBarTitleText": "账单付款记录"
|
||||
}
|
||||
}, {
|
||||
"pageId": "PAGES_BATCH_IN",
|
||||
"path": "batch_in",
|
||||
"style": {
|
||||
"navigationBarTitleText": "批量入库"
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
@@ -808,9 +821,85 @@
|
||||
"style": {
|
||||
// "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": "分享"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -822,6 +911,24 @@
|
||||
"navigationBarTitleText": "分销"
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
"root": "entryManager",
|
||||
"pages": [
|
||||
{
|
||||
"path": "index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "进件管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "add/add",
|
||||
"style": {
|
||||
"navigationBarTitleText": "进件"
|
||||
}
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
// ,
|
||||
// {
|
||||
@@ -861,7 +968,7 @@
|
||||
// "navigationBarTitleText": "查看优惠券"
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// ]
|
||||
// }
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ const menuList = ref([
|
||||
{
|
||||
title: '积分锁客',
|
||||
icon: '',
|
||||
pageUrl: '',
|
||||
pageUrl: 'PAGES_MARKET_POINTS_INDEX',
|
||||
intro: '设置充值消费的N倍,当前订单立即免单'
|
||||
},
|
||||
{
|
||||
@@ -112,7 +112,7 @@ const menuList = ref([
|
||||
{
|
||||
title: '套餐推广',
|
||||
icon: '',
|
||||
pageUrl: '',
|
||||
pageUrl: 'PAGES_MARKET_PACKAGE_POPULARIZE_INDEX',
|
||||
intro: '下单通过用户邀请好友减免金额的方式裂变宣传套餐加购'
|
||||
},
|
||||
{
|
||||
@@ -135,7 +135,7 @@ const menuList = ref([
|
||||
},
|
||||
{
|
||||
icon: 'xszk',
|
||||
pageUrl: 'PAGES_LIMIT_DISCOUNT',
|
||||
pageUrl: 'PAGES_MARKET_GROUP_GOODS_INDEX',
|
||||
title: '商品拼团',
|
||||
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 arr = menusStore.adminPages.filter((v) => {
|
||||
// return navList.find((navItem) => navItem.title == v.title);
|
||||
// });
|
||||
return menuList.value.map((v) => {
|
||||
v.menus = v.menus.filter((menu) => {
|
||||
const hasPermission = menusStore.adminPages.find((navItem) => navItem.title == menu.title);
|
||||
console.log('hasPermission', hasPermission);
|
||||
if (hasPermission) {
|
||||
menu.icon = hasPermission.miniIcon;
|
||||
console.log(menu);
|
||||
}
|
||||
|
||||
return hasPermission;
|
||||
});
|
||||
return v;
|
||||
|
||||
@@ -23,11 +23,11 @@
|
||||
<view class="u-flex-1 u-p-l-30 u-text-left">
|
||||
<view class="u-flex">
|
||||
<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;"
|
||||
mode=""></image>
|
||||
<text class="u-m-l-6">切换店铺</text>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
<view style="color: rgba(255,255,255,0.83);" v-if="shopStaff">
|
||||
|
||||
@@ -74,7 +74,7 @@ export default {
|
||||
},
|
||||
async init() {
|
||||
const res = await menusStore.getMenus()
|
||||
const arr=res.filter(v => v.type == 0 && v.children.length && !v.hidden).map(v => {
|
||||
const arr=res.filter(v => v.type == 0 && v.children.length && !v.hidden && v.menuId!=1).map(v => {
|
||||
return {
|
||||
...v,
|
||||
children: v.children.filter(child => child.type == 0 && !child.hidden)
|
||||
|
||||
@@ -94,6 +94,19 @@
|
||||
></up-switch>
|
||||
</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="u-flex u-row-between">
|
||||
<view class="label">点餐电子围栏</view>
|
||||
@@ -449,6 +462,9 @@ let switchChange = (type) => {
|
||||
case "isOrderFence":
|
||||
params.isOrderFence = vdata.shopInfo.isOrderFence;
|
||||
break;
|
||||
case "isCountStick":
|
||||
params.isCountStick = vdata.shopInfo.isCountStick;
|
||||
break;
|
||||
}
|
||||
updateShopInfo(params);
|
||||
};
|
||||
|
||||
@@ -239,6 +239,7 @@
|
||||
discount_sale_amount: form.price, //数量
|
||||
pack_number: 0, //数量
|
||||
is_gift: 0,
|
||||
remark:form.note,
|
||||
is_temporary: 1, //是否是临时菜
|
||||
}
|
||||
websocketUtil.send(JSON.stringify(params))
|
||||
@@ -247,6 +248,7 @@
|
||||
name: form.name,
|
||||
lowPrice: form.price,
|
||||
number: form.num,
|
||||
remark:form.note,
|
||||
is_temporary: 1, //是否是临时菜
|
||||
})
|
||||
clearInterval(timer)
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
</view>
|
||||
<view class="u-m-l-30 u-flex">
|
||||
<text class="">积分:</text>
|
||||
<text class="color-main">{{item.accountPoints}}</text>
|
||||
<text class="color-main">{{item.pointBalance||0}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -113,7 +113,7 @@
|
||||
headImg: '',
|
||||
telephone: '',
|
||||
amount: '0.00',
|
||||
accountPoints: '0.00'
|
||||
pointBalance: '0.00'
|
||||
})
|
||||
} else {
|
||||
list[index].checked = true
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<view class="u-font-24 u-m-l-30 u-text-center">
|
||||
<text>积分:</text>
|
||||
<text class="color-main">{{
|
||||
pageData.user.accountPoints
|
||||
pageData.user.pointBalance||0
|
||||
}}</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -88,7 +88,7 @@
|
||||
<view class="u-flex">
|
||||
<view>积分</view>
|
||||
<view class="color-333 u-m-l-10">{{
|
||||
pageData.user.accountPoints
|
||||
pageData.user.pointBalance||0
|
||||
}}</view>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
@@ -169,6 +169,7 @@
|
||||
>
|
||||
<image class="img" :src="item.coverImg" mode=""></image>
|
||||
</view>
|
||||
|
||||
<view
|
||||
style="
|
||||
background-color: #3f9eff;
|
||||
@@ -180,7 +181,7 @@
|
||||
"
|
||||
v-else
|
||||
>
|
||||
临时菜
|
||||
{{ item.name }}
|
||||
</view>
|
||||
<view class="u-m-l-32">
|
||||
<view class="u-flex">
|
||||
@@ -934,14 +935,15 @@ function watchChooseuser() {
|
||||
if (pageData.user.id == data.id) {
|
||||
return;
|
||||
}
|
||||
if (data.id) {
|
||||
const res = await shopUserDetail({
|
||||
userId: data.userId,
|
||||
});
|
||||
pageData.user = res;
|
||||
} else {
|
||||
pageData.user = data;
|
||||
}
|
||||
pageData.user = data;
|
||||
// if (data.id) {
|
||||
// const res = await shopUserDetail({
|
||||
// userId: data.userId,
|
||||
// });
|
||||
// pageData.user = res;
|
||||
// } else {
|
||||
// pageData.user = data;
|
||||
// }
|
||||
// 更新购物车和历史订单数据
|
||||
uodateCartAndHistory();
|
||||
});
|
||||
|
||||
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>
|
||||
<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 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="u-flex u-row-between">
|
||||
<view>订单状态</view>
|
||||
<view>{{$dict.getDiceName(data.status,'orderStatus')}}</view>
|
||||
<view>{{ $dict.getDiceName(data.status, 'orderStatus') }}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-24">
|
||||
<view>订单类型</view>
|
||||
<view>{{$dict.getDiceName(data.dineMode,'dineMode')}}</view>
|
||||
<view>{{ $dict.getDiceName(data.dineMode, 'dineMode') }}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-24">
|
||||
<view>桌位号</view>
|
||||
<view>{{table.name||data.tableName}}</view>
|
||||
<view>{{ table.name || data.tableName }}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-24" v-if="seatFee.number">
|
||||
<view>就餐人数</view>
|
||||
<view>{{seatFee.number||''}}</view>
|
||||
<view>{{ seatFee.number || '' }}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-24">
|
||||
<view>支付方式</view>
|
||||
<view>{{$dict.getDiceName(data.payType,'payType')||''}}</view>
|
||||
<view>{{ $dict.getDiceName(data.payType, 'payType') || '' }}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-24">
|
||||
<view>下单时间</view>
|
||||
@@ -27,9 +27,9 @@
|
||||
<view class="u-flex u-row-between u-m-t-24">
|
||||
<view>订单编号</view>
|
||||
<view class="u-flex">
|
||||
<view>{{data.orderNo}}</view>
|
||||
<view>{{ data.orderNo }}</view>
|
||||
<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-copy>
|
||||
</view>
|
||||
@@ -37,34 +37,44 @@
|
||||
</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;">
|
||||
{{data.remark}}
|
||||
<view class="u-p-l-32" style="max-width: 522rpx; word-wrap: break-word">
|
||||
{{ 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>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { ref } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
table: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
seatFee: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
totalNumber: 0
|
||||
}
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
table: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
seatFee: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
totalNumber: 0;
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
@@ -2,20 +2,18 @@
|
||||
<my-model ref="model" :title="title" iconColor="#000" @close="resetForm">
|
||||
<template #desc>
|
||||
<view class="u-text-left u-p-30 color-666 u-font-28">
|
||||
<view class="u-m-t-32 u-flex ">
|
||||
<view class="" v-if="accountPoints.calcRes.usable">
|
||||
<view class="u-m-t-32 u-flex">
|
||||
<view class="" v-if="pointDeductionRule.enableRewards">
|
||||
<text class="color-red">*</text>
|
||||
<text class=""
|
||||
v-if="accountPoints.calcRes.equivalentPoints">100积分等于{{to2(accountPoints.calcRes.equivalentPoints*100)}}元,</text>
|
||||
v-if="pointDeductionRule.equivalentPoints">{{ pointDeductionRule.equivalentPoints }}积分等于1元,</text>
|
||||
<text>
|
||||
最大抵扣积分{{accountPoints.calcRes.maxUsablePoints}}
|
||||
</text>
|
||||
<text>,
|
||||
最小抵扣积分0
|
||||
最大抵扣积分{{ maxCanUsePoints }}
|
||||
</text>
|
||||
<text>, 最小抵扣积分0 </text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-40 u-flex ">
|
||||
<view class="u-m-t-40 u-flex">
|
||||
<view>积分</view>
|
||||
<view class="u-m-l-32 border u-p-l-10 u-p-r-10 u-flex-1">
|
||||
<uni-easyinput type="number" @input="pointsInput" @change="pointsChange" paddingNone
|
||||
@@ -38,93 +36,103 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, nextTick, ref, watch } from 'vue';
|
||||
import myModel from '@/components/my-components/my-model.vue'
|
||||
import myButton from '@/components/my-components/my-button.vue'
|
||||
import myTabs from '@/components/my-components/my-tabs.vue'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import {
|
||||
reactive,
|
||||
nextTick,
|
||||
ref,
|
||||
watch
|
||||
} from "vue";
|
||||
import myModel from "@/components/my-components/my-model.vue";
|
||||
import myButton from "@/components/my-components/my-button.vue";
|
||||
import myTabs from "@/components/my-components/my-tabs.vue";
|
||||
import infoBox from "@/commons/utils/infoBox.js";
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
default: '积分抵扣'
|
||||
default: "积分抵扣",
|
||||
},
|
||||
accountPoints:{
|
||||
type:Object,
|
||||
default:()=>{
|
||||
maxCanUsePoints: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
pointDeductionRule: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
calcRes:{
|
||||
usable: false,
|
||||
unusableReason: '',
|
||||
minDeductionPoints: 0,
|
||||
maxUsablePoints: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
enableRewards: false,
|
||||
unusableReason: "",
|
||||
minDeductionPoints: 0,
|
||||
maxUsablePoints: 0,
|
||||
};
|
||||
},
|
||||
},
|
||||
price: {
|
||||
type: [Number, String],
|
||||
default: 0
|
||||
}
|
||||
})
|
||||
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
|
||||
function to2(n) {
|
||||
if (!n) {
|
||||
return ''
|
||||
}
|
||||
return n.toFixed(2)
|
||||
}
|
||||
|
||||
function pointsInput(e){
|
||||
setTimeout(()=>{
|
||||
form.points=Math.floor(e)
|
||||
},100)
|
||||
}
|
||||
|
||||
|
||||
function pointsChange(newval) {
|
||||
form.points=Math.floor(newval)
|
||||
if (newval < 0) {
|
||||
form.points = 0
|
||||
return infoBox.showToast('积分抵扣不能小于0')
|
||||
}
|
||||
if (newval > props.accountPoints.calcRes.maxUsablePoints) {
|
||||
form.points = props.price
|
||||
return infoBox.showToast('积分抵扣不能大于'+props.accountPoints.calcRes.maxUsablePoints)
|
||||
return "";
|
||||
}
|
||||
return n.toFixed(2);
|
||||
}
|
||||
|
||||
function pointsInput(e) {
|
||||
setTimeout(() => {
|
||||
form.points = Math.floor(e);
|
||||
}, 100);
|
||||
}
|
||||
|
||||
function pointsChange(newval) {
|
||||
form.points = Math.floor(newval);
|
||||
if (newval < 0) {
|
||||
form.points = 0;
|
||||
return infoBox.showToast("积分抵扣不能小于0");
|
||||
}
|
||||
if (newval > props.maxCanUsePoints) {
|
||||
form.points = props.price;
|
||||
return infoBox.showToast(
|
||||
"积分抵扣不能大于" + props.maxCanUsePoints
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const form = reactive({
|
||||
points: props.price,
|
||||
})
|
||||
watch(() => props.price, (newval) => {
|
||||
form.points = newval
|
||||
})
|
||||
});
|
||||
watch(
|
||||
() => props.price,
|
||||
(newval) => {
|
||||
form.points = newval;
|
||||
}
|
||||
);
|
||||
|
||||
function resetForm() {
|
||||
form.points=0
|
||||
form.points = 0;
|
||||
}
|
||||
|
||||
const model = ref(null)
|
||||
const model = ref(null);
|
||||
|
||||
function open() {
|
||||
model.value.open()
|
||||
form.points = props.price
|
||||
model.value.open();
|
||||
form.points = props.price;
|
||||
}
|
||||
|
||||
function close() {
|
||||
model.value.close()
|
||||
model.value.close();
|
||||
}
|
||||
const emits = defineEmits(['confirm'])
|
||||
const emits = defineEmits(["confirm"]);
|
||||
|
||||
function confirm() {
|
||||
emits('confirm',Math.floor(form.points) )
|
||||
close()
|
||||
emits("confirm", Math.floor(form.points));
|
||||
close();
|
||||
}
|
||||
defineExpose({
|
||||
open,
|
||||
close
|
||||
})
|
||||
close,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -140,7 +148,7 @@
|
||||
|
||||
.tag {
|
||||
background-color: #fff;
|
||||
border: 1px solid #E5E5E5;
|
||||
border: 1px solid #e5e5e5;
|
||||
line-height: inherit;
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
@@ -148,13 +156,13 @@
|
||||
border-radius: 8rpx;
|
||||
|
||||
&.active {
|
||||
border-color: #E6F0FF;
|
||||
border-color: #e6f0ff;
|
||||
color: $my-main-color;
|
||||
}
|
||||
}
|
||||
|
||||
.hover-class {
|
||||
background-color: #E5E5E5;
|
||||
background-color: #e5e5e5;
|
||||
}
|
||||
|
||||
.discount {
|
||||
@@ -166,7 +174,7 @@
|
||||
}
|
||||
|
||||
.bg1 {
|
||||
background: #F7F7FA;
|
||||
background: #f7f7fa;
|
||||
}
|
||||
|
||||
.tab {
|
||||
@@ -174,7 +182,7 @@
|
||||
}
|
||||
|
||||
.border {
|
||||
border: 1px solid #E5E5E5;
|
||||
border: 1px solid #e5e5e5;
|
||||
border-radius: 4rpx;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
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 customParseFormat from 'dayjs/plugin/customParseFormat';
|
||||
dayjs.extend(customParseFormat); // 注册插件
|
||||
import {
|
||||
BigNumber
|
||||
} from "bignumber.js";
|
||||
|
||||
/**
|
||||
* 过滤输入,只允许数字和最多两位小数
|
||||
@@ -71,4 +74,73 @@ export const convertTimeFormat = (timeStr) => {
|
||||
|
||||
// 非法格式兜底
|
||||
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'; // 出错时返回默认值
|
||||
}
|
||||
};
|
||||
@@ -7,17 +7,25 @@ export default defineConfig({
|
||||
],
|
||||
server: {
|
||||
proxy: {
|
||||
'/javaapi': {
|
||||
// target: 'https://cashier.sxczgkj.com', // 目标服务器地址
|
||||
'/prodJavaApi': {
|
||||
target: 'https://cashier.sxczgkj.com', // 目标服务器地址
|
||||
changeOrigin: true, // 是否更改请求源
|
||||
rewrite: path => path.replace(/^\/prodJavaApi/, '')
|
||||
},
|
||||
'/testJavaApi': {
|
||||
target: 'http://192.168.1.42/', // 目标服务器地址
|
||||
changeOrigin: true, // 是否更改请求源
|
||||
rewrite: path => path.replace(/^\/javaapi/, '')
|
||||
rewrite: path => path.replace(/^\/testJavaApi/, '')
|
||||
},
|
||||
'/phpapi': {
|
||||
// target: 'https://cashier.sxczgkj.com', // 目标服务器地址
|
||||
'/prodPhpApi': {
|
||||
target: 'https://cashier.sxczgkj.com', // 目标服务器地址
|
||||
changeOrigin: true, // 是否更改请求源
|
||||
rewrite: path => path.replace(/^\/prodPhpApi/, '')
|
||||
},
|
||||
'/testPhpApi': {
|
||||
target: 'http://192.168.1.42:8787/', // 目标服务器地址
|
||||
changeOrigin: true, // 是否更改请求源
|
||||
rewrite: path => path.replace(/^\/phpapi/, '')
|
||||
rewrite: path => path.replace(/^\/testPhpApi/, '')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user