Compare commits
47 Commits
ymf
...
4431f29dff
| Author | SHA1 | Date | |
|---|---|---|---|
| 4431f29dff | |||
| 614fd15b81 | |||
| ffe9fa58f2 | |||
| 4b1e8066f0 | |||
| 23ccde5250 | |||
| 24d7345056 | |||
| 38e26fed3e | |||
| f3bd7637b5 | |||
| 85354f6296 | |||
| 410b0501af | |||
| b35d165f7a | |||
| f090d59dc6 | |||
| 2bd52f85b9 | |||
| 6535b6f580 | |||
| 6bbe3b2d09 | |||
| 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
App.vue
1
App.vue
@@ -9,6 +9,7 @@ import appConfig from '@/config/appConfig.js';
|
|||||||
import { provide, onMounted } from 'vue';
|
import { provide, onMounted } from 'vue';
|
||||||
import WebsocketUtil from '@/commons/utils/websocket.js';
|
import WebsocketUtil from '@/commons/utils/websocket.js';
|
||||||
|
|
||||||
|
console.log('appConfig.wss',appConfig.wss);
|
||||||
const websocketUtil = new WebsocketUtil(appConfig.wss, 5000); // 创建 WebSocket 工具类实例
|
const websocketUtil = new WebsocketUtil(appConfig.wss, 5000); // 创建 WebSocket 工具类实例
|
||||||
provide('websocketUtil', websocketUtil); // 提供给所有子组件
|
provide('websocketUtil', websocketUtil); // 提供给所有子组件
|
||||||
onMounted(() => {});
|
onMounted(() => {});
|
||||||
|
|||||||
59
activationCode/components/date-picker-select.vue
Normal file
59
activationCode/components/date-picker-select.vue
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="u-flex date-filter-box " @click="show">
|
||||||
|
<view>
|
||||||
|
<text class="color-999" v-if="!startDate">开始日期</text>
|
||||||
|
<text class="" v-else>
|
||||||
|
{{ showDate(startDate)}}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
<text>至</text>
|
||||||
|
<view>
|
||||||
|
<text class="color-999" v-if="!endDate">结束日期</text>
|
||||||
|
<text class="" v-else>
|
||||||
|
{{ showDate(endDate)}}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<my-date-pickerview mode="date" @confirm="datePickerConfirm" ref="datePicker"
|
||||||
|
style="z-index: 999"></my-date-pickerview>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
ref
|
||||||
|
} from 'vue';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
|
const startDate = defineModel('start')
|
||||||
|
const endDate = defineModel('end')
|
||||||
|
|
||||||
|
const datePicker = ref(null)
|
||||||
|
|
||||||
|
function show() {
|
||||||
|
datePicker.value.open()
|
||||||
|
}
|
||||||
|
|
||||||
|
function datePickerConfirm(e) {
|
||||||
|
console.log(e);
|
||||||
|
startDate.value = e.start
|
||||||
|
endDate.value = e.end
|
||||||
|
}
|
||||||
|
function showDate(str){
|
||||||
|
if(str){
|
||||||
|
return str.split(' ')[0]
|
||||||
|
}
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.date-filter-box {
|
||||||
|
border: 1px solid #eee;
|
||||||
|
padding: 10rpx 32rpx;
|
||||||
|
justify-content: space-between;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
28
activationCode/data.js
Normal file
28
activationCode/data.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
export const shopTypes = {
|
||||||
|
'only': '单店',
|
||||||
|
'chain': '连锁店',
|
||||||
|
'join': '加盟店',
|
||||||
|
}
|
||||||
|
|
||||||
|
export const registerTypes = {
|
||||||
|
'before': '快餐版',
|
||||||
|
'after': '餐饮版',
|
||||||
|
}
|
||||||
|
|
||||||
|
export const profiless = {
|
||||||
|
probation: '试用',
|
||||||
|
release: '正式',
|
||||||
|
}
|
||||||
|
export const statuss = {
|
||||||
|
1: '开启',
|
||||||
|
0: '关闭'
|
||||||
|
}
|
||||||
|
export const tubeTypes = {
|
||||||
|
1: '直接管理',
|
||||||
|
0: '不可直接管理'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const channels = {
|
||||||
|
'poly': '聚合支付',
|
||||||
|
'native': '支付进件',
|
||||||
|
}
|
||||||
395
activationCode/index/index.vue
Normal file
395
activationCode/index/index.vue
Normal file
@@ -0,0 +1,395 @@
|
|||||||
|
<template>
|
||||||
|
<view class="min-page bg-f7 u-font-28 color-333">
|
||||||
|
<up-sticky>
|
||||||
|
<view class="top u-flex gap-20">
|
||||||
|
<!-- <up-select :options="types" @select="typesSelect">
|
||||||
|
<template #text>
|
||||||
|
<text v-if="query.type!==''">{{returnTypesLabel(query.type)}}</text>
|
||||||
|
<text v-else>类型</text>
|
||||||
|
</template>
|
||||||
|
</up-select> -->
|
||||||
|
<up-select :options="statusList" @select="statusListSelect">
|
||||||
|
<template #text>
|
||||||
|
<text v-if="query.state!==''">{{returnStatusLabel(query.state)}}</text>
|
||||||
|
<text v-else>状态</text>
|
||||||
|
</template>
|
||||||
|
</up-select>
|
||||||
|
<view class="u-flex-1">
|
||||||
|
<datePickerSelect v-model:start="query.startTime" v-model:end="query.endTime">
|
||||||
|
</datePickerSelect>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</up-sticky>
|
||||||
|
<view class="box">
|
||||||
|
<view class="container" v-for="(item,index) in list" :key="index">
|
||||||
|
<view class="u-flex u-row-between">
|
||||||
|
<view>
|
||||||
|
<text class="color-666">创建时间:</text>
|
||||||
|
<text class="font-bold">{{item.createTime}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="status" :class="returnStatusClass(item.status)">{{item.status?'已使用':'未使用'}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-row-between u-m-t-24">
|
||||||
|
<view>
|
||||||
|
<text class="color-666">激活时长(月):</text>
|
||||||
|
<text class="font-bold">{{item.periodMonth}}个月</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="u-flex u-m-t-32" v-if="item.shopName">
|
||||||
|
<view>
|
||||||
|
<text class="color-666">使用店铺名称:</text>
|
||||||
|
<text class="font-bold">{{item.shopName}}</text>
|
||||||
|
<text class="u-m-l-10">({{item.registerType=='before'?'快餐版':'餐饮版'}})</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<view class="u-m-t-24 u-flex u-col-center">
|
||||||
|
<text class="color-666">激活码:</text>
|
||||||
|
<view class="status success u-font-24">{{item.registerCode}}</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="u-flex u-m-t-32 u-row-right gap-20">
|
||||||
|
|
||||||
|
<view style="min-width: 160rpx;">
|
||||||
|
<my-button @click="oncopy(item.registerCode)">复制激活码</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="toAdd()">添加激活码</my-button>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<up-popup :show="addShow" mode="center"
|
||||||
|
@close="addShow=false" round="16rpx" :close-on-click-overlay="true">
|
||||||
|
<view class="add-box">
|
||||||
|
<view class="font-bold u-font-32 text-center">生成激活码</view>
|
||||||
|
<view class="u-p-l-20 u-p-r-20 u-m-r-32">
|
||||||
|
<up-form label-width="auto">
|
||||||
|
<up-form-item label="激活时长" required>
|
||||||
|
<up-number-box input-width="200rpx" v-model="form.periodMonth" :integer="true" :step="1" ></up-number-box>
|
||||||
|
</up-form-item>
|
||||||
|
</up-form>
|
||||||
|
<up-form label-width="auto">
|
||||||
|
<up-form-item label="生产数量" required>
|
||||||
|
<up-number-box input-width="200rpx" v-model="form.num" :integer="true" :step="1" ></up-number-box>
|
||||||
|
</up-form-item>
|
||||||
|
</up-form>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex gap-20 u-m-t-42">
|
||||||
|
<view class="u-flex-1">
|
||||||
|
<my-button type="default" @click="addShow=false">取消</my-button>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex-1">
|
||||||
|
<my-button @click="submit">生产激活码</my-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</up-popup>
|
||||||
|
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
|
||||||
|
import {
|
||||||
|
reactive,
|
||||||
|
ref,
|
||||||
|
watch
|
||||||
|
} from 'vue';
|
||||||
|
import {
|
||||||
|
onReachBottom,
|
||||||
|
onShow
|
||||||
|
} from '@dcloudio/uni-app'
|
||||||
|
import * as Api from '@/http/api/account/merchantRegister.js'
|
||||||
|
|
||||||
|
import datePickerSelect from '../components/date-picker-select.vue'
|
||||||
|
|
||||||
|
const code = ref('')
|
||||||
|
const addShow = ref(false)
|
||||||
|
|
||||||
|
const form =reactive({
|
||||||
|
periodMonth:1,
|
||||||
|
num:1,
|
||||||
|
})
|
||||||
|
watch(()=>addShow.value,(newval)=>{
|
||||||
|
if(!newval){
|
||||||
|
form.periodMonth=1;
|
||||||
|
form.num=1;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
const codeType = ref('')
|
||||||
|
|
||||||
|
const datePicker = ref(null)
|
||||||
|
|
||||||
|
function datePickerConfirm(e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function submit(){
|
||||||
|
Api.addMerchantRegister(form).then(res=>{
|
||||||
|
if(res){
|
||||||
|
uni.$u.toast('添加成功')
|
||||||
|
addShow.value=false
|
||||||
|
search()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const statusList = [{
|
||||||
|
value: 1,
|
||||||
|
name: '已激活',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 0,
|
||||||
|
name: '待激活',
|
||||||
|
},
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
const types = [{
|
||||||
|
value: 'before',
|
||||||
|
name: '快餐版',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'after',
|
||||||
|
name: '餐饮版',
|
||||||
|
},
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
function oncopy(code) {
|
||||||
|
uni.setClipboardData({
|
||||||
|
data: code
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function statusListSelect(e) {
|
||||||
|
query.state = e.value
|
||||||
|
}
|
||||||
|
|
||||||
|
function typesSelect(e) {
|
||||||
|
query.type = 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 returnTypesLabel(state) {
|
||||||
|
const item = types.find(v => v.value == state)
|
||||||
|
if (item) {
|
||||||
|
return item.name
|
||||||
|
}
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
|
||||||
|
function returnStatusClass(state) {
|
||||||
|
if (state == 1) {
|
||||||
|
return 'success'
|
||||||
|
}
|
||||||
|
return 'gray'
|
||||||
|
}
|
||||||
|
|
||||||
|
function showCode(item, type) {
|
||||||
|
if (type == 'wx') {
|
||||||
|
code.value = item.wechatSignUrl
|
||||||
|
}
|
||||||
|
if (type == 'aliPay') {
|
||||||
|
code.value = item.alipaySignUrl
|
||||||
|
}
|
||||||
|
codeType.value = type
|
||||||
|
addShow.value = true
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const showShopSelect = ref(false)
|
||||||
|
|
||||||
|
const query = reactive({
|
||||||
|
page: 1,
|
||||||
|
size: 10,
|
||||||
|
state: '',
|
||||||
|
type: '',
|
||||||
|
startTime:'',
|
||||||
|
endTime:'',
|
||||||
|
})
|
||||||
|
watch(() => query.state, (newval) => {
|
||||||
|
search()
|
||||||
|
})
|
||||||
|
watch(() => query.startTime, (newval) => {
|
||||||
|
search()
|
||||||
|
})
|
||||||
|
watch(() => query.endTime, (newval) => {
|
||||||
|
search()
|
||||||
|
})
|
||||||
|
watch(() => query.type, (newval) => {
|
||||||
|
search()
|
||||||
|
})
|
||||||
|
const isEnd = ref(false)
|
||||||
|
const list = ref([])
|
||||||
|
|
||||||
|
function search() {
|
||||||
|
isEnd.value = false
|
||||||
|
query.page = 1
|
||||||
|
getData()
|
||||||
|
}
|
||||||
|
|
||||||
|
function toAdd(shop) {
|
||||||
|
addShow.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function toEdit(shop) {
|
||||||
|
console.log(shop)
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pagesShops/add/add?id=' + shop.id
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
let isAjaxIng=ref(false)
|
||||||
|
function getData() {
|
||||||
|
if(isAjaxIng.value){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
isAjaxIng.value=true
|
||||||
|
Api.getMerchantRegister({
|
||||||
|
...query,
|
||||||
|
startTime:'',
|
||||||
|
endTime:'',
|
||||||
|
createdAt:query.startTime&&query.endTime?( [query.startTime,query.endTime]):''
|
||||||
|
}).then(res => {
|
||||||
|
isAjaxIng.value=false
|
||||||
|
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++
|
||||||
|
getData()
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
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 {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
.add-box {
|
||||||
|
background-color: #fff;
|
||||||
|
width: 690rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 32rpx 28rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
73
commons/data/entryManager.js
Normal file
73
commons/data/entryManager.js
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
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': '对公借记卡',
|
||||||
|
}
|
||||||
|
// WAIT 待提交
|
||||||
|
// INIT 待处理
|
||||||
|
// AUDIT 待审核
|
||||||
|
// SIGN 待签约
|
||||||
|
// FINISH 已完成
|
||||||
|
// REJECTED 失败
|
||||||
|
|
||||||
|
export 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'
|
||||||
|
},
|
||||||
|
]
|
||||||
254
components/my-components/my-address-select.vue
Normal file
254
components/my-components/my-address-select.vue
Normal file
@@ -0,0 +1,254 @@
|
|||||||
|
<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'
|
||||||
|
/**
|
||||||
|
* 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: 'my-address-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: [],
|
||||||
|
isChooseA: false, //是否已经选择了区
|
||||||
|
area: 0, //区级下标
|
||||||
|
areas: [],
|
||||||
|
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>
|
||||||
@@ -6,16 +6,17 @@
|
|||||||
class="fixed-bottom u-flex gap-20"
|
class="fixed-bottom u-flex gap-20"
|
||||||
:class="[direction == 'column' ? 'u-flex-column' : '']"
|
:class="[direction == 'column' ? 'u-flex-column' : '']"
|
||||||
>
|
>
|
||||||
<view class="u-flex-1">
|
|
||||||
<my-button type="primary" @click="save" shape="circle">
|
|
||||||
保存
|
|
||||||
</my-button>
|
|
||||||
</view>
|
|
||||||
<view class="u-flex-1">
|
<view class="u-flex-1">
|
||||||
<my-button bgColor="#fff" type="default" @click="cancel" shape="circle">
|
<my-button bgColor="#fff" type="default" @click="cancel" shape="circle">
|
||||||
取消
|
取消
|
||||||
</my-button>
|
</my-button>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="u-flex-1">
|
||||||
|
<my-button type="primary" @click="save" shape="circle">
|
||||||
|
保存
|
||||||
|
</my-button>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,78 +1,96 @@
|
|||||||
<template>
|
<template>
|
||||||
<view
|
<view class="fixed-wrap" :style="{ '--num': `${numValue}px` }">
|
||||||
class="fixed-wrap"
|
<view class="fixed-btn" :class="[type]" id="targetRef">
|
||||||
:style="{ '--num': showCancel ? '63px' : '0px' }"
|
<div class="btn">
|
||||||
v-if="isShow"
|
<u-button type="primary" :color="confirmColor" :shape="shape" size="large" @click="emits('confirm')">{{ confirmText }}</u-button>
|
||||||
>
|
</div>
|
||||||
<view class="fixed-btn" id="targetRef">
|
<div class="btn" v-if="showCancel">
|
||||||
<div class="btn">
|
<u-button :shape="shape" size="large" @click="emits('cancel')">取消</u-button>
|
||||||
<u-button
|
</div>
|
||||||
type="primary"
|
</view>
|
||||||
:shape="shape"
|
</view>
|
||||||
size="large"
|
|
||||||
@click="emits('confirm')"
|
|
||||||
>{{ confirmText }}</u-button
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
<div class="btn" v-if="showCancel">
|
|
||||||
<u-button :shape="shape" size="large" @click="emits('cancel')"
|
|
||||||
>取消</u-button
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, nextTick, getCurrentInstance ,computed} from "vue";
|
import { ref, onMounted, nextTick, getCurrentInstance, computed } from 'vue';
|
||||||
import { isMainShop } from "@/store/account.js";
|
// import { isMainShop } from '@/store/account.js';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
isOpenPermission: {
|
type: {
|
||||||
type: Boolean,
|
type: String,
|
||||||
default: true,
|
default: 'vertical' // horizontal横向 vertical竖向
|
||||||
},
|
},
|
||||||
confirmText: {
|
isOpenPermission: {
|
||||||
type: String,
|
type: Boolean,
|
||||||
default: "保存",
|
default: true
|
||||||
},
|
},
|
||||||
showCancel: {
|
confirmText: {
|
||||||
type: Boolean,
|
type: String,
|
||||||
default: false,
|
default: '保存'
|
||||||
},
|
},
|
||||||
shape: {
|
confirmColor: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "circle", // squre circle
|
default: '#3C9CFF'
|
||||||
},
|
},
|
||||||
|
showCancel: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
shape: {
|
||||||
|
type: String,
|
||||||
|
default: 'circle' // squre circle
|
||||||
|
}
|
||||||
});
|
});
|
||||||
const isShow = computed(() => {
|
|
||||||
if (props.isOpenPermission) {
|
// const isShow = computed(() => {
|
||||||
return isMainShop();
|
// if (props.isOpenPermission) {
|
||||||
}
|
// return isMainShop();
|
||||||
return true;
|
// }
|
||||||
|
// return true;
|
||||||
|
// });
|
||||||
|
|
||||||
|
const numValue = computed(() => {
|
||||||
|
let num = 0;
|
||||||
|
if (props.type == 'vertical' && props.showCancel) {
|
||||||
|
num = 63;
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
if (props.type == 'horizontal') {
|
||||||
|
num = 0;
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
return num;
|
||||||
});
|
});
|
||||||
const emits = defineEmits(["confirm", "cancel"]);
|
|
||||||
|
const emits = defineEmits(['confirm', 'cancel']);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.fixed-wrap {
|
.fixed-wrap {
|
||||||
--height: calc(83px + var(--num) + env(safe-area-inset-bottom) / 2);
|
--height: calc(83px + var(--num) + env(safe-area-inset-bottom) / 2);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: var(--height);
|
height: var(--height);
|
||||||
.fixed-btn {
|
.fixed-btn {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: var(--height);
|
height: var(--height);
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
z-index: 99;
|
z-index: 999;
|
||||||
padding: 10px 14px calc(20px + env(safe-area-inset-bottom) / 2) 10px;
|
padding: 10px 14px calc(20px + env(safe-area-inset-bottom) / 2) 10px;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
.btn {
|
&.horizontal {
|
||||||
&:first-child {
|
display: flex;
|
||||||
margin-bottom: 14px;
|
gap: 28upx;
|
||||||
}
|
.btn {
|
||||||
}
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
.btn {
|
||||||
|
&:first-child {
|
||||||
|
margin-bottom: 14px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -15,7 +15,8 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="right" v-if="showSwitch">
|
<view class="right" v-if="showSwitch">
|
||||||
<u-switch :active-value="1" :inactive-value="0" v-model="isOpen" @change="defineEmits(['update:isOpen'])"></u-switch>
|
<!-- 关键修复:删掉错误的 @change 绑定,defineModel 已自动处理双向绑定 -->
|
||||||
|
<u-switch :active-value="1" :inactive-value="0" v-model="isOpen"></u-switch>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -27,11 +28,12 @@ import { ref, onMounted, nextTick } from 'vue';
|
|||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
options: {
|
options: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: {
|
default: () => ({
|
||||||
|
// 注意:对象/数组默认值推荐用函数,避免引用共享
|
||||||
name: '标题',
|
name: '标题',
|
||||||
intro: '说明',
|
intro: '说明',
|
||||||
icon: 'xszk'
|
icon: 'xszk'
|
||||||
}
|
})
|
||||||
},
|
},
|
||||||
showSwitch: {
|
showSwitch: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@@ -41,11 +43,13 @@ const props = defineProps({
|
|||||||
|
|
||||||
const headHeight = ref(70);
|
const headHeight = ref(70);
|
||||||
|
|
||||||
|
// defineModel 是 Vue3.4+ 语法糖,自动实现 v-model:isOpen 的双向绑定
|
||||||
const isOpen = defineModel('isOpen', {
|
const isOpen = defineModel('isOpen', {
|
||||||
type: [Boolean, String, Number],
|
type: [Boolean, String, Number],
|
||||||
default: 0
|
default: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 声明自定义 emit 事件(仅在 script setup 内使用)
|
||||||
const emits = defineEmits(['load']);
|
const emits = defineEmits(['load']);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@@ -83,6 +87,7 @@ onMounted(() => {
|
|||||||
padding-left: 20upx;
|
padding-left: 20upx;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
.title {
|
.title {
|
||||||
|
margin-top: -4upx;
|
||||||
.t {
|
.t {
|
||||||
font-size: 28upx;
|
font-size: 28upx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|||||||
@@ -1,118 +1,110 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<up-radio-group v-model="useTimeType" placement="row">
|
<up-radio-group v-model="useTimeType" placement="row" v-if="showType">
|
||||||
<up-radio
|
<up-radio v-for="item in useTimeTypeList" :key="item.value" :value="item.value" :name="item.value" :label="item.label" :customStyle="customStyle"></up-radio>
|
||||||
v-for="item in useTimeTypeList"
|
</up-radio-group>
|
||||||
:key="item.value"
|
<view class="container" v-if="useTimeType == 'custom' || !showType">
|
||||||
:value="item.value"
|
<view class="u-flex u-m-t-30 box">
|
||||||
:name="item.value"
|
<view class="u-flex u-flex-1">
|
||||||
:label="item.label"
|
<view class="item" @click="pirckerShow(startValue, 'startValue')">
|
||||||
:customStyle="customStyle"
|
<text class="u-m-r-12" v-if="!startValue">开始时间</text>
|
||||||
></up-radio>
|
<text class="u-m-r-12" v-else>{{ startValue }}</text>
|
||||||
</up-radio-group>
|
</view>
|
||||||
<view class="container" v-if="useTimeType == 'custom'">
|
<view class="u-m-l-8 u-m-r-8" style="padding: 0 30rpx">—</view>
|
||||||
<view class="u-flex u-m-t-30 box" >
|
<view class="item" @click="pirckerShow(endValue, 'endValue')">
|
||||||
<view class="u-flex u-flex-1">
|
<text class="u-m-r-12" v-if="!endValue">结束时间</text>
|
||||||
<view class="item" @click="pirckerShow(startValue, 'startValue')">
|
<text class="u-m-r-12" v-else>{{ endValue }}</text>
|
||||||
<text class="u-m-r-12" v-if="!startValue">开始时间</text>
|
</view>
|
||||||
<text class="u-m-r-12" v-else>{{ startValue }}</text>
|
</view>
|
||||||
</view>
|
<up-icon name="clock"></up-icon>
|
||||||
<view class="u-m-l-8 u-m-r-8" style="padding: 0 30rpx">—</view>
|
</view>
|
||||||
<view class="item" @click="pirckerShow(endValue, 'endValue')">
|
</view>
|
||||||
<text class="u-m-r-12" v-if="!endValue">结束时间</text>
|
|
||||||
<text class="u-m-r-12" v-else>{{ endValue }}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<up-icon name="clock"></up-icon>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<up-datetime-picker
|
<up-datetime-picker :show="show" v-model="value1" closeOnClickOverlay @close="close" @cancel="close" @confirm="confirm" mode="time"></up-datetime-picker>
|
||||||
:show="show"
|
</view>
|
||||||
v-model="value1"
|
|
||||||
closeOnClickOverlay
|
|
||||||
@close="close"
|
|
||||||
@cancel="close"
|
|
||||||
@confirm="confirm"
|
|
||||||
mode="time"
|
|
||||||
></up-datetime-picker>
|
|
||||||
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref } from "vue";
|
import { computed, ref } from 'vue';
|
||||||
function cancel(){
|
|
||||||
union.navigateBack()
|
const props = defineProps({
|
||||||
}
|
showType: {
|
||||||
const customStyle = ref({
|
type: Boolean,
|
||||||
marginRight: "15px",
|
default: true
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const useTimeType = defineModel("useTimeType", {
|
function cancel() {
|
||||||
type: String,
|
union.navigateBack();
|
||||||
default: "all",
|
}
|
||||||
|
const customStyle = ref({
|
||||||
|
marginRight: '15px'
|
||||||
|
});
|
||||||
|
|
||||||
|
const useTimeType = defineModel('useTimeType', {
|
||||||
|
type: String,
|
||||||
|
default: 'all'
|
||||||
});
|
});
|
||||||
const useTimeTypeList = [
|
const useTimeTypeList = [
|
||||||
{
|
{
|
||||||
value: "all",
|
value: 'all',
|
||||||
label: "全时段可用",
|
label: '全时段可用'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "custom",
|
value: 'custom',
|
||||||
label: "指定时间段可用",
|
label: '指定时间段可用'
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
import dayjs from "dayjs";
|
import dayjs from 'dayjs';
|
||||||
const startValue = defineModel("startValue", {
|
const startValue = defineModel('startValue', {
|
||||||
type: String,
|
type: String,
|
||||||
default: "",
|
default: ''
|
||||||
});
|
});
|
||||||
const endValue = defineModel("endValue", {
|
const endValue = defineModel('endValue', {
|
||||||
type: String,
|
type: String,
|
||||||
default: "",
|
default: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
function close() {
|
function close() {
|
||||||
show.value = false;
|
show.value = false;
|
||||||
}
|
}
|
||||||
const value1 = ref("");
|
const value1 = ref('');
|
||||||
const show = ref(false);
|
const show = ref(false);
|
||||||
const nowKey = ref("");
|
const nowKey = ref('');
|
||||||
|
|
||||||
function pirckerShow(date, key) {
|
function pirckerShow(date, key) {
|
||||||
nowKey.value = key;
|
nowKey.value = key;
|
||||||
show.value = true;
|
show.value = true;
|
||||||
value1.value = date || "";
|
value1.value = date || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function confirm(e) {
|
function confirm(e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
|
|
||||||
if (nowKey.value == "startValue") {
|
if (nowKey.value == 'startValue') {
|
||||||
startValue.value = e.value;
|
startValue.value = e.value;
|
||||||
} else if (nowKey.value == "endValue") {
|
} else if (nowKey.value == 'endValue') {
|
||||||
endValue.value = e.value;
|
endValue.value = e.value;
|
||||||
}
|
}
|
||||||
value1.value = e.value;
|
value1.value = e.value;
|
||||||
show.value = false;
|
show.value = false;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.item {
|
.item {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
line-height: 48rpx;
|
line-height: 48rpx;
|
||||||
padding: 0 12rpx;
|
padding: 0 12rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
.box {
|
.box {
|
||||||
border: 2rpx solid #dddfe6;
|
border: 2rpx solid #dddfe6;
|
||||||
padding: 16rpx 30rpx;
|
padding: 16rpx 30rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
width: 564rpx;
|
width: 564rpx;
|
||||||
border-radius: 4rpx;
|
border-radius: 4rpx;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
35
components/my-components/my-page-loading.vue
Normal file
35
components/my-components/my-page-loading.vue
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<template>
|
||||||
|
<view class="min-page u-flex u-col-center u-row-center">
|
||||||
|
<view class="loader">
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
/* HTML: <div class="loader"></div> */
|
||||||
|
.loader {
|
||||||
|
width: 50px;
|
||||||
|
--b: 8px;
|
||||||
|
aspect-ratio: 1;
|
||||||
|
border-radius: 50%;
|
||||||
|
padding: 1px;
|
||||||
|
background: conic-gradient(#0000 10%, #f03355) content-box;
|
||||||
|
-webkit-mask:
|
||||||
|
repeating-conic-gradient(#0000 0deg, #000 1deg 20deg, #0000 21deg 36deg),
|
||||||
|
radial-gradient(farthest-side, #0000 calc(100% - var(--b) - 1px), #000 calc(100% - var(--b)));
|
||||||
|
-webkit-mask-composite: destination-in;
|
||||||
|
mask-composite: intersect;
|
||||||
|
animation: l4 1s infinite steps(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes l4 {
|
||||||
|
to {
|
||||||
|
transform: rotate(1turn)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<view @click="show = true">
|
<view @click="show = true">
|
||||||
<slot v-if="$slots.default"></slot>
|
<slot v-if="$slots.default"></slot>
|
||||||
<view v-else class="choose-goods u-flex u-row-between">
|
<view v-else class="choose-goods u-flex u-row-between">
|
||||||
<text class="color-999" v-if="!modelValue">请选择商品</text>
|
<text class="color-999" v-if="!modelValue">请选择优惠券</text>
|
||||||
<text class="color-333 u-m-r-32 u-line-1" v-else>{{ goodsName }}</text>
|
<text class="color-333 u-m-r-32 u-line-1" v-else>{{ goodsName }}</text>
|
||||||
<up-icon size="14" name="arrow-down"></up-icon>
|
<up-icon size="14" name="arrow-down"></up-icon>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -1,89 +1,162 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="upload-file" @click="chooseImage">
|
<view class="upload-file" @click="chooseImage" :style="returnStyle('box')">
|
||||||
<slot v-if="$slots.default"></slot>
|
<slot v-if="$slots.default"></slot>
|
||||||
<view class="icon" v-if="!modelValue"> + </view>
|
<view class="icon" v-if="!modelValue">+</view>
|
||||||
<image class="img" v-else :src="modelValue"></image>
|
<image class="img" v-else :src="modelValue" :style="returnStyle('img')"></image>
|
||||||
|
|
||||||
<view class="close" @click.stop="()=>{}" v-if="modelValue">
|
<view class="close" @click.stop="() => {}" v-if="modelValue">
|
||||||
<up-icon name="close-circle" color="#333" size="14" @click="clearImg" ></up-icon>
|
<up-icon name="close-circle" color="#333" size="14" @click="clearImg"></up-icon>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { uploadFile } from "@/http/api/index.js";
|
import {
|
||||||
|
uploadFile
|
||||||
|
} from '@/http/api/index.js';
|
||||||
|
import {
|
||||||
|
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({
|
function returnStyle(type) {
|
||||||
type: String,
|
let size = null
|
||||||
default: "",
|
if (!props.size) {
|
||||||
});
|
return
|
||||||
|
}
|
||||||
|
if (Number(props.size) === NaN) {
|
||||||
|
size = props.size
|
||||||
|
} else {
|
||||||
|
size = props.size + 'rpx'
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
width: size,
|
||||||
|
height: size
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function chooseImage() {
|
const modelValue = defineModel({
|
||||||
uni.chooseImage({
|
type: String,
|
||||||
count: 1, //默认9
|
default: ''
|
||||||
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",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function clearImg(){
|
const emits = defineEmits('uploadSuccess')
|
||||||
modelValue.value=""
|
|
||||||
}
|
// ------------- 新增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>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.upload-file {
|
.upload-file {
|
||||||
$size: 128rpx;
|
$size: 128rpx;
|
||||||
width: $size;
|
width: $size;
|
||||||
height: $size;
|
height: $size;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border: 1px dashed #d9d9d9;
|
border: 1px dashed #d9d9d9;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
position: relative;
|
position: relative;
|
||||||
.close{
|
|
||||||
position: absolute;
|
.close {
|
||||||
right: -10rpx;
|
position: absolute;
|
||||||
top: -10rpx;
|
right: -10rpx;
|
||||||
}
|
top: -10rpx;
|
||||||
.img {
|
}
|
||||||
width: $size;
|
|
||||||
height: $size;
|
.img {
|
||||||
}
|
width: $size;
|
||||||
.icon {
|
height: $size;
|
||||||
width: 36rpx;
|
}
|
||||||
height: 36rpx;
|
|
||||||
border: 4rpx solid #999;
|
.icon {
|
||||||
border-radius: 8rpx;
|
width: 36rpx;
|
||||||
font-weight: 700;
|
height: 36rpx;
|
||||||
color: #999;
|
border: 4rpx solid #999;
|
||||||
font-size: 32rpx;
|
border-radius: 8rpx;
|
||||||
display: flex;
|
font-weight: 700;
|
||||||
justify-content: center;
|
color: #999;
|
||||||
align-items: center;
|
font-size: 32rpx;
|
||||||
line-height: 1;
|
display: flex;
|
||||||
padding: 0;
|
justify-content: center;
|
||||||
margin: 0;
|
align-items: center;
|
||||||
text-align: center;
|
line-height: 1;
|
||||||
}
|
padding: 0;
|
||||||
}
|
margin: 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
181
components/my-components/my-upload-imgs.vue
Normal file
181
components/my-components/my-upload-imgs.vue
Normal file
@@ -0,0 +1,181 @@
|
|||||||
|
<template>
|
||||||
|
<view class="upload-file-wrap">
|
||||||
|
<!-- 多图展示区域 -->
|
||||||
|
<view class="upload-file-item" v-for="(img, index) in modelValue" :key="index">
|
||||||
|
<image class="img" :src="img" mode="aspectFill" @click="previewImage(index)"></image>
|
||||||
|
<view class="close" @click.stop="removeImg(index)">
|
||||||
|
<up-icon name="close-circle" color="#333" size="14"></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 上传按钮(未达上限时显示) -->
|
||||||
|
<view class="upload-file-btn" @click="chooseImage" v-if="modelValue.length < props.maxCount">
|
||||||
|
<slot v-if="$slots.default"></slot>
|
||||||
|
<view class="icon" v-else>+</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { uploadFile } from '@/http/api/index.js';
|
||||||
|
import { ref, watch, defineProps, defineEmits } from 'vue';
|
||||||
|
|
||||||
|
// 1. 定义Props(扩展配置项)
|
||||||
|
const props = defineProps({
|
||||||
|
// 最大上传数量(默认9,可外部传参)
|
||||||
|
maxCount: {
|
||||||
|
type: Number,
|
||||||
|
default: 9
|
||||||
|
},
|
||||||
|
// 是否压缩(默认开启)
|
||||||
|
isCompressed: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
// 图片来源(相册/相机,默认都支持)
|
||||||
|
sourceType: {
|
||||||
|
type: Array,
|
||||||
|
default: () => ['album', 'camera']
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 2. 双向绑定多图列表(Array类型)
|
||||||
|
const modelValue = defineModel({
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
});
|
||||||
|
|
||||||
|
// 3. 选择图片(支持多图)
|
||||||
|
async function chooseImage() {
|
||||||
|
// 计算剩余可上传数量
|
||||||
|
const remainCount = props.maxCount - modelValue.value.length;
|
||||||
|
if (remainCount <= 0) {
|
||||||
|
uni.showToast({ title: `最多只能上传${props.maxCount}张图片`, icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uni.chooseImage({
|
||||||
|
count: remainCount, // 仅能选择剩余数量的图片
|
||||||
|
sizeType: props.isCompressed ? ['compressed'] : ['original', 'compressed'],
|
||||||
|
sourceType: props.sourceType,
|
||||||
|
success: async function (res) {
|
||||||
|
uni.showLoading({ title: '上传中' });
|
||||||
|
try {
|
||||||
|
// 批量上传选中的图片
|
||||||
|
const uploadPromises = res.tempFiles.map((file) => uploadFile(file));
|
||||||
|
const fileResList = await Promise.all(uploadPromises);
|
||||||
|
|
||||||
|
// 过滤上传失败的图片,仅保留成功的URL
|
||||||
|
const successUrls = fileResList.filter((url) => !!url);
|
||||||
|
if (successUrls.length > 0) {
|
||||||
|
modelValue.value = [...modelValue.value, ...successUrls]; // 追加到列表
|
||||||
|
uni.showToast({ title: `成功上传${successUrls.length}张图片`, icon: 'success' });
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
uni.showToast({ title: '部分图片上传失败', icon: 'none' });
|
||||||
|
console.error('图片上传失败:', error);
|
||||||
|
} finally {
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
uni.showToast({ title: '取消选择图片', icon: 'none' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 删除单张图片
|
||||||
|
function removeImg(index) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '确定要删除这张图片吗?',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
modelValue.value.splice(index, 1); // 删除对应索引的图片
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. 预览图片(支持左右滑动)
|
||||||
|
function previewImage(currentIndex) {
|
||||||
|
uni.previewImage({
|
||||||
|
urls: modelValue.value, // 所有已上传的图片列表
|
||||||
|
current: modelValue.value[currentIndex], // 当前预览的图片
|
||||||
|
loop: true // 支持循环预览
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6. 扩展:批量清空图片(可暴露给父组件调用)
|
||||||
|
const clearAllImg = () => {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '确定要清空所有图片吗?',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
modelValue.value = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 暴露方法给父组件
|
||||||
|
defineExpose({ clearAllImg });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.upload-file-wrap {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 20rpx; // 图片之间的间距
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-file-item {
|
||||||
|
$size: 128rpx;
|
||||||
|
width: $size;
|
||||||
|
height: $size;
|
||||||
|
border: 1px dashed #d9d9d9;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close {
|
||||||
|
position: absolute;
|
||||||
|
right: -10rpx;
|
||||||
|
top: -10rpx;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 50%;
|
||||||
|
padding: 2rpx;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-file-btn {
|
||||||
|
$size: 128rpx;
|
||||||
|
width: $size;
|
||||||
|
height: $size;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
border: 1px dashed #d9d9d9;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
width: 36rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
border: 4rpx solid #999;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #999;
|
||||||
|
font-size: 32rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
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>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<up-checkbox-group v-model="selectedWeek" :options="week">
|
<up-checkbox-group v-model="selectedWeek" :options="week">
|
||||||
<up-checkbox
|
<up-checkbox :customStyle="customStyle" :shape="shape" v-for="item in week" :key="item.value" :value="item.value" :name="item.value" :label="item.value">
|
||||||
:customStyle="customStyle"
|
{{ item.name }}
|
||||||
:shape="shape"
|
</up-checkbox>
|
||||||
v-for="item in week"
|
</up-checkbox-group>
|
||||||
:key="item.value"
|
</view>
|
||||||
:value="item.value"
|
|
||||||
:name="item.value"
|
|
||||||
:label="item.value"
|
|
||||||
>{{ item.name }}</up-checkbox>
|
|
||||||
</up-checkbox-group>
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from "vue";
|
import { ref } from 'vue';
|
||||||
|
|
||||||
const customStyle={
|
const customStyle = {
|
||||||
marginRight: '40rpx',
|
marginRight: '40rpx',
|
||||||
marginBottom: '16rpx',
|
marginBottom: '16rpx'
|
||||||
}
|
};
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
shape: {
|
shape: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'square' // circle
|
default: 'square' // circle
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
const selectedWeek=defineModel({
|
const selectedWeek = defineModel({
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => [],
|
default: () => []
|
||||||
});
|
});
|
||||||
const week = ref([
|
const week = ref([
|
||||||
{
|
{
|
||||||
name: "周一",
|
name: '周一',
|
||||||
value:"周一",
|
value: '周一'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "周二",
|
name: '周二',
|
||||||
value:"周二",
|
value: '周二'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "周三",
|
name: '周三',
|
||||||
value:"周三",
|
value: '周三'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "周四",
|
name: '周四',
|
||||||
value:"周四",
|
value: '周四'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "周五",
|
name: '周五',
|
||||||
value:"周五",
|
value: '周五'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "周六",
|
name: '周六',
|
||||||
value:"周六",
|
value: '周六'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "周日",
|
name: '周日',
|
||||||
value:"周日",
|
value: '周日'
|
||||||
},
|
}
|
||||||
]);
|
]);
|
||||||
</script>
|
</script>
|
||||||
@@ -1,3 +1,94 @@
|
|||||||
|
//当前环境 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
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function returnWss(env) {
|
||||||
|
// #ifdef H5
|
||||||
|
if (env === 'test') {
|
||||||
|
return 'http://192.168.1.42:2348'
|
||||||
|
} else {
|
||||||
|
return 'https://czgeatws.sxczgkj.com/wss'
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
// #ifndef H5
|
||||||
|
if (env === 'test') {
|
||||||
|
return 'ws://192.168.1.42:2348'
|
||||||
|
} else {
|
||||||
|
return 'wss://czgeatws.sxczgkj.com/wss'
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const appConfig = {
|
const appConfig = {
|
||||||
|
|
||||||
// 项目名称
|
// 项目名称
|
||||||
@@ -11,19 +102,25 @@ const appConfig = {
|
|||||||
env: {},
|
env: {},
|
||||||
|
|
||||||
// wss: "wss://sockets.sxczgkj.com/wss", //测试环境
|
// wss: "wss://sockets.sxczgkj.com/wss", //测试环境
|
||||||
wss: "wss://czgeatws.sxczgkj.com/wss", //正式环境
|
wss: returnWss(ENV), //正式环境
|
||||||
// 环境变量常量
|
// 环境变量常量
|
||||||
ENV_ENUM: {
|
ENV_ENUM: {
|
||||||
DEVELOPMENT: 'development', // 本地调试地址
|
DEVELOPMENT: 'development', // 本地调试地址
|
||||||
TEST: 'test', // 测试地址
|
TEST: 'test', // 测试地址
|
||||||
DEMO: 'demo', // 演示环境
|
DEMO: 'demo', // 演示环境
|
||||||
PRODUCTION: 'production' // 生产环境
|
PRODUCTION: 'production' // 生产环境
|
||||||
},
|
},
|
||||||
|
|
||||||
|
returnBaseUrl: returnBaseUrl,
|
||||||
storeEnvEnumKey: 'currentEnvEnum', // 本地存储的envkey的值
|
storeEnvEnumKey: 'currentEnvEnum', // 本地存储的envkey的值
|
||||||
|
|
||||||
encryptKey: '1234567890123456' // http数据加解密的key
|
encryptKey: '1234567890123456', // http数据加解密的key
|
||||||
|
baseUrl: "",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default appConfig;
|
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>
|
||||||
257
entryManager/add/components/bank-select.vue
Normal file
257
entryManager/add/components/bank-select.vue
Normal file
@@ -0,0 +1,257 @@
|
|||||||
|
<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 :style="{height:slotHeight+'px'}"></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 selid = ref('')
|
||||||
|
|
||||||
|
function returnLabel() {
|
||||||
|
const findShop = list.value.find(v => v.bankAlias == modelValue.value)
|
||||||
|
return findShop ? findShop.bankAlias : modelValue.value
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const slotHeight = ref(0)
|
||||||
|
uni.onKeyboardHeightChange(res => {
|
||||||
|
console.log('onKeyboardHeightChange', res.height)
|
||||||
|
slotHeight.value = res.height
|
||||||
|
})
|
||||||
|
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>
|
||||||
295
entryManager/add/components/bankBranchList.vue
Normal file
295
entryManager/add/components/bankBranchList.vue
Normal file
@@ -0,0 +1,295 @@
|
|||||||
|
<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.bank_branch_id"
|
||||||
|
@click="itemClick(item)" :id="'shop_'+item.bank_branch_id"
|
||||||
|
:class="{active:selItem&&selItem.bank_branch_id==item.bank_branch_id}">
|
||||||
|
<view class="checkbox">
|
||||||
|
<up-icon name="checkbox-mark" color="#fff"></up-icon>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex-1">{{item.bank_branch_name}}</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 bank_branch_name = defineModel('bank_branch_name', {
|
||||||
|
default: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
const selid = ref('')
|
||||||
|
|
||||||
|
function returnLabel() {
|
||||||
|
const findShop = list.value.find(v => v.bank_branch_id == modelValue.value)
|
||||||
|
if(findShop){
|
||||||
|
return findShop ? findShop.bank_branch_name : ''
|
||||||
|
}else{
|
||||||
|
return bank_branch_name.value||'请选择'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const selItem = ref(null)
|
||||||
|
|
||||||
|
function itemClick(data) {
|
||||||
|
selItem.value = data
|
||||||
|
}
|
||||||
|
|
||||||
|
function returnbank_branch_name(bank_branch_id) {
|
||||||
|
const item = list.value.find((v) => v.bank_branch_id == bank_branch_id);
|
||||||
|
return item?.bank_branch_name || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
show.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function submit() {
|
||||||
|
modelValue.value = selItem.value.bank_branch_id
|
||||||
|
bank_branch_name.value = selItem.value.bank_branch_name
|
||||||
|
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([]);
|
||||||
|
|
||||||
|
async function openPopup() {
|
||||||
|
await init()
|
||||||
|
selid.value = 'shop_' + modelValue.value
|
||||||
|
console.log('list.value',list.value);
|
||||||
|
const findShop = list.value.find(v => v.bank_branch_id == 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: () => ({
|
||||||
|
bankAliceCode: '',
|
||||||
|
cityCode: ''
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
let allList = []
|
||||||
|
async function init() {
|
||||||
|
const res = await bankBranchList(props.query);
|
||||||
|
list.value = res.data
|
||||||
|
allList = res.data
|
||||||
|
}
|
||||||
|
</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" v-if="form.userType=='1'">
|
||||||
|
<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="true">
|
||||||
|
<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>
|
||||||
378
entryManager/add/components/settlement-info.vue
Normal file
378
entryManager/add/components/settlement-info.vue
Normal file
@@ -0,0 +1,378 @@
|
|||||||
|
<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: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:bank_branch_name="form.bankBranchName"
|
||||||
|
v-model="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" @init="getRegionData"></citySelect>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
computed,
|
||||||
|
reactive,
|
||||||
|
watch,
|
||||||
|
ref,
|
||||||
|
watchEffect
|
||||||
|
} 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'
|
||||||
|
import list from 'uview-plus/components/u-list/list';
|
||||||
|
|
||||||
|
const regions = ref([])
|
||||||
|
|
||||||
|
function getRegionData(arr) {
|
||||||
|
regions.value = arr
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
wxProvinceCode.value = e.city.wxProvinceCode;
|
||||||
|
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 {
|
||||||
|
bankAliceCode: form.bankType,
|
||||||
|
cityCode: wxProvinceCode.value
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
data: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
watchEffect(() => {
|
||||||
|
if (regions.value.length && form.openAccCityId) {
|
||||||
|
if (!wxProvinceCode.value) {
|
||||||
|
const findPItem= regions.value.find(v=>v.regionId==form.openAccProvinceId)
|
||||||
|
const cityIyem=findPItem?(findPItem.children.find(v=>v.regionId==form.openAccCityId)):null
|
||||||
|
if(cityIyem){
|
||||||
|
wxProvinceCode.value =cityIyem.wxProvinceCode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
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>
|
||||||
324
entryManager/add/data.js
Normal file
324
entryManager/add/data.js
Normal file
@@ -0,0 +1,324 @@
|
|||||||
|
export const rules = {
|
||||||
|
merchantBaseInfo: {
|
||||||
|
userType: {
|
||||||
|
required: true,
|
||||||
|
errorMsg: '请选择商户类型',
|
||||||
|
},
|
||||||
|
shortName: {
|
||||||
|
required: true,
|
||||||
|
errorMsg: '请填写商户简称',
|
||||||
|
},
|
||||||
|
mccCode: {
|
||||||
|
required: true,
|
||||||
|
errorMsg: '请选择行业类目',
|
||||||
|
},
|
||||||
|
alipayAccount: {
|
||||||
|
required: true,
|
||||||
|
errorMsg: '请填写支付宝账号',
|
||||||
|
},
|
||||||
|
'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: '请填写联系人邮箱',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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>
|
||||||
258
entryManager/components/u-city-select.vue
Normal file
258
entryManager/components/u-city-select.vue
Normal file
@@ -0,0 +1,258 @@
|
|||||||
|
<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','init'],
|
||||||
|
methods: {
|
||||||
|
async getRegon(){
|
||||||
|
const res=await region()
|
||||||
|
this.provinces=res||[]
|
||||||
|
this.$emit('init',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>
|
||||||
73
entryManager/data.js
Normal file
73
entryManager/data.js
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
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': '对公借记卡',
|
||||||
|
}
|
||||||
|
// WAIT 待提交
|
||||||
|
// INIT 待处理
|
||||||
|
// AUDIT 待审核
|
||||||
|
// SIGN 待签约
|
||||||
|
// FINISH 已完成
|
||||||
|
// REJECTED 失败
|
||||||
|
|
||||||
|
export 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'
|
||||||
|
},
|
||||||
|
]
|
||||||
322
entryManager/index/index.vue
Normal file
322
entryManager/index/index.vue
Normal file
@@ -0,0 +1,322 @@
|
|||||||
|
<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,statusList
|
||||||
|
} 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'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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++
|
||||||
|
getData()
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
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>
|
||||||
2
env/config.js
vendored
2
env/config.js
vendored
@@ -30,7 +30,7 @@ const processEnv = process.env.NODE_ENV
|
|||||||
// 改变env环境
|
// 改变env环境
|
||||||
function changeEnv(envMode){
|
function changeEnv(envMode){
|
||||||
appConfig.env = allEnvMap[envMode || processEnv]
|
appConfig.env = allEnvMap[envMode || processEnv]
|
||||||
appConfig.wss = allEnvMap[envMode || processEnv].JEEPAY_BASE_URL_WSS
|
// appConfig.wss = allEnvMap[envMode || processEnv].JEEPAY_BASE_URL_WSS
|
||||||
}
|
}
|
||||||
|
|
||||||
export default { changeEnv: changeEnv }
|
export default { changeEnv: changeEnv }
|
||||||
|
|||||||
23
http/api/account/merchantRegister.js
Normal file
23
http/api/account/merchantRegister.js
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import http from "@/http/http.js";
|
||||||
|
const request = http.request;
|
||||||
|
const urlType = "account";
|
||||||
|
|
||||||
|
export function getMerchantRegister(data) {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/merchantRegister`,
|
||||||
|
method: "GET",
|
||||||
|
data: {
|
||||||
|
...data,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function addMerchantRegister(data) {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/merchantRegister`,
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
...data,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
50
http/api/account/shopInfo.js
Normal file
50
http/api/account/shopInfo.js
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
import http from "@/http/http.js";
|
||||||
|
const request = http.request;
|
||||||
|
const urlType = "account";
|
||||||
|
|
||||||
|
export function allShopList(data) {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/shopInfo`,
|
||||||
|
method: "GET",
|
||||||
|
data: {
|
||||||
|
...data,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function addShop(data) {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/shopInfo`,
|
||||||
|
method: "post",
|
||||||
|
data: {
|
||||||
|
...data,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
export function editShop(data) {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/shopInfo`,
|
||||||
|
method: "put",
|
||||||
|
data: {
|
||||||
|
...data,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
export function getShopDetail(data) {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/shopInfo/detail`,
|
||||||
|
method: "get",
|
||||||
|
data: {
|
||||||
|
...data,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
export function delShop(data) {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/shopInfo`,
|
||||||
|
method: "DELETE",
|
||||||
|
data: {
|
||||||
|
...data,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -189,3 +189,12 @@ export function shopUserFlow(data) {
|
|||||||
data
|
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,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
33
http/api/order/shopMerchant.js
Normal file
33
http/api/order/shopMerchant.js
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import http from "@/http/http.js";
|
||||||
|
const request = http.request;
|
||||||
|
const urlType = "order";
|
||||||
|
|
||||||
|
export function shopMerchant(data) {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/shopMerchant`,
|
||||||
|
method: "GET",
|
||||||
|
data: {
|
||||||
|
...data,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function editShopMerchant(data) {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/shopMerchant`,
|
||||||
|
method: "PUT",
|
||||||
|
data: {
|
||||||
|
...data,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//获取当前店铺的主店进件信息
|
||||||
|
export function getMainMerchant(data) {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/shopMerchant/getMainMerchant`,
|
||||||
|
method: "GET",
|
||||||
|
data: {
|
||||||
|
...data,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -19,15 +19,15 @@ export function getOrderPayUrl(data, urlType = 'order') {
|
|||||||
* 扫码支付
|
* 扫码支付
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function scanPay(data, urlType = 'order') {
|
// export function scanPay(data, urlType = 'order') {
|
||||||
return request({
|
// return request({
|
||||||
url: `${urlType}/pay/scanPay`,
|
// url: `${urlType}/pay/scanPay`,
|
||||||
method: "POST",
|
// method: "POST",
|
||||||
data: {
|
// data: {
|
||||||
...data
|
// ...data
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 现金支付
|
* 现金支付
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ const request = http.request
|
|||||||
* 获取商品分页
|
* 获取商品分页
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function getProductPage(data, urlType = 'product' ,showLoading) {
|
export function getProductPage(data, urlType = 'product', showLoading) {
|
||||||
return request({
|
return request({
|
||||||
url: `${urlType}/admin/product/page`,
|
url: `${urlType}/admin/product/page`,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
@@ -20,7 +20,7 @@ export function getProductPage(data, urlType = 'product' ,showLoading) {
|
|||||||
* 获取商品列表
|
* 获取商品列表
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function getProductList(data, urlType = 'product' ,showLoading) {
|
export function getProductList(data, urlType = 'product', showLoading) {
|
||||||
return request({
|
return request({
|
||||||
url: `${urlType}/admin/product/list`,
|
url: `${urlType}/admin/product/list`,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
@@ -36,7 +36,7 @@ export function getProductList(data, urlType = 'product' ,showLoading) {
|
|||||||
* 获取商品详情
|
* 获取商品详情
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function getProductDetail (id, urlType = 'product') {
|
export function getProductDetail(id, urlType = 'product') {
|
||||||
return request({
|
return request({
|
||||||
url: `${urlType}/admin/product/${id}`,
|
url: `${urlType}/admin/product/${id}`,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
@@ -73,7 +73,7 @@ export function delProduct(id, urlType = 'product') {
|
|||||||
* 商品上下架
|
* 商品上下架
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function productOnOff (data, urlType = 'product') {
|
export function productOnOff(data, urlType = 'product') {
|
||||||
return request({
|
return request({
|
||||||
url: `${urlType}/admin/product/onOff`,
|
url: `${urlType}/admin/product/onOff`,
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -87,7 +87,7 @@ export function productOnOff (data, urlType = 'product') {
|
|||||||
* 商品售罄
|
* 商品售罄
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function productMarkIsSoldOut (data, urlType = 'product') {
|
export function productMarkIsSoldOut(data, urlType = 'product') {
|
||||||
return request({
|
return request({
|
||||||
url: `${urlType}/admin/product/markIsSoldOut`,
|
url: `${urlType}/admin/product/markIsSoldOut`,
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -344,3 +344,27 @@ export function delProdGroup(id, urlType = 'product') {
|
|||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库单识别
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function stockOcr(data, urlType = 'product') {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/product/stock/ocr`,
|
||||||
|
method: "post",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ocr识别结果
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function ocrResult(data, urlType = 'product') {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/product/stock/ocrResult`,
|
||||||
|
method: "get",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
7
http/api/product/stick.js
Normal file
7
http/api/product/stick.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import http from "@/http/http.js";
|
||||||
|
const request = http.request;
|
||||||
|
const urlType = "product";
|
||||||
|
|
||||||
|
export function stickCount(file, data) {
|
||||||
|
return http.upload(`${urlType}/admin/stick/count`,data,file)
|
||||||
|
}
|
||||||
@@ -15,6 +15,17 @@ export function getShopInfo(data, urlType = 'account') {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function adminShopList(data, urlType = 'account') {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/shopInfo`,
|
||||||
|
method: "get",
|
||||||
|
data: {
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改店铺详情
|
* 修改店铺详情
|
||||||
* @returns
|
* @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/help.js
Normal file
12
http/api/system/help.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import http from "@/http/http.js";
|
||||||
|
const request = http.request;
|
||||||
|
const urlType = "system";
|
||||||
|
export function getHelp(data) {
|
||||||
|
return request({
|
||||||
|
url: urlType + '/user/getHelp',
|
||||||
|
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
|
* @returns
|
||||||
@@ -53,4 +65,3 @@ export function delVendor(id, urlType = 'product') {
|
|||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
303
http/api/ware.js
Normal file
303
http/api/ware.js
Normal file
@@ -0,0 +1,303 @@
|
|||||||
|
import http from '@/http/http.js'
|
||||||
|
const request = http.request
|
||||||
|
const ORDER_URL = 'order'
|
||||||
|
const Market_BaseUrl = 'market'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团商品-列表
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function getGbWarePage(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/ware/getGbWarePage`,
|
||||||
|
method: "GET",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团商品-新增
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function addGbWare(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/ware/addGbWare`,
|
||||||
|
method: "post",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团商品-列表
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function updateGbWareById(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/ware/updateGbWareById`,
|
||||||
|
method: "post",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团商品-修改状态
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function editOnlineStatus(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/ware/editOnlineStatus`,
|
||||||
|
method: "post",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团商品-删除
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function deleteGbWare(id) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/ware/deleteGbWare/${id}`,
|
||||||
|
method: "DELETE"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团商品:订单列表
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function gbOrderPage(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/gbOrder/page`,
|
||||||
|
method: "GET",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团商品-活动开关
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function upShopConfig(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/ware/upShopConfig`,
|
||||||
|
method: "POST",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团订单-退单/同意退单
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function agreeRefund(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/gbOrder/agreeRefund`,
|
||||||
|
method: "POST",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团订单-驳回退单
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function rejectRefund(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/gbOrder/rejectRefund`,
|
||||||
|
method: "POST",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团商品:核销
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function checkout(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/gbOrder/checkout`,
|
||||||
|
method: "POST",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团商品:拼团商品详情
|
||||||
|
* @param {Object} data
|
||||||
|
*/
|
||||||
|
export function wareDetail(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/ware/ware/detail`,
|
||||||
|
method: "get",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:添加套餐
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageAddEdit(data) {
|
||||||
|
return request({
|
||||||
|
url: `${Market_BaseUrl}/admin/package`,
|
||||||
|
method: data.id ? 'put' : 'post',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:获取套餐列表
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageGet(params) {
|
||||||
|
return request({
|
||||||
|
url: `${Market_BaseUrl}/admin/package`,
|
||||||
|
method: 'get',
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:获取套餐推广开关
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageSwitchGet() {
|
||||||
|
return request({
|
||||||
|
url: `${Market_BaseUrl}/admin/package/switch`,
|
||||||
|
method: 'get'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:修改套餐推广开关
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageSwitchPut(data) {
|
||||||
|
return request({
|
||||||
|
url: `${Market_BaseUrl}/admin/package/switch`,
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:删除套餐
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageDel(id) {
|
||||||
|
return request({
|
||||||
|
url: `${Market_BaseUrl}/admin/package/${id}`,
|
||||||
|
method: 'DELETE'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:确认删除套餐
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageSureDel(id) {
|
||||||
|
return request({
|
||||||
|
url: `${Market_BaseUrl}/admin/package/sure/${id}`,
|
||||||
|
method: 'DELETE'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:修改套餐推广开关
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageOnline(data) {
|
||||||
|
return request({
|
||||||
|
url: `${Market_BaseUrl}/admin/package/online`,
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:获取套餐推广订单列表
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageOrder(params) {
|
||||||
|
return request({
|
||||||
|
url: `${Market_BaseUrl}/admin/package/order`,
|
||||||
|
method: 'GET',
|
||||||
|
params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:订单统计
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageOrderStat(params) {
|
||||||
|
return request({
|
||||||
|
url: `${Market_BaseUrl}/admin/package/order/stat`,
|
||||||
|
method: 'GET',
|
||||||
|
params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:确认退单
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageConfirmRefund(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/ppOrder/confirmRefund`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:驳回退单
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageRejectRefund(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/ppOrder/rejectRefund`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:核销
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageCheckout(data) {
|
||||||
|
return request({
|
||||||
|
url: `${ORDER_URL}/admin/ppOrder/checkout`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐推广:获取套餐详情
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function packageDetail(data) {
|
||||||
|
return request({
|
||||||
|
url: `${Market_BaseUrl}/admin/package/detail/${data.id}`,
|
||||||
|
method: 'GET',
|
||||||
|
data: {
|
||||||
|
shopId: data.shopId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
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 go from "@/commons/utils/go.js";
|
||||||
import { reject } from "lodash";
|
import { reject } from "lodash";
|
||||||
// 设置node环境
|
// 设置node环境
|
||||||
envConfig.changeEnv(storageManage.env('production')) //正式
|
// envConfig.changeEnv(storageManage.env('production')) //正式
|
||||||
// envConfig.changeEnv(storageManage.env("development")); //测试
|
// envConfig.changeEnv(storageManage.env("development")); //测试
|
||||||
|
|
||||||
// 测试服
|
let baseUrl = appConfig.returnBaseUrl({apiType:'java'});
|
||||||
// #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
|
|
||||||
|
|
||||||
const loadingShowTime = 200;
|
const loadingShowTime = 200;
|
||||||
|
|
||||||
function getHeader() {
|
function getHeader() {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// const baseURL : string = 'https://newblockwlx.sxczgkj.cn/index.php/api/'
|
// const baseURL : string = 'https://newblockwlx.sxczgkj.cn/index.php/api/'
|
||||||
let baseURL: string = "http://192.168.1.42:8787/api/";
|
let baseURL: string = "http://192.168.1.42:8787/api/";
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
baseURL = "/phpapi/api/";
|
baseURL = "/prodPhpApi/api/";
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
import go from "@/commons/utils/go.js";
|
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 infoBox from "@/commons/utils/infoBox.js"
|
||||||
import go from '@/commons/utils/go.js';
|
import go from '@/commons/utils/go.js';
|
||||||
import { reject } from 'lodash';
|
import { reject } from 'lodash';
|
||||||
// 设置node环境
|
let baseUrl = appConfig.returnBaseUrl({apiType:'java'});
|
||||||
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
|
|
||||||
|
|
||||||
const loadingShowTime = 200
|
const loadingShowTime = 200
|
||||||
|
|
||||||
function getHeader(){
|
function getHeader(){
|
||||||
|
|||||||
852
lib/coupon.ts
852
lib/coupon.ts
@@ -1,852 +0,0 @@
|
|||||||
import { BigNumber } from "bignumber.js";
|
|
||||||
import _ from "lodash";
|
|
||||||
|
|
||||||
import {
|
|
||||||
ShopInfo,
|
|
||||||
couponCalcParams,
|
|
||||||
BaseCartItem,
|
|
||||||
TimeLimitDiscountConfig,
|
|
||||||
CanDikouGoodsArrArgs,
|
|
||||||
Coupon,
|
|
||||||
ShopUserInfo,
|
|
||||||
GoodsType,
|
|
||||||
BackendCoupon,
|
|
||||||
ExchangeCalculationResult,
|
|
||||||
PointDeductionRule,
|
|
||||||
OrderCostSummary,
|
|
||||||
} from "./types";
|
|
||||||
|
|
||||||
import { getCompatibleFieldValue } from "./utils";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回商品单价
|
|
||||||
* @param goods 商品
|
|
||||||
* @param user 用户信息
|
|
||||||
* @param {Object} shopInfo
|
|
||||||
*/
|
|
||||||
export function returnGoodsPrice(
|
|
||||||
goods: BaseCartItem,
|
|
||||||
user: ShopUserInfo,
|
|
||||||
shopInfo: ShopInfo,
|
|
||||||
limitTimeDiscount: TimeLimitDiscountConfig | null | undefined
|
|
||||||
) {
|
|
||||||
if (!goods) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
//是否可以使用会员价
|
|
||||||
const canUseVipPrice =
|
|
||||||
user &&
|
|
||||||
user.isVip &&
|
|
||||||
user.isMemberPrice &&
|
|
||||||
goods.memberPrice * 1 > 0 &&
|
|
||||||
shopInfo &&
|
|
||||||
shopInfo.isMemberPrice;
|
|
||||||
// 商家改价
|
|
||||||
if (goods.discount_sale_amount && goods.discount_sale_amount * 1 > 0) {
|
|
||||||
return goods.salePrice;
|
|
||||||
}
|
|
||||||
// 限时折扣
|
|
||||||
if (limitTimeDiscount && limitTimeDiscount.id) {
|
|
||||||
//优先使用
|
|
||||||
// 兼容 isTimeDiscount/is_time_discount(这里顺便处理该字段的命名兼容)
|
|
||||||
const isTimeDiscount = getCompatibleFieldValue(
|
|
||||||
goods,
|
|
||||||
"isTimeDiscount",
|
|
||||||
"is_time_discount"
|
|
||||||
);
|
|
||||||
if (isTimeDiscount) {
|
|
||||||
return new BigNumber(goods.salePrice)
|
|
||||||
.times(limitTimeDiscount.discountRate / 100)
|
|
||||||
.decimalPlaces(2, BigNumber.ROUND_UP)
|
|
||||||
.toNumber();
|
|
||||||
}
|
|
||||||
const canUseFoods = limitTimeDiscount.foods.split(",");
|
|
||||||
const canUseLimit =
|
|
||||||
limitTimeDiscount.foodType == 1 ||
|
|
||||||
canUseFoods.includes(`${goods.productId}`);
|
|
||||||
if (canUseLimit && limitTimeDiscount.discountPriority == "limit-time") {
|
|
||||||
return new BigNumber(goods.salePrice)
|
|
||||||
.times(limitTimeDiscount.discountRate / 100)
|
|
||||||
.decimalPlaces(2, BigNumber.ROUND_UP)
|
|
||||||
.toNumber();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (canUseLimit && limitTimeDiscount.discountPriority == "vip-price") {
|
|
||||||
if (canUseVipPrice) {
|
|
||||||
return goods.memberPrice;
|
|
||||||
} else {
|
|
||||||
return new BigNumber(goods.salePrice)
|
|
||||||
.times(limitTimeDiscount.discountRate / 100)
|
|
||||||
.decimalPlaces(2, BigNumber.ROUND_UP)
|
|
||||||
.toNumber();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (canUseVipPrice) {
|
|
||||||
return goods.memberPrice;
|
|
||||||
}
|
|
||||||
return goods.salePrice;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回商品分组
|
|
||||||
* @param arr 商品列表
|
|
||||||
*/
|
|
||||||
export function returnGoodsGroupMap(arr: BaseCartItem[]) {
|
|
||||||
let map: { [key: string]: BaseCartItem[] } = {};
|
|
||||||
arr.forEach((v) => {
|
|
||||||
const key = v.productId + "_" + v.skuId;
|
|
||||||
if (!map[key]) {
|
|
||||||
map[key] = [];
|
|
||||||
}
|
|
||||||
map[key].push(v);
|
|
||||||
});
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface CouponTypes {
|
|
||||||
1: "满减券";
|
|
||||||
2: "商品券";
|
|
||||||
3: "折扣券";
|
|
||||||
4: "第二件半价券";
|
|
||||||
5: "消费送券";
|
|
||||||
6: "买一送一券";
|
|
||||||
7: "固定价格券";
|
|
||||||
8: "免配送费券";
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 优惠券类型:1-满减券,2-商品兑换券,3-折扣券,4-第二件半价券,5-消费送券,6-买一送一券,7-固定价格券,8-免配送费券
|
|
||||||
* @param coupon
|
|
||||||
*/
|
|
||||||
export function returnCoupType(coupon: Coupon) {
|
|
||||||
const couponTypes: CouponTypes = {
|
|
||||||
1: "满减券",
|
|
||||||
2: "商品券",
|
|
||||||
3: "折扣券",
|
|
||||||
4: "第二件半价券",
|
|
||||||
5: "消费送券",
|
|
||||||
6: "买一送一券",
|
|
||||||
7: "固定价格券",
|
|
||||||
8: "免配送费券",
|
|
||||||
};
|
|
||||||
return couponTypes[coupon.type as keyof CouponTypes] || "未知类型";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回商品券抵扣后的商品列表
|
|
||||||
* @param canDikouGoodsArr 可抵扣商品列表
|
|
||||||
* @param selCoupon 已选择的优惠券列表
|
|
||||||
* @param user 用户信息
|
|
||||||
*/
|
|
||||||
export function returnCanDikouGoodsArr(args: CanDikouGoodsArrArgs) {
|
|
||||||
const { canDikouGoodsArr, selCoupon, user, shopInfo, limitTimeDiscount } =
|
|
||||||
args;
|
|
||||||
const types = [2, 4, 6];
|
|
||||||
// 收集已抵扣商品并关联对应的优惠券类型
|
|
||||||
const goodsCouponGoods = selCoupon
|
|
||||||
.filter((v) => types.includes(v.type))
|
|
||||||
.reduce((prev: BaseCartItem[], cur) => {
|
|
||||||
// 给每个抵扣商品添加所属优惠券类型
|
|
||||||
if (cur && cur.discount) {
|
|
||||||
const goodsWithType = cur.discount.hasDiscountGoodsArr.map((goods) => ({
|
|
||||||
...goods,
|
|
||||||
couponType: cur.type, // 记录该商品是被哪种类型的优惠券抵扣的
|
|
||||||
}));
|
|
||||||
prev.push(...goodsWithType);
|
|
||||||
}
|
|
||||||
return prev;
|
|
||||||
}, []);
|
|
||||||
const arr = _.cloneDeep(canDikouGoodsArr)
|
|
||||||
.map((v) => {
|
|
||||||
const findCart = goodsCouponGoods.find((carts) => carts.id == v.id);
|
|
||||||
if (findCart) {
|
|
||||||
// 根据优惠券类型判断扣减数量
|
|
||||||
if ([4, 6].includes(findCart.couponType ?? 0)) {
|
|
||||||
// 类型4(第二件半价)或6(买一送一),数量减2
|
|
||||||
if (v.num) {
|
|
||||||
v.num -= 2;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 其他类型(如类型2商品券),按原逻辑扣减对应数量
|
|
||||||
if (v.num) {
|
|
||||||
v.num -= findCart.num ?? 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return v;
|
|
||||||
})
|
|
||||||
.filter((v) => {
|
|
||||||
const canUseNum = (v.num ?? 0) - (v.returnNum || 0);
|
|
||||||
// 兼容 is_temporary/isTemporary 和 is_gift/isGift
|
|
||||||
const isTemporary = getCompatibleFieldValue(
|
|
||||||
v,
|
|
||||||
"isTemporary",
|
|
||||||
"is_temporary"
|
|
||||||
);
|
|
||||||
const isGift = getCompatibleFieldValue(v, "isGift", "is_gift");
|
|
||||||
|
|
||||||
if (canUseNum <= 0 || isTemporary || isGift) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}); // 过滤掉数量<=0的商品,赠菜,临时菜
|
|
||||||
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回商品是否享用了会员价/会员折扣
|
|
||||||
* @param {*} goods
|
|
||||||
*/
|
|
||||||
function returnGoodsIsUseVipPrice(
|
|
||||||
shopInfo: ShopInfo,
|
|
||||||
user: ShopUserInfo,
|
|
||||||
goods: BaseCartItem
|
|
||||||
) {
|
|
||||||
// 兼容 isTimeDiscount/is_time_discount
|
|
||||||
const isTimeDiscount = getCompatibleFieldValue(
|
|
||||||
goods,
|
|
||||||
"isTimeDiscount",
|
|
||||||
"is_time_discount"
|
|
||||||
);
|
|
||||||
if (isTimeDiscount) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (shopInfo.isMemberPrice != 1 || user.isVip != 1) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (shopInfo.isMemberPrice == 1 && user.isVip == 1) {
|
|
||||||
if (goods.memberPrice <= 0) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回可以计算抵扣金额的商品列表
|
|
||||||
*/
|
|
||||||
function returnCanCalcGoodsList(
|
|
||||||
canCalcGoodsArr: BaseCartItem[],
|
|
||||||
coupon: Coupon,
|
|
||||||
shopInfo: ShopInfo,
|
|
||||||
user: ShopUserInfo
|
|
||||||
) {
|
|
||||||
return canCalcGoodsArr.filter((goods) => {
|
|
||||||
// 兼容 isTimeDiscount/is_time_discount
|
|
||||||
const isTimeDiscount = getCompatibleFieldValue(
|
|
||||||
goods,
|
|
||||||
"isTimeDiscount",
|
|
||||||
"is_time_discount"
|
|
||||||
);
|
|
||||||
if (!coupon.discountShare && isTimeDiscount) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
!coupon.vipPriceShare &&
|
|
||||||
returnGoodsIsUseVipPrice(shopInfo, user, goods)
|
|
||||||
) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 判断优惠券是否可使用,并返回不可用原因
|
|
||||||
*
|
|
||||||
* @param {Object} args - 函数参数集合
|
|
||||||
* @param {Array} args.canDikouGoodsArr - 可参与抵扣的商品列表
|
|
||||||
* @param {Object} args.coupon - 优惠券信息对象
|
|
||||||
* @param {boolean} args.coupon.use - 优惠券是否启用
|
|
||||||
* @param {Array} args.coupon.useFoods - 优惠券适用的商品ID列表
|
|
||||||
* @param {number} args.coupon.fullAmount - 优惠券使用门槛金额
|
|
||||||
* @param {number} args.coupon.type - 优惠券类型
|
|
||||||
* @param {number} args.goodsOrderPrice - 订单中所有商品的总金额
|
|
||||||
* @param {Object} args.user - 用户信息对象
|
|
||||||
* @param {Object} args.selCoupon - 已经选择的优惠券信息对象
|
|
||||||
* @param {Object} args.shopInfo
|
|
||||||
* @param {boolean} args.limitTimeDiscount - 限时折扣
|
|
||||||
* @returns {Object} - { canUse: boolean, reason: string } 可用状态及不可用原因
|
|
||||||
*/
|
|
||||||
export function returnCouponCanUse(args: couponCalcParams) {
|
|
||||||
let {
|
|
||||||
canDikouGoodsArr,
|
|
||||||
coupon,
|
|
||||||
goodsOrderPrice,
|
|
||||||
user,
|
|
||||||
selCoupon,
|
|
||||||
shopInfo,
|
|
||||||
isMemberPrice,
|
|
||||||
limitTimeDiscount,
|
|
||||||
} = args;
|
|
||||||
// 优惠券未启用
|
|
||||||
if (!coupon.use) {
|
|
||||||
return {
|
|
||||||
canUse: false,
|
|
||||||
reason: coupon.noUseRestrictions || "不在可用时间段内",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
limitTimeDiscount &&
|
|
||||||
limitTimeDiscount.id &&
|
|
||||||
limitTimeDiscount.foodType == 1 &&
|
|
||||||
!coupon.discountShare
|
|
||||||
) {
|
|
||||||
return {
|
|
||||||
canUse: false,
|
|
||||||
reason: coupon.noUseRestrictions || "不可与限时折扣同享",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// 计算门槛金额
|
|
||||||
let fullAmount = goodsOrderPrice;
|
|
||||||
canDikouGoodsArr = returnCanDikouGoodsArr(args);
|
|
||||||
//优惠券指定门槛商品列表
|
|
||||||
let canCalcGoodsArr = [...canDikouGoodsArr];
|
|
||||||
//部分商品参与门槛计算
|
|
||||||
if (coupon.thresholdFoods.length) {
|
|
||||||
canCalcGoodsArr = canDikouGoodsArr.filter((v) => {
|
|
||||||
return coupon.thresholdFoods.find((food) => food.id == v.productId);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
canCalcGoodsArr = returnCanCalcGoodsList(
|
|
||||||
canCalcGoodsArr,
|
|
||||||
coupon,
|
|
||||||
shopInfo,
|
|
||||||
user
|
|
||||||
);
|
|
||||||
|
|
||||||
fullAmount = canCalcGoodsArr.reduce((pre, cur) => {
|
|
||||||
return (
|
|
||||||
pre +
|
|
||||||
returnGoodsPrice(cur, user, shopInfo, limitTimeDiscount) * (cur.num || 0)
|
|
||||||
);
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
// 是否全部商品可用
|
|
||||||
const isDikouAll = coupon.useFoods.length === 0;
|
|
||||||
// 订单可用商品列表
|
|
||||||
let canUseGoodsArr: BaseCartItem[] = [];
|
|
||||||
if (!isDikouAll) {
|
|
||||||
canUseGoodsArr = canDikouGoodsArr.filter((v) => {
|
|
||||||
return coupon.useFoods.find((food) => food.id == v.productId);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// if (user.isVip && !coupon.vipPriceShare) {
|
|
||||||
// return {
|
|
||||||
// canUse: false,
|
|
||||||
// reason: "非会员可用",
|
|
||||||
// };
|
|
||||||
// }
|
|
||||||
if (selCoupon.length > 0 && !selCoupon[0].otherCouponShare) {
|
|
||||||
return {
|
|
||||||
canUse: false,
|
|
||||||
reason: "当前选中的券不可与其他券同享",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (selCoupon.length > 0 && !coupon.otherCouponShare) {
|
|
||||||
return {
|
|
||||||
canUse: false,
|
|
||||||
reason: "当前选中的券不可与其他券同享",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// 满减券和折扣券计算门槛金额是否满足
|
|
||||||
if ([1, 3].includes(coupon.type)) {
|
|
||||||
if (canCalcGoodsArr.length <= 0) {
|
|
||||||
return {
|
|
||||||
canUse: false,
|
|
||||||
reason: "没有可参与计算门槛的商品",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
// 不满足门槛金额
|
|
||||||
if (fullAmount < (coupon.fullAmount || 0)) {
|
|
||||||
return {
|
|
||||||
canUse: false,
|
|
||||||
reason: `满${coupon.fullAmount}元可用,当前可参与金额${fullAmount}元`,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 商品兑换券,第二件半价和买一送一判断是否有可用商品
|
|
||||||
if ([2, 4, 5].includes(coupon.type)) {
|
|
||||||
// 没有符合条件的商品
|
|
||||||
if (isDikouAll && canDikouGoodsArr.length === 0) {
|
|
||||||
return {
|
|
||||||
canUse: false,
|
|
||||||
reason: "没有符合条件的商品",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (!isDikouAll && canUseGoodsArr.length === 0) {
|
|
||||||
return {
|
|
||||||
canUse: false,
|
|
||||||
reason: "没有符合条件的商品",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (coupon.type == 2) {
|
|
||||||
if (canCalcGoodsArr.length <= 0) {
|
|
||||||
return {
|
|
||||||
canUse: false,
|
|
||||||
reason: "没有符合计算门槛条件的商品",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (fullAmount < (coupon.fullAmount || 0)) {
|
|
||||||
return {
|
|
||||||
canUse: false,
|
|
||||||
reason: `满${coupon.fullAmount}元可用,当前可参与金额${fullAmount}元`,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//商品兑换券是否达到门槛金额
|
|
||||||
if (coupon.type == 2 && goodsOrderPrice < (coupon.fullAmount || 0)) {
|
|
||||||
return {
|
|
||||||
canUse: false,
|
|
||||||
reason: `满${coupon.fullAmount}元可用,当前可参与金额${fullAmount}元`,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// 买一送一券特殊验证
|
|
||||||
if (coupon.type === 6) {
|
|
||||||
let canUse = false;
|
|
||||||
if (isDikouAll) {
|
|
||||||
canUse = canDikouGoodsArr.some((v) => (v.num || 0) >= 2);
|
|
||||||
} else if (canUseGoodsArr.length > 0) {
|
|
||||||
canUse = canUseGoodsArr.some((v) => (v.num || 0) >= 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!canUse) {
|
|
||||||
return {
|
|
||||||
canUse: false,
|
|
||||||
reason: "需要购买至少2件相同的商品才能使用",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 第二件半价券特殊验证
|
|
||||||
if (coupon.type === 4) {
|
|
||||||
let canUse = false;
|
|
||||||
if (isDikouAll) {
|
|
||||||
canUse = canDikouGoodsArr.some((v) => (v.num || 0) >= 2);
|
|
||||||
} else if (canUseGoodsArr.length > 0) {
|
|
||||||
canUse = canUseGoodsArr.some((v) => (v.num || 0) >= 2);
|
|
||||||
}
|
|
||||||
if (!canUse) {
|
|
||||||
return {
|
|
||||||
canUse: false,
|
|
||||||
reason: "需要购买至少2件相同的商品才能使用",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 所有条件都满足
|
|
||||||
return {
|
|
||||||
canUse: true,
|
|
||||||
reason: "",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 计算抵扣商品金额
|
|
||||||
* @param discountGoodsArr 可抵扣商品列表
|
|
||||||
* @param discountNum 抵扣数量
|
|
||||||
* @param user 用户信息
|
|
||||||
* @param {Object} shopInfo 店铺信息
|
|
||||||
*/
|
|
||||||
export function calcDiscountGoodsArrPrice(
|
|
||||||
discountGoodsArr: BaseCartItem[],
|
|
||||||
discountNum: number,
|
|
||||||
user: ShopUserInfo,
|
|
||||||
shopInfo: ShopInfo,
|
|
||||||
limitTimeDiscount?: TimeLimitDiscountConfig | null | undefined
|
|
||||||
) {
|
|
||||||
let hasCountNum = 0;
|
|
||||||
let discountPrice = 0;
|
|
||||||
let hasDiscountGoodsArr:BaseCartItem[] = [];
|
|
||||||
|
|
||||||
for (let i = 0; i < discountGoodsArr.length; i++) {
|
|
||||||
if (hasCountNum >= discountNum) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
const goods = discountGoodsArr[i];
|
|
||||||
const shengyuNum = discountNum - hasCountNum;
|
|
||||||
const num = Math.min(goods.num || 0, shengyuNum);
|
|
||||||
const realPrice = returnGoodsPrice(
|
|
||||||
goods,
|
|
||||||
user,
|
|
||||||
shopInfo,
|
|
||||||
limitTimeDiscount
|
|
||||||
);
|
|
||||||
|
|
||||||
discountPrice += realPrice * num;
|
|
||||||
|
|
||||||
hasCountNum += num;
|
|
||||||
if(goods){
|
|
||||||
hasDiscountGoodsArr.push({
|
|
||||||
...goods,
|
|
||||||
num,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
discountPrice,
|
|
||||||
hasDiscountGoodsArr,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 计算优惠券抵扣金额
|
|
||||||
* @param arr 可抵扣商品列表
|
|
||||||
* @param coupon 优惠券
|
|
||||||
* @param user 用户信息
|
|
||||||
* @param goodsOrderPrice 商品订单金额
|
|
||||||
* @param selCoupon 已选择的优惠券列表
|
|
||||||
* @param shopInfo 店铺信息
|
|
||||||
* @param limitTimeDiscount 限时折扣
|
|
||||||
*/
|
|
||||||
export function returnCouponDiscount(
|
|
||||||
arr: BaseCartItem[],
|
|
||||||
coupon: Coupon,
|
|
||||||
user: ShopUserInfo,
|
|
||||||
goodsOrderPrice: number,
|
|
||||||
selCoupon: Coupon[],
|
|
||||||
shopInfo: ShopInfo,
|
|
||||||
limitTimeDiscount?: TimeLimitDiscountConfig | null | undefined
|
|
||||||
) {
|
|
||||||
arr = returnCanDikouGoods(arr, user, shopInfo, limitTimeDiscount);
|
|
||||||
const canDikouGoodsArr = returnCanDikouGoodsArr({
|
|
||||||
canDikouGoodsArr: arr,
|
|
||||||
selCoupon,
|
|
||||||
user,
|
|
||||||
shopInfo,
|
|
||||||
limitTimeDiscount,
|
|
||||||
});
|
|
||||||
if (coupon.type == 2) {
|
|
||||||
return returnCouponProductDiscount(
|
|
||||||
canDikouGoodsArr,
|
|
||||||
coupon,
|
|
||||||
user,
|
|
||||||
shopInfo,
|
|
||||||
limitTimeDiscount
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (coupon.type == 6) {
|
|
||||||
const result = returnCouponBuyOneGiveOneDiscount(
|
|
||||||
canDikouGoodsArr,
|
|
||||||
coupon,
|
|
||||||
user,
|
|
||||||
shopInfo,
|
|
||||||
limitTimeDiscount
|
|
||||||
);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
if (coupon.type == 4) {
|
|
||||||
return returnSecoendDiscount(
|
|
||||||
canDikouGoodsArr,
|
|
||||||
coupon,
|
|
||||||
user,
|
|
||||||
shopInfo,
|
|
||||||
limitTimeDiscount
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (coupon.type == 3) {
|
|
||||||
return returnCouponZhekouDiscount(
|
|
||||||
canDikouGoodsArr,
|
|
||||||
coupon,
|
|
||||||
user,
|
|
||||||
goodsOrderPrice,
|
|
||||||
selCoupon,
|
|
||||||
limitTimeDiscount
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 折扣券抵扣金额
|
|
||||||
* @param canDikouGoodsArr 可抵扣商品列表
|
|
||||||
* @param coupon 优惠券
|
|
||||||
* @param user 用户信息
|
|
||||||
* @param goodsOrderPrice 商品订单金额
|
|
||||||
* @param selCoupon 已选择的优惠券列表
|
|
||||||
* @param limitTimeDiscount 限时折扣
|
|
||||||
*/
|
|
||||||
export function returnCouponZhekouDiscount(
|
|
||||||
canDikouGoodsArr: BaseCartItem[],
|
|
||||||
coupon: Coupon,
|
|
||||||
user: ShopUserInfo,
|
|
||||||
goodsOrderPrice: number,
|
|
||||||
selCoupon: Coupon[],
|
|
||||||
limitTimeDiscount?: TimeLimitDiscountConfig | null | undefined
|
|
||||||
) {
|
|
||||||
let { discountRate, maxDiscountAmount } = coupon;
|
|
||||||
maxDiscountAmount = maxDiscountAmount || 0;
|
|
||||||
// 计算商品优惠券折扣总和,使用BigNumber避免精度问题
|
|
||||||
const goodsCouponDiscount = selCoupon
|
|
||||||
.filter((v) => v.type == 2)
|
|
||||||
.reduce((prve, cur) => {
|
|
||||||
return new BigNumber(prve).plus(
|
|
||||||
new BigNumber(cur?.discount?.discountPrice || 0)
|
|
||||||
);
|
|
||||||
}, new BigNumber(0));
|
|
||||||
|
|
||||||
// 将商品订单价格转换为BigNumber并减去优惠券折扣
|
|
||||||
const adjustedGoodsOrderPrice = new BigNumber(goodsOrderPrice).minus(
|
|
||||||
goodsCouponDiscount
|
|
||||||
);
|
|
||||||
|
|
||||||
// 计算优惠比例:(100 - 折扣率) / 100
|
|
||||||
const discountAmountRatio = new BigNumber(100)
|
|
||||||
.minus(discountRate || 0)
|
|
||||||
.dividedBy(100);
|
|
||||||
|
|
||||||
// 计算折扣金额:调整后的商品订单金额 × 优惠比例
|
|
||||||
let discountPrice = adjustedGoodsOrderPrice
|
|
||||||
.times(discountAmountRatio)
|
|
||||||
.decimalPlaces(2, BigNumber.ROUND_FLOOR)
|
|
||||||
.toNumber();
|
|
||||||
|
|
||||||
// 应用最大折扣金额限制
|
|
||||||
if (maxDiscountAmount !== 0) {
|
|
||||||
discountPrice =
|
|
||||||
discountPrice >= maxDiscountAmount ? maxDiscountAmount : discountPrice;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
discountPrice, // 折扣抵扣金额(即优惠的金额)
|
|
||||||
hasDiscountGoodsArr: [],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品券抵扣金额
|
|
||||||
* @param canDikouGoodsArr 可抵扣商品列表
|
|
||||||
* @param coupon 优惠券
|
|
||||||
* @param user 用户信息
|
|
||||||
* @param shopInfo 店铺信息
|
|
||||||
*/
|
|
||||||
export function returnCouponProductDiscount(
|
|
||||||
canDikouGoodsArr: BaseCartItem[],
|
|
||||||
coupon: Coupon,
|
|
||||||
user: ShopUserInfo,
|
|
||||||
shopInfo: ShopInfo,
|
|
||||||
limitTimeDiscount?: TimeLimitDiscountConfig | null | undefined
|
|
||||||
) {
|
|
||||||
let { useFoods, discountNum, useRule } = coupon;
|
|
||||||
discountNum = discountNum || 0;
|
|
||||||
//抵扣商品数组
|
|
||||||
let discountGoodsArr:BaseCartItem[] = [];
|
|
||||||
|
|
||||||
//抵扣全部商品
|
|
||||||
if (useFoods.length === 0) {
|
|
||||||
if (useRule == "price_asc") {
|
|
||||||
discountGoodsArr = canDikouGoodsArr.slice(discountNum * -1).reverse();
|
|
||||||
} else {
|
|
||||||
discountGoodsArr = canDikouGoodsArr.slice(0, discountNum);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//抵扣选中商品
|
|
||||||
const discountSelGoodsArr = canDikouGoodsArr.filter((v) =>
|
|
||||||
useFoods.find((food) => food.id == v.productId)
|
|
||||||
);
|
|
||||||
if (useRule == "price_asc") {
|
|
||||||
discountGoodsArr = discountSelGoodsArr.slice(discountNum * -1).reverse();
|
|
||||||
} else {
|
|
||||||
discountGoodsArr = discountSelGoodsArr.slice(0, discountNum);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = calcDiscountGoodsArrPrice(
|
|
||||||
discountGoodsArr,
|
|
||||||
discountNum,
|
|
||||||
user,
|
|
||||||
shopInfo,
|
|
||||||
limitTimeDiscount
|
|
||||||
);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回买一送一券抵扣详情
|
|
||||||
* @param canDikouGoodsArr 可抵扣商品列表
|
|
||||||
* @param coupon 优惠券
|
|
||||||
* @param user 用户信息
|
|
||||||
* @param shopInfo 店铺信息
|
|
||||||
*/
|
|
||||||
function returnCouponBuyOneGiveOneDiscount(
|
|
||||||
canDikouGoodsArr: BaseCartItem[],
|
|
||||||
coupon: Coupon,
|
|
||||||
user: ShopUserInfo,
|
|
||||||
shopInfo: ShopInfo,
|
|
||||||
limitTimeDiscount?: TimeLimitDiscountConfig | null | undefined
|
|
||||||
) {
|
|
||||||
const { useFoods, useRule } = coupon;
|
|
||||||
//抵扣商品
|
|
||||||
let discountGoods:BaseCartItem | undefined = undefined;
|
|
||||||
//符合买一送一条件的商品(数量>=2 + 非临时/非赠品)
|
|
||||||
const canUseGoods = canDikouGoodsArr.filter((v) => {
|
|
||||||
const isTemporary = getCompatibleFieldValue(
|
|
||||||
v,
|
|
||||||
"isTemporary",
|
|
||||||
"is_temporary"
|
|
||||||
);
|
|
||||||
const isGift = getCompatibleFieldValue(v, "isGift", "is_gift");
|
|
||||||
return (v.num || 0) >= 2 && !isTemporary && !isGift;
|
|
||||||
});
|
|
||||||
//抵扣全部商品
|
|
||||||
if (useFoods.length === 0) {
|
|
||||||
if (useRule == "price_asc") {
|
|
||||||
discountGoods = canUseGoods[canUseGoods.length - 1];
|
|
||||||
} else {
|
|
||||||
discountGoods = canUseGoods[0];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//符合抵扣条件的商品
|
|
||||||
const canUseGoods1 = canUseGoods.filter((v) =>
|
|
||||||
useFoods.find((food) => food.id == v.productId)
|
|
||||||
);
|
|
||||||
if (useRule == "price_asc") {
|
|
||||||
discountGoods = canUseGoods1[canUseGoods1.length - 1];
|
|
||||||
} else {
|
|
||||||
discountGoods = canUseGoods1[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let discountPrice = 0;
|
|
||||||
let hasDiscountGoodsArr: BaseCartItem[] = [];
|
|
||||||
if (discountGoods) {
|
|
||||||
discountPrice = returnGoodsPrice(
|
|
||||||
discountGoods,
|
|
||||||
user,
|
|
||||||
shopInfo,
|
|
||||||
limitTimeDiscount
|
|
||||||
);
|
|
||||||
hasDiscountGoodsArr = [discountGoods];
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
discountPrice: discountPrice <= 0 ? 0 : discountPrice,
|
|
||||||
hasDiscountGoodsArr,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回第二件半价券抵扣详情
|
|
||||||
* @param canDikouGoodsArr 可抵扣商品列表
|
|
||||||
* @param coupon 优惠券
|
|
||||||
* @param user 用户信息
|
|
||||||
* @param shopInfo 店铺信息
|
|
||||||
*/
|
|
||||||
function returnSecoendDiscount(
|
|
||||||
canDikouGoodsArr: BaseCartItem[],
|
|
||||||
coupon: Coupon,
|
|
||||||
user: ShopUserInfo,
|
|
||||||
shopInfo: ShopInfo,
|
|
||||||
limitTimeDiscount?: TimeLimitDiscountConfig | null | undefined
|
|
||||||
) {
|
|
||||||
const { useFoods, useRule } = coupon;
|
|
||||||
//抵扣商品
|
|
||||||
let discountGoods:BaseCartItem | undefined = undefined;
|
|
||||||
//符合条件的商品(数量>=2 + 非临时/非赠品)
|
|
||||||
const canUseGoods = canDikouGoodsArr.filter((v) => {
|
|
||||||
const isTemporary = getCompatibleFieldValue(
|
|
||||||
v,
|
|
||||||
"isTemporary",
|
|
||||||
"is_temporary"
|
|
||||||
);
|
|
||||||
const isGift = getCompatibleFieldValue(v, "isGift", "is_gift");
|
|
||||||
return (v.num || 0) >= 2 && !isTemporary && !isGift;
|
|
||||||
});
|
|
||||||
//抵扣全部商品
|
|
||||||
if (useFoods.length === 0) {
|
|
||||||
if (useRule == "price_asc") {
|
|
||||||
discountGoods = canUseGoods[canUseGoods.length - 1];
|
|
||||||
} else {
|
|
||||||
discountGoods = canUseGoods[0];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//符合抵扣条件的商品
|
|
||||||
const canUseGoods1 = canUseGoods.filter((v) =>
|
|
||||||
useFoods.find((food) => food.id == v.productId)
|
|
||||||
);
|
|
||||||
if (useRule == "price_asc") {
|
|
||||||
discountGoods = canUseGoods1[canUseGoods1.length - 1];
|
|
||||||
} else {
|
|
||||||
discountGoods = canUseGoods1[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let discountPrice = 0;
|
|
||||||
let hasDiscountGoodsArr: BaseCartItem[] = [];
|
|
||||||
if (discountGoods) {
|
|
||||||
discountPrice = returnGoodsPrice(
|
|
||||||
discountGoods,
|
|
||||||
user,
|
|
||||||
shopInfo,
|
|
||||||
limitTimeDiscount
|
|
||||||
);
|
|
||||||
hasDiscountGoodsArr = [discountGoods];
|
|
||||||
}
|
|
||||||
//返回半价价格
|
|
||||||
return {
|
|
||||||
discountPrice:
|
|
||||||
discountPrice <= 0
|
|
||||||
? 0
|
|
||||||
: new BigNumber(discountPrice).dividedBy(2).toNumber(),
|
|
||||||
hasDiscountGoodsArr,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回可以抵扣优惠券的商品列表,过滤掉赠品、临时商品,价格从高到低排序
|
|
||||||
* @param arr 商品列表
|
|
||||||
* @param user 用户信息
|
|
||||||
* @param shopInfo 店铺信息
|
|
||||||
* @param limitTimeDiscount 限时折扣
|
|
||||||
*/
|
|
||||||
export function returnCanDikouGoods(
|
|
||||||
arr: BaseCartItem[],
|
|
||||||
user: ShopUserInfo,
|
|
||||||
shopInfo: ShopInfo,
|
|
||||||
limitTimeDiscount?: TimeLimitDiscountConfig | null | undefined
|
|
||||||
) {
|
|
||||||
const result = arr
|
|
||||||
.filter((v) => {
|
|
||||||
// 兼容 is_temporary/isTemporary 和 is_gift/isGift
|
|
||||||
const isTemporary = getCompatibleFieldValue(
|
|
||||||
v,
|
|
||||||
"isTemporary",
|
|
||||||
"is_temporary"
|
|
||||||
);
|
|
||||||
const isGift = getCompatibleFieldValue(v, "isGift", "is_gift");
|
|
||||||
return !isTemporary && !isGift;
|
|
||||||
})
|
|
||||||
.filter((v) => {
|
|
||||||
return (v.num || 0) > 0;
|
|
||||||
})
|
|
||||||
.sort((a, b) => {
|
|
||||||
return (
|
|
||||||
returnGoodsPrice(b, user, shopInfo, limitTimeDiscount) -
|
|
||||||
returnGoodsPrice(a, user, shopInfo, limitTimeDiscount)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const utils = {
|
|
||||||
returnGoodsPrice,
|
|
||||||
returnGoodsGroupMap,
|
|
||||||
returnCoupType,
|
|
||||||
returnCanDikouGoods,
|
|
||||||
returnCanDikouGoodsArr,
|
|
||||||
returnCouponCanUse,
|
|
||||||
calcDiscountGoodsArrPrice,
|
|
||||||
returnCouponDiscount,
|
|
||||||
returnCouponProductDiscount,
|
|
||||||
returnCouponZhekouDiscount,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default utils;
|
|
||||||
File diff suppressed because it is too large
Load Diff
1382
lib/goods.ts
1382
lib/goods.ts
File diff suppressed because it is too large
Load Diff
11
lib/index.ts
11
lib/index.ts
@@ -1,11 +0,0 @@
|
|||||||
export * from "./types";
|
|
||||||
import OrderPriceCalculator from "./goods";
|
|
||||||
import couponUtils from "./coupon";
|
|
||||||
import limitUtils from "./limit";
|
|
||||||
|
|
||||||
export { OrderPriceCalculator, couponUtils, limitUtils };
|
|
||||||
export default {
|
|
||||||
OrderPriceCalculator,
|
|
||||||
couponUtils,
|
|
||||||
limitUtils,
|
|
||||||
};
|
|
||||||
216
lib/limit.ts
216
lib/limit.ts
@@ -1,216 +0,0 @@
|
|||||||
import BigNumber from "bignumber.js";
|
|
||||||
|
|
||||||
import _ from "lodash";
|
|
||||||
|
|
||||||
import {
|
|
||||||
BaseCartItem,
|
|
||||||
ShopUserInfo,
|
|
||||||
ShopInfo,
|
|
||||||
TimeLimitDiscountConfig,
|
|
||||||
CanReturnMemberPriceArgs,
|
|
||||||
returnPriceArgs,
|
|
||||||
} from "./types";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 判断商品是否可以使用限时折扣
|
|
||||||
* @param goods 商品对象
|
|
||||||
* @param limitTimeDiscountRes 限时折扣配置
|
|
||||||
* @param shopInfo 店铺信息
|
|
||||||
* @param shopUserInfo 店铺用户信息
|
|
||||||
* @param idKey 商品ID键名,默认"id"
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
export function canUseLimitTimeDiscount(
|
|
||||||
goods: BaseCartItem,
|
|
||||||
limitTimeDiscountRes: TimeLimitDiscountConfig | null | undefined,
|
|
||||||
shopInfo: ShopInfo,
|
|
||||||
shopUserInfo: ShopUserInfo,
|
|
||||||
idKey = "id" as keyof BaseCartItem
|
|
||||||
) {
|
|
||||||
shopInfo = shopInfo || {};
|
|
||||||
shopUserInfo = shopUserInfo || {};
|
|
||||||
if(shopInfo.isMemberPrice){
|
|
||||||
shopUserInfo.isMemberPrice=1
|
|
||||||
}
|
|
||||||
if (!limitTimeDiscountRes || !limitTimeDiscountRes.id) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const canUseFoods = (limitTimeDiscountRes.foods || "").split(",");
|
|
||||||
|
|
||||||
const goodsCanUse =
|
|
||||||
limitTimeDiscountRes.foodType == 1 ||
|
|
||||||
canUseFoods.includes(`${goods[idKey]}`);
|
|
||||||
if (!goodsCanUse) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (limitTimeDiscountRes.discountPriority == "limit-time") {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (limitTimeDiscountRes.discountPriority == "vip-price") {
|
|
||||||
if (
|
|
||||||
shopUserInfo.isVip == 1 &&
|
|
||||||
shopUserInfo.isMemberPrice == 1 &&
|
|
||||||
goods.memberPrice * 1 > 0
|
|
||||||
) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回商品显示价格
|
|
||||||
* @params {*} args 参数对象
|
|
||||||
* @params {*} args.goods 商品对象
|
|
||||||
* @params {*} args.shopInfo 店铺信息
|
|
||||||
* @params {*} args.limitTimeDiscountRes 限时折扣信息
|
|
||||||
* @params {*} args.shopUserInfo 店铺用户信息
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
export function returnPrice(args: returnPriceArgs) {
|
|
||||||
let {
|
|
||||||
goods,
|
|
||||||
shopInfo,
|
|
||||||
limitTimeDiscountRes,
|
|
||||||
shopUserInfo,
|
|
||||||
idKey = "product_id",
|
|
||||||
} = args;
|
|
||||||
limitTimeDiscountRes = limitTimeDiscountRes || {
|
|
||||||
foods: "",
|
|
||||||
foodType: 2,
|
|
||||||
discountPriority: "",
|
|
||||||
discountRate: 0,
|
|
||||||
id: 0,
|
|
||||||
shopId: 0,
|
|
||||||
useType: "",
|
|
||||||
};
|
|
||||||
const canUseFoods = (limitTimeDiscountRes.foods || "").split(",");
|
|
||||||
const includesGoods =
|
|
||||||
limitTimeDiscountRes.foodType == 1 ||
|
|
||||||
canUseFoods.includes("" + goods[idKey]);
|
|
||||||
shopInfo = shopInfo || {};
|
|
||||||
shopUserInfo = shopUserInfo || {};
|
|
||||||
if (
|
|
||||||
shopUserInfo.isMemberPrice == 1 &&
|
|
||||||
shopUserInfo.isVip == 1 &&
|
|
||||||
shopInfo.isMemberPrice == 1
|
|
||||||
) {
|
|
||||||
const memberPrice = goods.memberPrice || goods.salePrice;
|
|
||||||
|
|
||||||
//是会员而且启用会员价
|
|
||||||
if (limitTimeDiscountRes) {
|
|
||||||
//使用限时折扣
|
|
||||||
//限时折扣优先
|
|
||||||
if (limitTimeDiscountRes.discountPriority == "limit-time") {
|
|
||||||
if (includesGoods) {
|
|
||||||
return returnLimitPrice({
|
|
||||||
price: goods.salePrice,
|
|
||||||
limitTimeDiscountRes,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
return memberPrice;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
limitTimeDiscountRes.discountPriority == "vip-price" &&
|
|
||||||
includesGoods
|
|
||||||
) {
|
|
||||||
if (goods.memberPrice * 1 > 0) {
|
|
||||||
//会员优先
|
|
||||||
return memberPrice;
|
|
||||||
} else {
|
|
||||||
const price = returnLimitPrice({
|
|
||||||
price: goods.salePrice,
|
|
||||||
limitTimeDiscountRes,
|
|
||||||
goods: goods,
|
|
||||||
});
|
|
||||||
|
|
||||||
return price;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return memberPrice;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//是会员没有限时折扣
|
|
||||||
return memberPrice;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//不是会员或者没有启用会员价
|
|
||||||
if (limitTimeDiscountRes && limitTimeDiscountRes.id && includesGoods) {
|
|
||||||
const price = returnLimitPrice({
|
|
||||||
price: goods.salePrice,
|
|
||||||
limitTimeDiscountRes,
|
|
||||||
goods: goods,
|
|
||||||
});
|
|
||||||
|
|
||||||
return price;
|
|
||||||
} else {
|
|
||||||
return goods.salePrice;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface returnLimitPriceArgs {
|
|
||||||
limitTimeDiscountRes: TimeLimitDiscountConfig | null | undefined;
|
|
||||||
price: number;
|
|
||||||
goods?: BaseCartItem;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 返回限时折扣价格
|
|
||||||
* @params {*} args 参数对象
|
|
||||||
* @params {*} args.limitTimeDiscountRes 限时折扣信息
|
|
||||||
* @params {*} args.price 商品价格
|
|
||||||
* @param {*} args.goods 商品对象
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
export function returnLimitPrice(args: returnLimitPriceArgs) {
|
|
||||||
const { limitTimeDiscountRes, price, goods } = args;
|
|
||||||
const discountRate = new BigNumber(
|
|
||||||
limitTimeDiscountRes ? limitTimeDiscountRes.discountRate : 100
|
|
||||||
).dividedBy(100);
|
|
||||||
|
|
||||||
const result = BigNumber(price)
|
|
||||||
.times(discountRate)
|
|
||||||
.decimalPlaces(2, BigNumber.ROUND_UP)
|
|
||||||
.toNumber();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 判断是否返回会员价
|
|
||||||
* @param {*} args 参数对象
|
|
||||||
* @param {*} args.shopInfo 店铺信息
|
|
||||||
* @param {*} args.shopUserInfo 店铺用户信息
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
export function canReturnMemberPrice(args: CanReturnMemberPriceArgs) {
|
|
||||||
const { shopInfo, shopUserInfo } = args;
|
|
||||||
if (shopUserInfo.isMemberPrice == 1 && shopUserInfo.isVip == 1) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回会员价格
|
|
||||||
* @param {*} goods
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
export function returnMemberPrice(goods: BaseCartItem) {
|
|
||||||
return goods.memberPrice || goods.salePrice;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const utils = {
|
|
||||||
returnPrice,
|
|
||||||
canUseLimitTimeDiscount,
|
|
||||||
returnLimitPrice,
|
|
||||||
canReturnMemberPrice,
|
|
||||||
returnMemberPrice,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default utils;
|
|
||||||
430
lib/types.ts
430
lib/types.ts
@@ -1,430 +0,0 @@
|
|||||||
/** 商品类型枚举 */
|
|
||||||
export enum GoodsType {
|
|
||||||
NORMAL = "normal", // 普通商品
|
|
||||||
WEIGHT = "weight", // 称重商品
|
|
||||||
GIFT = "gift", // 赠菜(继承普通商品逻辑,标记用)
|
|
||||||
EMPTY = "", // 空字符串类型(后端未返回时默认归类为普通商品)
|
|
||||||
PACKAGE = "package", // 打包商品(如套餐/预打包商品,按普通商品逻辑处理,可扩展特殊规则)
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 优惠券计算结果类型(新增细分字段) */
|
|
||||||
export interface CouponResult {
|
|
||||||
deductionAmount: number; // 抵扣金额
|
|
||||||
excludedProductIds: string[]; // 不适用商品ID列表(注意:是商品ID,非购物车ID)
|
|
||||||
usedCoupon: Coupon | undefined; // 实际使用的优惠券
|
|
||||||
productCouponDeduction: number; // 新增:商品优惠券抵扣(兑换券等)
|
|
||||||
fullCouponDeduction: number; // 新增:满减优惠券抵扣
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 兑换券计算结果类型(新增细分字段) */
|
|
||||||
export interface ExchangeCalculationResult {
|
|
||||||
deductionAmount: number;
|
|
||||||
excludedProductIds: string[]; // 不适用商品ID列表(商品ID)
|
|
||||||
productCouponDeduction: number; // 新增:兑换券属于商品券,同步记录
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CouponTypes {
|
|
||||||
1: "满减券";
|
|
||||||
2: "商品券";
|
|
||||||
3: "折扣券";
|
|
||||||
4: "第二件半价券";
|
|
||||||
5: "消费送券";
|
|
||||||
6: "买一送一券";
|
|
||||||
7: "固定价格券";
|
|
||||||
8: "免配送费券";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 优惠券类型枚举 */
|
|
||||||
export enum CouponType {
|
|
||||||
FULL_REDUCTION = "full_reduction", // 满减券
|
|
||||||
DISCOUNT = "discount", // 折扣券
|
|
||||||
SECOND_HALF = "second_half", // 第二件半价券
|
|
||||||
BUY_ONE_GET_ONE = "buy_one_get_one", // 买一送一券
|
|
||||||
EXCHANGE = "exchange", // 商品兑换券
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 后端返回的优惠券原始字段类型 */
|
|
||||||
export interface BackendCoupon {
|
|
||||||
id?: number; // 自增主键(int64)
|
|
||||||
shopId?: number; // 店铺ID(int64)
|
|
||||||
syncId?: number; // 同步Id(int64)
|
|
||||||
type?: number; // 优惠券类型:1-满减券,2-商品兑换券,3-折扣券,4-第二件半价券,5-消费送券,6-买一送一券,7-固定价格券,8-免配送费券
|
|
||||||
name?: string; // 券名称
|
|
||||||
useShopType?: string; // 可用门店类型:only-仅本店;all-所有门店,custom-指定门店
|
|
||||||
useShops?: string; // 可用门店(逗号分隔字符串,如"1,2,3")
|
|
||||||
useType?: string; // 可使用类型:dine堂食/pickup自取/deliv配送/express快递
|
|
||||||
validType?: string; // 有效期类型:fixed(固定时间),custom(自定义时间)
|
|
||||||
validDays?: number; // 有效期(天)
|
|
||||||
validStartTime?: string; // 有效期开始时间(如"2024-01-01 00:00:00")
|
|
||||||
validEndTime?: string; // 有效期结束时间
|
|
||||||
daysToTakeEffect?: number; // 隔天生效
|
|
||||||
useDays?: string; // 可用周期(如"周一,周二")
|
|
||||||
useTimeType?: string; // 可用时间段类型:all-全时段,custom-指定时段
|
|
||||||
useStartTime?: string; // 可用开始时间(每日)
|
|
||||||
useEndTime?: string; // 可用结束时间(每日)
|
|
||||||
getType?: string; // 发放设置:不可自行领取/no,可领取/yes
|
|
||||||
getMode?: string; // 用户领取方式
|
|
||||||
giveNum?: number; // 总发放数量,-10086为不限量
|
|
||||||
getUserType?: string; // 可领取用户:全部/all,新用户一次/new,仅会员/vip
|
|
||||||
getLimit?: number; // 每人领取限量,-10086为不限量
|
|
||||||
useLimit?: number; // 每人每日使用限量,-10086为不限量
|
|
||||||
discountShare?: number; // 与限时折扣同享:0-否,1-是
|
|
||||||
vipPriceShare?: number; // 与会员价同享:0-否,1-是
|
|
||||||
ruleDetails?: string; // 附加规则说明
|
|
||||||
status?: number; // 状态:0-禁用,1-启用
|
|
||||||
useNum?: number; // 已使用数量
|
|
||||||
leftNum?: number; // 剩余数量
|
|
||||||
foods?: string; // 指定门槛商品(逗号分隔字符串,如"101,102",此处为商品ID)
|
|
||||||
fullAmount?: number; // 使用门槛:满多少金额(元)
|
|
||||||
discountAmount?: number; // 使用门槛:减多少金额(元)
|
|
||||||
discountRate?: number; // 折扣%(如90=9折)
|
|
||||||
maxDiscountAmount?: number; // 可抵扣最大金额(元)
|
|
||||||
useRule?: string; // 使用规则:price_asc-价格低到高,price_desc-高到低
|
|
||||||
discountNum?: number; // 抵扣数量
|
|
||||||
otherCouponShare?: number; // 与其它优惠共享:0-否,1-是
|
|
||||||
createTime?: string; // 创建时间
|
|
||||||
updateTime?: string; // 更新时间
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 营销活动类型枚举 */
|
|
||||||
export enum ActivityType {
|
|
||||||
TIME_LIMIT_DISCOUNT = "time_limit_discount", // 限时折扣
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 基础购物车商品项(核心修正:新增product_id,明确各ID含义) */
|
|
||||||
export interface BaseCartItem {
|
|
||||||
id: string | number; // 购物车ID(唯一标识购物车中的条目,如购物车项主键)
|
|
||||||
product_id: string | number; // 商品ID(唯一标识商品,用于优惠券/活动匹配,必选)
|
|
||||||
productId?: string | number; // 商品ID
|
|
||||||
salePrice: number; // 商品原价(元)
|
|
||||||
number: number; // 商品数量
|
|
||||||
num?: number; // 商品数量
|
|
||||||
isTimeDiscount?: boolean; // 是否限时折扣商品(默认false)
|
|
||||||
is_time_discount?: boolean; // 是否限时折扣商品(默认false)
|
|
||||||
product_type: GoodsType; // 商品类型
|
|
||||||
is_temporary?: boolean; // 是否临时菜(默认false)
|
|
||||||
isTemporary?: boolean; // 是否临时菜(默认false)
|
|
||||||
is_gift?: boolean; // 是否赠菜(默认false)
|
|
||||||
isGift?: boolean; // 是否赠菜(默认false)
|
|
||||||
returnNum?: number; // 退货数量(历史订单用,默认0)
|
|
||||||
memberPrice: number; // 商品会员价(元,优先级:商品会员价 > 会员折扣)
|
|
||||||
discountSaleAmount?: number; // 商家改价后单价(元,优先级最高)
|
|
||||||
discount_sale_amount?: number; // 商家改价后单价(元,优先级最高)
|
|
||||||
packFee?: number; // 单份打包费(元,默认0)
|
|
||||||
packNumber?: number; // 堂食打包数量(默认0)
|
|
||||||
activityInfo?: {
|
|
||||||
// 商品参与的营销活动(如限时折扣)
|
|
||||||
type: ActivityType;
|
|
||||||
discountRate: number; // 折扣率(如0.8=8折)
|
|
||||||
vipPriceShare: boolean; // 是否与会员优惠同享(默认false)
|
|
||||||
};
|
|
||||||
skuData?: {
|
|
||||||
// SKU扩展数据(可选)
|
|
||||||
id: string | number; // SKU ID(唯一标识商品规格,如颜色/尺寸)
|
|
||||||
memberPrice: number; // SKU会员价
|
|
||||||
salePrice?: number; // SKU原价
|
|
||||||
};
|
|
||||||
skuId?: string | number; // SKU ID(唯一标识商品规格,如颜色/尺寸)
|
|
||||||
couponType?: number; // 优惠券类型:1-满减券,2-商品兑换券,3-折扣券,4-第二件半价券,5-消费送券,6-买一送一券,7-固定价格券,8-免配送费券
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CouponFoods {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
images: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 基础优惠券接口(所有券类型继承,包含统一门槛商品字段) */
|
|
||||||
export interface BaseCoupon {
|
|
||||||
otherCouponShare?: number; // 与其它优惠共享:0-否,1-是
|
|
||||||
id: string | number; // 优惠券ID
|
|
||||||
type: number; // 工具库字符串枚举(由后端couponType转换)
|
|
||||||
name: string; // 对应后端title
|
|
||||||
available: boolean; // 基于BackendCoupon字段计算的可用性
|
|
||||||
useShopType?: string; // only-仅本店;all-所有门店,custom-指定门店
|
|
||||||
useShops: string[]; // 可用门店ID列表
|
|
||||||
discountShare: boolean; // 与限时折扣同享:0-否,1-是(后端字段转换为布尔值)
|
|
||||||
vipPriceShare: boolean; // 与会员价同享:0-否,1-是(后端字段转换为布尔值)
|
|
||||||
useType?: string[]; // 可使用类型:dine堂食/pickup自取/deliv配送/express快递
|
|
||||||
isValid: boolean; // 是否在有效期内
|
|
||||||
discountAmount?: number; // 减免金额 (满减券有)
|
|
||||||
fullAmount?: number; // 使用门槛:满多少金额
|
|
||||||
maxDiscountAmount?: number; // 可抵扣最大金额 元
|
|
||||||
use: boolean;
|
|
||||||
discountNum?: number; // 抵扣数量
|
|
||||||
useRule?: string; // 使用规则:price_asc-价格低到高,price_desc-高到低
|
|
||||||
discountRate?: number; // 折扣%(如90=9折)
|
|
||||||
noUseRestrictions?: boolean; // 是不可用原因
|
|
||||||
thresholdFoods: CouponFoods[]; // 门槛商品ID列表(空数组=全部商品,非空=指定商品ID)
|
|
||||||
useFoods: CouponFoods[]; // 可用商品ID列表(空数组=全部商品,非空=指定商品ID)
|
|
||||||
}
|
|
||||||
export interface couponDiscount {
|
|
||||||
discountPrice: number;
|
|
||||||
hasDiscountGoodsArr: BaseCartItem[];
|
|
||||||
}
|
|
||||||
/** 满减券(适配后端字段) */
|
|
||||||
export interface FullReductionCoupon extends BaseCoupon {
|
|
||||||
fullAmount: number; // 对应后端fullAmount(满减门槛)
|
|
||||||
discountAmount: number; // 对应后端discountAmount(减免金额)
|
|
||||||
maxDiscountAmount?: number; // 对应后端maxDiscountAmount(最大减免)
|
|
||||||
discount?: couponDiscount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 折扣券(适配后端字段) */
|
|
||||||
export interface DiscountCoupon extends BaseCoupon {
|
|
||||||
discountRate: number; // 后端discountRate(%)转小数(如90→0.9)
|
|
||||||
maxDiscountAmount: number; // 对应后端maxDiscountAmount(最大减免)
|
|
||||||
discount?: couponDiscount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 第二件半价券(适配后端字段) */
|
|
||||||
export interface SecondHalfPriceCoupon extends BaseCoupon {
|
|
||||||
maxUseCountPerOrder?: number; // 对应后端useLimit(-10086=不限)
|
|
||||||
discount?: couponDiscount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 买一送一券(适配后端字段) */
|
|
||||||
export interface BuyOneGetOneCoupon extends BaseCoupon {
|
|
||||||
maxUseCountPerOrder?: number; // 对应后端useLimit(-10086=不限)
|
|
||||||
discount?: couponDiscount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 商品兑换券(适配后端字段) */
|
|
||||||
export interface ExchangeCoupon extends BaseCoupon {
|
|
||||||
deductCount: number; // 对应后端discountNum(抵扣数量)
|
|
||||||
sortRule: "low_price_first" | "high_price_first"; // 后端useRule转换
|
|
||||||
discount?: couponDiscount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 所有优惠券类型联合 */
|
|
||||||
export type Coupon =
|
|
||||||
| FullReductionCoupon
|
|
||||||
| DiscountCoupon
|
|
||||||
| SecondHalfPriceCoupon
|
|
||||||
| BuyOneGetOneCoupon
|
|
||||||
| ExchangeCoupon;
|
|
||||||
|
|
||||||
/** 营销活动配置(如限时折扣,applicableProductIds为商品ID列表) */
|
|
||||||
export interface ActivityConfig {
|
|
||||||
type: ActivityType;
|
|
||||||
applicableProductIds?: string[]; // 适用商品ID列表(与BaseCartItem.product_id匹配)
|
|
||||||
discountRate: number; // 折扣率(如0.8=8折)
|
|
||||||
vipPriceShare: boolean; // 是否与会员优惠同享
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 积分抵扣规则 */
|
|
||||||
export interface PointDeductionRule {
|
|
||||||
pointsPerYuan: number; // X积分=1元(如100=100积分抵1元)
|
|
||||||
maxDeductionAmount?: number; // 最大抵扣金额(元,默认不限)
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 餐位费配置 */
|
|
||||||
export interface SeatFeeConfig {
|
|
||||||
pricePerPerson: number; // 每人餐位费(元)
|
|
||||||
personCount: number; // 用餐人数(默认1)
|
|
||||||
isEnabled: boolean; // 是否启用餐位费(默认false)
|
|
||||||
}
|
|
||||||
/** 商家减免类型枚举 */
|
|
||||||
export enum MerchantReductionType {
|
|
||||||
FIXED_AMOUNT = "fixed_amount", // 固定金额减免(如直接减 10 元)
|
|
||||||
DISCOUNT_RATE = "discount_rate", // 比例折扣减免(如打 9 折,即减免 10%)
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 商家减免配置(新增,替代原单一金额字段) */
|
|
||||||
export interface MerchantReductionConfig {
|
|
||||||
type: MerchantReductionType; // 减免类型(二选一)
|
|
||||||
fixedAmount?: number; // 固定减免金额(元,仅 FIXED_AMOUNT 生效,≥0)
|
|
||||||
discountRate?: number; // 折扣率(%,仅 DISCOUNT_RATE 生效,0-100,如 90 代表 9 折)
|
|
||||||
}
|
|
||||||
/**商家霸王餐配置 */
|
|
||||||
export interface FreeDineConfig {
|
|
||||||
enable: boolean; //是否开启
|
|
||||||
rechargeThreshold: number; //订单满多少元可以使用
|
|
||||||
rechargeTimes: number; //充值多少倍免单
|
|
||||||
withCoupon: boolean; //与优惠券同享
|
|
||||||
withPoints: boolean; //与积分同享
|
|
||||||
useType?: string[]; //使用类型 dine-in店内 takeout 自取 post快递,takeaway外卖
|
|
||||||
useShopType?: string; //all 全部 part部分
|
|
||||||
shopIdList?: number[]; //可用门店id
|
|
||||||
}
|
|
||||||
|
|
||||||
//限时折扣配置
|
|
||||||
export interface TimeLimitDiscountConfig {
|
|
||||||
/**
|
|
||||||
* 折扣优先级 limit-time/vip-price
|
|
||||||
*/
|
|
||||||
discountPriority: string;
|
|
||||||
/**
|
|
||||||
* 折扣% 范围1-99
|
|
||||||
*/
|
|
||||||
discountRate: number;
|
|
||||||
/**
|
|
||||||
* 参与商品
|
|
||||||
*/
|
|
||||||
foods: string;
|
|
||||||
/**
|
|
||||||
* 参与商品 1全部 2部分
|
|
||||||
*/
|
|
||||||
foodType: number;
|
|
||||||
/**
|
|
||||||
* 自增主键
|
|
||||||
*/
|
|
||||||
id: number;
|
|
||||||
/**
|
|
||||||
* 店铺ID
|
|
||||||
*/
|
|
||||||
shopId: number;
|
|
||||||
/**
|
|
||||||
* 可使用类型:堂食 dine-in 外带 take-out 外卖 take-away 配送 post
|
|
||||||
*/
|
|
||||||
useType: string;
|
|
||||||
[property: string]: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
//用户信息
|
|
||||||
export interface ShopUserInfo {
|
|
||||||
isVip: number | null; //是否会员
|
|
||||||
discount: number | null; //用户折扣
|
|
||||||
isMemberPrice: number | null; //会员折扣与会员价是否同时使用
|
|
||||||
id?: number; //用户ID
|
|
||||||
}
|
|
||||||
/** 订单额外费用配置 */
|
|
||||||
export interface OrderExtraConfig {
|
|
||||||
// merchantReduction: number; // 商家减免金额(元,默认0)
|
|
||||||
// 替换原单一金额字段,支持两种减免形式
|
|
||||||
merchantReduction: MerchantReductionConfig;
|
|
||||||
additionalFee: number; // 附加费(元,如余额充值、券包,默认0)
|
|
||||||
pointDeductionRule: PointDeductionRule; // 积分抵扣规则
|
|
||||||
seatFeeConfig: SeatFeeConfig; // 餐位费配置
|
|
||||||
currentStoreId: string; // 当前门店ID(用于验证优惠券适用门店)
|
|
||||||
userPoints: number; // 用户当前积分(用于积分抵扣)
|
|
||||||
isMember: boolean; // 用户是否会员(用于会员优惠)
|
|
||||||
memberDiscountRate?: number; // 会员折扣率(如0.95=95折,无会员价时用)
|
|
||||||
newUserDiscount?: number; // 新用户减免金额(元,默认0)
|
|
||||||
fullReductionActivities: FullReductionActivity[]; // 当前店铺的满减活动列表(后端返回结构)
|
|
||||||
currentDinnerType: "dine-in" | "take-out" | "take-away" | "post"; // 当前就餐类型(匹配useType)
|
|
||||||
isFreeDine?: boolean; //是否霸王餐
|
|
||||||
freeDineConfig?: FreeDineConfig;
|
|
||||||
limitTimeDiscount?: TimeLimitDiscountConfig; //限时折扣
|
|
||||||
shopUserInfo: ShopUserInfo; // 用户信息
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 订单费用汇总(修改:补充商家减免类型和明细) */
|
|
||||||
export interface OrderCostSummary {
|
|
||||||
goodsList: BaseCartItem[];
|
|
||||||
// 商品总件数
|
|
||||||
goodsTotal: number;
|
|
||||||
totalDiscountAmount: number;
|
|
||||||
goodsRealAmount: number; // 商品真实原价总和
|
|
||||||
goodsOriginalAmount: number; // 商品原价总和
|
|
||||||
goodsDiscountAmount: number; // 商品折扣金额
|
|
||||||
couponDeductionAmount: number; // 优惠券总抵扣
|
|
||||||
productCouponDeduction: number; // 商品优惠券抵扣
|
|
||||||
fullCouponDeduction: number; // 满减优惠券抵扣
|
|
||||||
pointDeductionAmount: number; // 积分抵扣金额
|
|
||||||
seatFee: number; // 餐位费
|
|
||||||
packFee: number; // 打包费
|
|
||||||
scoreMaxMoney: number; // 积分最大可抵扣金额
|
|
||||||
// 新增:商家减免明细
|
|
||||||
merchantReduction: {
|
|
||||||
type: MerchantReductionType; // 实际使用的减免类型
|
|
||||||
originalConfig: MerchantReductionConfig; // 原始配置(便于前端展示)
|
|
||||||
actualAmount: number; // 实际减免金额(计算后的值,≥0)
|
|
||||||
};
|
|
||||||
additionalFee: number; // 附加费
|
|
||||||
finalPayAmount: number; // 最终实付金额
|
|
||||||
couponUsed?: Coupon; // 实际使用的优惠券
|
|
||||||
pointUsed: number; // 实际使用的积分
|
|
||||||
newUserDiscount: number; // 新用户减免金额(元,默认0)
|
|
||||||
dinnerType?: "dine-in" | "take-out"; // 就餐类型(堂食/自取/配送/快递)
|
|
||||||
config: OrderExtraConfig; // 订单额外费用配置
|
|
||||||
//满减活动
|
|
||||||
fullReduction: {
|
|
||||||
usedFullReductionActivityFullAmount: number; // 计算出的满减活动的门槛金额
|
|
||||||
usedActivity?: FullReductionActivity; // 实际使用的满减活动
|
|
||||||
usedThreshold?: FullReductionThreshold; // 实际使用的满减阈值(多门槛中选最优)
|
|
||||||
actualAmount: number; // 满减实际减免金额(元)
|
|
||||||
};
|
|
||||||
vipDiscountAmount: number; //会员折扣减免金额
|
|
||||||
// 订单原支付金额
|
|
||||||
orderOriginFinalPayAmount: number; //订单原金额(包含打包费+餐位费)
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 满减活动阈值(单条满减规则:满X减Y)- 对应 MkDiscountThresholdInsertGroupDefaultGroup */
|
|
||||||
export interface FullReductionThreshold {
|
|
||||||
activityId?: number; // 关联满减活动ID
|
|
||||||
fullAmount?: number; // 满多少金额(元,必填)
|
|
||||||
discountAmount?: number; // 减多少金额(元,必填)
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 满减活动主表 - 对应 Request 接口(后端真实字段) */
|
|
||||||
export interface FullReductionActivity {
|
|
||||||
id?: number; // 自增主键(后端字段:id)
|
|
||||||
shopId?: number; // 店铺ID(后端字段:shopId)
|
|
||||||
status?: number; // 活动状态:1=未开始,2=进行中,3=已结束(后端字段:status)
|
|
||||||
sort?: number; // 排序值(越大优先级越高,后端字段:sort)
|
|
||||||
createTime?: string; // 创建时间(后端字段:createTime,格式如"2025-10-14 13:56:07")
|
|
||||||
updateTime?: string; // 最新修改时间(后端字段:updateTime,用于优先级排序)
|
|
||||||
validStartTime?: string; // 有效期开始时间(后端字段:validStartTime,格式如"2025-10-14")
|
|
||||||
validEndTime?: string; // 有效期结束时间(后端字段:validEndTime,格式如"2025-12-14")
|
|
||||||
useType?: string; // 可使用类型(后端字段:useType,如"dine,pickup,deliv,express")
|
|
||||||
useDays?: string; // 可用周期(后端字段:useDays,如"周一,周二,周三,周四,周五,周六,周日")
|
|
||||||
useTimeType?: string; // 可用时间段类型(后端字段:useTimeType,all=全时段,custom=指定时段)
|
|
||||||
useStartTime?: string; // 每日可用开始时间(后端字段:useStartTime,如"09:00:00",仅custom时有效)
|
|
||||||
useEndTime?: string; // 每日可用结束时间(后端字段:useEndTime,如"22:00:00",仅custom时有效)
|
|
||||||
couponShare?: number; // 与优惠券同享:0=否,1=是(后端字段:couponShare)
|
|
||||||
discountShare?: number; // 与限时折扣同享:0=否,1=是(后端字段:discountShare)
|
|
||||||
vipPriceShare?: number; // 与会员价同享:0=否,1=是(后端字段:vipPriceShare)
|
|
||||||
pointsShare?: number; // 与积分抵扣同享:0=否,1=是(后端字段:pointsShare)
|
|
||||||
thresholds?: FullReductionThreshold[]; // 满减阈值列表(多门槛,后端字段:thresholds)
|
|
||||||
isDel?: boolean; // 是否删除:0=否,1=是(后端字段:isDel,默认false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 辅助枚举:星期映射(用于useDays校验)
|
|
||||||
export const WEEKDAY_MAP = {
|
|
||||||
周一: 1,
|
|
||||||
周二: 2,
|
|
||||||
周三: 3,
|
|
||||||
周四: 4,
|
|
||||||
周五: 5,
|
|
||||||
周六: 6,
|
|
||||||
周日: 0, // JS中getDay()返回0=周日
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface ShopInfo {
|
|
||||||
isMemberPrice: number; // 是否开启会员价 1是开启
|
|
||||||
[property: string]: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface couponCalcParams {
|
|
||||||
canDikouGoodsArr: BaseCartItem[];
|
|
||||||
coupon: Coupon;
|
|
||||||
user: ShopUserInfo;
|
|
||||||
shopInfo: ShopInfo;
|
|
||||||
selCoupon: Coupon[];
|
|
||||||
goodsOrderPrice: number; //商品订单总价
|
|
||||||
isMemberPrice: number; // 是否开启会员价 1是开启
|
|
||||||
limitTimeDiscount?: TimeLimitDiscountConfig | null | undefined;
|
|
||||||
}
|
|
||||||
export interface CanDikouGoodsArrArgs {
|
|
||||||
canDikouGoodsArr: BaseCartItem[];
|
|
||||||
selCoupon: Coupon[];
|
|
||||||
user: ShopUserInfo;
|
|
||||||
shopInfo: ShopInfo;
|
|
||||||
limitTimeDiscount?: TimeLimitDiscountConfig | null | undefined;
|
|
||||||
}
|
|
||||||
export interface returnPriceArgs {
|
|
||||||
goods: BaseCartItem;
|
|
||||||
selCoupon: Coupon[];
|
|
||||||
user: ShopUserInfo;
|
|
||||||
shopInfo: ShopInfo;
|
|
||||||
shopUserInfo: ShopUserInfo;
|
|
||||||
limitTimeDiscountRes?: TimeLimitDiscountConfig | null | undefined;
|
|
||||||
idKey?: keyof BaseCartItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export interface CanReturnMemberPriceArgs {
|
|
||||||
shopInfo?: ShopInfo;
|
|
||||||
shopUserInfo: ShopUserInfo;
|
|
||||||
}
|
|
||||||
33
lib/utils.ts
33
lib/utils.ts
@@ -1,33 +0,0 @@
|
|||||||
/**
|
|
||||||
* 通用字段兼容工具函数:处理驼峰/下划线命名的字段取值
|
|
||||||
* @param obj 目标对象(如商品信息 BaseCartItem)
|
|
||||||
* @param camelCaseKey 驼峰命名字段(如 'isTemporary')
|
|
||||||
* @param snakeCaseKey 下划线命名字段(如 'is_temporary')
|
|
||||||
* @param defaultValue 默认值(默认 false,适配布尔类型字段)
|
|
||||||
* @returns 字段值(优先取存在的字段,无则返回默认值)
|
|
||||||
*/
|
|
||||||
export function getCompatibleFieldValue(
|
|
||||||
obj: Record<string, any>,
|
|
||||||
camelCaseKey: string,
|
|
||||||
snakeCaseKey: string,
|
|
||||||
defaultValue: boolean = false
|
|
||||||
): boolean {
|
|
||||||
// 优先判断驼峰字段(如果存在且不是 undefined/null)
|
|
||||||
if (
|
|
||||||
obj.hasOwnProperty(camelCaseKey) &&
|
|
||||||
obj[camelCaseKey] !== undefined &&
|
|
||||||
obj[camelCaseKey] !== null
|
|
||||||
) {
|
|
||||||
return Boolean(obj[camelCaseKey]);
|
|
||||||
}
|
|
||||||
// 再判断下划线字段
|
|
||||||
if (
|
|
||||||
obj.hasOwnProperty(snakeCaseKey) &&
|
|
||||||
obj[snakeCaseKey] !== undefined &&
|
|
||||||
obj[snakeCaseKey] !== null
|
|
||||||
) {
|
|
||||||
return Boolean(obj[snakeCaseKey]);
|
|
||||||
}
|
|
||||||
// 都不存在时返回默认值(布尔类型字段默认 false)
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
129
package-lock.json
generated
129
package-lock.json
generated
@@ -14,10 +14,11 @@
|
|||||||
"jsbn": "^1.1.0",
|
"jsbn": "^1.1.0",
|
||||||
"jsencrypt": "^3.3.2",
|
"jsencrypt": "^3.3.2",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
|
"marked": "4.x",
|
||||||
"pinia-plugin-unistorage": "^0.1.2",
|
"pinia-plugin-unistorage": "^0.1.2",
|
||||||
"to-arraybuffer": "^1.0.1",
|
"to-arraybuffer": "^1.0.1",
|
||||||
"uview-plus": "^3.3.32",
|
"uview-plus": "^3.3.32",
|
||||||
"ysk-utils": "^1.0.78"
|
"ysk-utils": "^1.0.85"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"copy-webpack-plugin": "^12.0.2",
|
"copy-webpack-plugin": "^12.0.2",
|
||||||
@@ -30,7 +31,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz",
|
"resolved": "https://registry.npmmirror.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz",
|
||||||
"integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==",
|
"integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jridgewell/set-array": "^1.2.1",
|
"@jridgewell/set-array": "^1.2.1",
|
||||||
"@jridgewell/sourcemap-codec": "^1.4.10",
|
"@jridgewell/sourcemap-codec": "^1.4.10",
|
||||||
@@ -45,7 +45,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
|
"resolved": "https://registry.npmmirror.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
|
||||||
"integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
|
"integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.0.0"
|
"node": ">=6.0.0"
|
||||||
}
|
}
|
||||||
@@ -55,7 +54,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/@jridgewell/set-array/-/set-array-1.2.1.tgz",
|
"resolved": "https://registry.npmmirror.com/@jridgewell/set-array/-/set-array-1.2.1.tgz",
|
||||||
"integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==",
|
"integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.0.0"
|
"node": ">=6.0.0"
|
||||||
}
|
}
|
||||||
@@ -65,7 +63,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/@jridgewell/source-map/-/source-map-0.3.6.tgz",
|
"resolved": "https://registry.npmmirror.com/@jridgewell/source-map/-/source-map-0.3.6.tgz",
|
||||||
"integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==",
|
"integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jridgewell/gen-mapping": "^0.3.5",
|
"@jridgewell/gen-mapping": "^0.3.5",
|
||||||
"@jridgewell/trace-mapping": "^0.3.25"
|
"@jridgewell/trace-mapping": "^0.3.25"
|
||||||
@@ -75,15 +72,13 @@
|
|||||||
"version": "1.5.0",
|
"version": "1.5.0",
|
||||||
"resolved": "https://registry.npmmirror.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz",
|
"resolved": "https://registry.npmmirror.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz",
|
||||||
"integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==",
|
"integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/@jridgewell/trace-mapping": {
|
"node_modules/@jridgewell/trace-mapping": {
|
||||||
"version": "0.3.25",
|
"version": "0.3.25",
|
||||||
"resolved": "https://registry.npmmirror.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz",
|
"resolved": "https://registry.npmmirror.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz",
|
||||||
"integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==",
|
"integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jridgewell/resolve-uri": "^3.1.0",
|
"@jridgewell/resolve-uri": "^3.1.0",
|
||||||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
"@jridgewell/sourcemap-codec": "^1.4.14"
|
||||||
@@ -141,7 +136,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/@types/eslint/-/eslint-9.6.1.tgz",
|
"resolved": "https://registry.npmmirror.com/@types/eslint/-/eslint-9.6.1.tgz",
|
||||||
"integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==",
|
"integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/estree": "*",
|
"@types/estree": "*",
|
||||||
"@types/json-schema": "*"
|
"@types/json-schema": "*"
|
||||||
@@ -152,7 +146,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/@types/eslint-scope/-/eslint-scope-3.7.7.tgz",
|
"resolved": "https://registry.npmmirror.com/@types/eslint-scope/-/eslint-scope-3.7.7.tgz",
|
||||||
"integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==",
|
"integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/eslint": "*",
|
"@types/eslint": "*",
|
||||||
"@types/estree": "*"
|
"@types/estree": "*"
|
||||||
@@ -162,8 +155,7 @@
|
|||||||
"version": "1.0.7",
|
"version": "1.0.7",
|
||||||
"resolved": "https://registry.npmmirror.com/@types/estree/-/estree-1.0.7.tgz",
|
"resolved": "https://registry.npmmirror.com/@types/estree/-/estree-1.0.7.tgz",
|
||||||
"integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==",
|
"integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/@types/json-schema": {
|
"node_modules/@types/json-schema": {
|
||||||
"version": "7.0.15",
|
"version": "7.0.15",
|
||||||
@@ -176,7 +168,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/@types/node/-/node-22.14.1.tgz",
|
"resolved": "https://registry.npmmirror.com/@types/node/-/node-22.14.1.tgz",
|
||||||
"integrity": "sha512-u0HuPQwe/dHrItgHHpmw3N2fYCR6x4ivMNbPHRkBVP4CvN+kiRrKHWk3i8tXiO/joPwXLMYvF9TTF0eqgHIuOw==",
|
"integrity": "sha512-u0HuPQwe/dHrItgHHpmw3N2fYCR6x4ivMNbPHRkBVP4CvN+kiRrKHWk3i8tXiO/joPwXLMYvF9TTF0eqgHIuOw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"undici-types": "~6.21.0"
|
"undici-types": "~6.21.0"
|
||||||
}
|
}
|
||||||
@@ -186,7 +177,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/@webassemblyjs/ast/-/ast-1.14.1.tgz",
|
"resolved": "https://registry.npmmirror.com/@webassemblyjs/ast/-/ast-1.14.1.tgz",
|
||||||
"integrity": "sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==",
|
"integrity": "sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@webassemblyjs/helper-numbers": "1.13.2",
|
"@webassemblyjs/helper-numbers": "1.13.2",
|
||||||
"@webassemblyjs/helper-wasm-bytecode": "1.13.2"
|
"@webassemblyjs/helper-wasm-bytecode": "1.13.2"
|
||||||
@@ -196,29 +186,25 @@
|
|||||||
"version": "1.13.2",
|
"version": "1.13.2",
|
||||||
"resolved": "https://registry.npmmirror.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.13.2.tgz",
|
"resolved": "https://registry.npmmirror.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.13.2.tgz",
|
||||||
"integrity": "sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==",
|
"integrity": "sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/@webassemblyjs/helper-api-error": {
|
"node_modules/@webassemblyjs/helper-api-error": {
|
||||||
"version": "1.13.2",
|
"version": "1.13.2",
|
||||||
"resolved": "https://registry.npmmirror.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.13.2.tgz",
|
"resolved": "https://registry.npmmirror.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.13.2.tgz",
|
||||||
"integrity": "sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==",
|
"integrity": "sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/@webassemblyjs/helper-buffer": {
|
"node_modules/@webassemblyjs/helper-buffer": {
|
||||||
"version": "1.14.1",
|
"version": "1.14.1",
|
||||||
"resolved": "https://registry.npmmirror.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.14.1.tgz",
|
"resolved": "https://registry.npmmirror.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.14.1.tgz",
|
||||||
"integrity": "sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==",
|
"integrity": "sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/@webassemblyjs/helper-numbers": {
|
"node_modules/@webassemblyjs/helper-numbers": {
|
||||||
"version": "1.13.2",
|
"version": "1.13.2",
|
||||||
"resolved": "https://registry.npmmirror.com/@webassemblyjs/helper-numbers/-/helper-numbers-1.13.2.tgz",
|
"resolved": "https://registry.npmmirror.com/@webassemblyjs/helper-numbers/-/helper-numbers-1.13.2.tgz",
|
||||||
"integrity": "sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==",
|
"integrity": "sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@webassemblyjs/floating-point-hex-parser": "1.13.2",
|
"@webassemblyjs/floating-point-hex-parser": "1.13.2",
|
||||||
"@webassemblyjs/helper-api-error": "1.13.2",
|
"@webassemblyjs/helper-api-error": "1.13.2",
|
||||||
@@ -229,15 +215,13 @@
|
|||||||
"version": "1.13.2",
|
"version": "1.13.2",
|
||||||
"resolved": "https://registry.npmmirror.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.13.2.tgz",
|
"resolved": "https://registry.npmmirror.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.13.2.tgz",
|
||||||
"integrity": "sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==",
|
"integrity": "sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/@webassemblyjs/helper-wasm-section": {
|
"node_modules/@webassemblyjs/helper-wasm-section": {
|
||||||
"version": "1.14.1",
|
"version": "1.14.1",
|
||||||
"resolved": "https://registry.npmmirror.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.14.1.tgz",
|
"resolved": "https://registry.npmmirror.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.14.1.tgz",
|
||||||
"integrity": "sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==",
|
"integrity": "sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@webassemblyjs/ast": "1.14.1",
|
"@webassemblyjs/ast": "1.14.1",
|
||||||
"@webassemblyjs/helper-buffer": "1.14.1",
|
"@webassemblyjs/helper-buffer": "1.14.1",
|
||||||
@@ -250,7 +234,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/@webassemblyjs/ieee754/-/ieee754-1.13.2.tgz",
|
"resolved": "https://registry.npmmirror.com/@webassemblyjs/ieee754/-/ieee754-1.13.2.tgz",
|
||||||
"integrity": "sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==",
|
"integrity": "sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@xtuc/ieee754": "^1.2.0"
|
"@xtuc/ieee754": "^1.2.0"
|
||||||
}
|
}
|
||||||
@@ -260,7 +243,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/@webassemblyjs/leb128/-/leb128-1.13.2.tgz",
|
"resolved": "https://registry.npmmirror.com/@webassemblyjs/leb128/-/leb128-1.13.2.tgz",
|
||||||
"integrity": "sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==",
|
"integrity": "sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@xtuc/long": "4.2.2"
|
"@xtuc/long": "4.2.2"
|
||||||
}
|
}
|
||||||
@@ -269,15 +251,13 @@
|
|||||||
"version": "1.13.2",
|
"version": "1.13.2",
|
||||||
"resolved": "https://registry.npmmirror.com/@webassemblyjs/utf8/-/utf8-1.13.2.tgz",
|
"resolved": "https://registry.npmmirror.com/@webassemblyjs/utf8/-/utf8-1.13.2.tgz",
|
||||||
"integrity": "sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==",
|
"integrity": "sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/@webassemblyjs/wasm-edit": {
|
"node_modules/@webassemblyjs/wasm-edit": {
|
||||||
"version": "1.14.1",
|
"version": "1.14.1",
|
||||||
"resolved": "https://registry.npmmirror.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.14.1.tgz",
|
"resolved": "https://registry.npmmirror.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.14.1.tgz",
|
||||||
"integrity": "sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==",
|
"integrity": "sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@webassemblyjs/ast": "1.14.1",
|
"@webassemblyjs/ast": "1.14.1",
|
||||||
"@webassemblyjs/helper-buffer": "1.14.1",
|
"@webassemblyjs/helper-buffer": "1.14.1",
|
||||||
@@ -294,7 +274,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.14.1.tgz",
|
"resolved": "https://registry.npmmirror.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.14.1.tgz",
|
||||||
"integrity": "sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==",
|
"integrity": "sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@webassemblyjs/ast": "1.14.1",
|
"@webassemblyjs/ast": "1.14.1",
|
||||||
"@webassemblyjs/helper-wasm-bytecode": "1.13.2",
|
"@webassemblyjs/helper-wasm-bytecode": "1.13.2",
|
||||||
@@ -308,7 +287,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.14.1.tgz",
|
"resolved": "https://registry.npmmirror.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.14.1.tgz",
|
||||||
"integrity": "sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==",
|
"integrity": "sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@webassemblyjs/ast": "1.14.1",
|
"@webassemblyjs/ast": "1.14.1",
|
||||||
"@webassemblyjs/helper-buffer": "1.14.1",
|
"@webassemblyjs/helper-buffer": "1.14.1",
|
||||||
@@ -321,7 +299,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.14.1.tgz",
|
"resolved": "https://registry.npmmirror.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.14.1.tgz",
|
||||||
"integrity": "sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==",
|
"integrity": "sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@webassemblyjs/ast": "1.14.1",
|
"@webassemblyjs/ast": "1.14.1",
|
||||||
"@webassemblyjs/helper-api-error": "1.13.2",
|
"@webassemblyjs/helper-api-error": "1.13.2",
|
||||||
@@ -336,7 +313,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/@webassemblyjs/wast-printer/-/wast-printer-1.14.1.tgz",
|
"resolved": "https://registry.npmmirror.com/@webassemblyjs/wast-printer/-/wast-printer-1.14.1.tgz",
|
||||||
"integrity": "sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==",
|
"integrity": "sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@webassemblyjs/ast": "1.14.1",
|
"@webassemblyjs/ast": "1.14.1",
|
||||||
"@xtuc/long": "4.2.2"
|
"@xtuc/long": "4.2.2"
|
||||||
@@ -346,22 +322,19 @@
|
|||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmmirror.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz",
|
"resolved": "https://registry.npmmirror.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz",
|
||||||
"integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==",
|
"integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/@xtuc/long": {
|
"node_modules/@xtuc/long": {
|
||||||
"version": "4.2.2",
|
"version": "4.2.2",
|
||||||
"resolved": "https://registry.npmmirror.com/@xtuc/long/-/long-4.2.2.tgz",
|
"resolved": "https://registry.npmmirror.com/@xtuc/long/-/long-4.2.2.tgz",
|
||||||
"integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==",
|
"integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/acorn": {
|
"node_modules/acorn": {
|
||||||
"version": "8.14.1",
|
"version": "8.14.1",
|
||||||
"resolved": "https://registry.npmmirror.com/acorn/-/acorn-8.14.1.tgz",
|
"resolved": "https://registry.npmmirror.com/acorn/-/acorn-8.14.1.tgz",
|
||||||
"integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==",
|
"integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"acorn": "bin/acorn"
|
"acorn": "bin/acorn"
|
||||||
},
|
},
|
||||||
@@ -374,6 +347,7 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/ajv/-/ajv-8.16.0.tgz",
|
"resolved": "https://registry.npmmirror.com/ajv/-/ajv-8.16.0.tgz",
|
||||||
"integrity": "sha512-F0twR8U1ZU67JIEtekUcLkXkoO5mMMmgGD8sK/xUFzJ805jxHQl92hImFAqqXMyMYjSPOyUPAwHYhB72g5sTXw==",
|
"integrity": "sha512-F0twR8U1ZU67JIEtekUcLkXkoO5mMMmgGD8sK/xUFzJ805jxHQl92hImFAqqXMyMYjSPOyUPAwHYhB72g5sTXw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fast-deep-equal": "^3.1.3",
|
"fast-deep-equal": "^3.1.3",
|
||||||
"json-schema-traverse": "^1.0.0",
|
"json-schema-traverse": "^1.0.0",
|
||||||
@@ -547,8 +521,7 @@
|
|||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
"resolved": "https://registry.npmmirror.com/buffer-from/-/buffer-from-1.1.2.tgz",
|
"resolved": "https://registry.npmmirror.com/buffer-from/-/buffer-from-1.1.2.tgz",
|
||||||
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
|
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/caniuse-lite": {
|
"node_modules/caniuse-lite": {
|
||||||
"version": "1.0.30001715",
|
"version": "1.0.30001715",
|
||||||
@@ -568,8 +541,7 @@
|
|||||||
"type": "github",
|
"type": "github",
|
||||||
"url": "https://github.com/sponsors/ai"
|
"url": "https://github.com/sponsors/ai"
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/chokidar": {
|
"node_modules/chokidar": {
|
||||||
"version": "3.6.0",
|
"version": "3.6.0",
|
||||||
@@ -612,7 +584,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz",
|
"resolved": "https://registry.npmmirror.com/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz",
|
||||||
"integrity": "sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==",
|
"integrity": "sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.0"
|
"node": ">=6.0"
|
||||||
}
|
}
|
||||||
@@ -631,8 +602,7 @@
|
|||||||
"version": "2.20.3",
|
"version": "2.20.3",
|
||||||
"resolved": "https://registry.npmmirror.com/commander/-/commander-2.20.3.tgz",
|
"resolved": "https://registry.npmmirror.com/commander/-/commander-2.20.3.tgz",
|
||||||
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
|
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/copy-webpack-plugin": {
|
"node_modules/copy-webpack-plugin": {
|
||||||
"version": "12.0.2",
|
"version": "12.0.2",
|
||||||
@@ -672,8 +642,7 @@
|
|||||||
"version": "1.5.141",
|
"version": "1.5.141",
|
||||||
"resolved": "https://registry.npmmirror.com/electron-to-chromium/-/electron-to-chromium-1.5.141.tgz",
|
"resolved": "https://registry.npmmirror.com/electron-to-chromium/-/electron-to-chromium-1.5.141.tgz",
|
||||||
"integrity": "sha512-qS+qH9oqVYc1ooubTiB9l904WVyM6qNYxtOEEGReoZXw3xlqeYdFr5GclNzbkAufWgwWLEPoDi3d9MoRwwIjGw==",
|
"integrity": "sha512-qS+qH9oqVYc1ooubTiB9l904WVyM6qNYxtOEEGReoZXw3xlqeYdFr5GclNzbkAufWgwWLEPoDi3d9MoRwwIjGw==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/emojis-list": {
|
"node_modules/emojis-list": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
@@ -689,7 +658,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/enhanced-resolve/-/enhanced-resolve-5.18.1.tgz",
|
"resolved": "https://registry.npmmirror.com/enhanced-resolve/-/enhanced-resolve-5.18.1.tgz",
|
||||||
"integrity": "sha512-ZSW3ma5GkcQBIpwZTSRAI8N71Uuwgs93IezB7mf7R60tC8ZbJideoDNKjHn2O9KIlx6rkGTTEk1xUCK2E1Y2Yg==",
|
"integrity": "sha512-ZSW3ma5GkcQBIpwZTSRAI8N71Uuwgs93IezB7mf7R60tC8ZbJideoDNKjHn2O9KIlx6rkGTTEk1xUCK2E1Y2Yg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"graceful-fs": "^4.2.4",
|
"graceful-fs": "^4.2.4",
|
||||||
"tapable": "^2.2.0"
|
"tapable": "^2.2.0"
|
||||||
@@ -702,15 +670,13 @@
|
|||||||
"version": "1.7.0",
|
"version": "1.7.0",
|
||||||
"resolved": "https://registry.npmmirror.com/es-module-lexer/-/es-module-lexer-1.7.0.tgz",
|
"resolved": "https://registry.npmmirror.com/es-module-lexer/-/es-module-lexer-1.7.0.tgz",
|
||||||
"integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==",
|
"integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/escalade": {
|
"node_modules/escalade": {
|
||||||
"version": "3.2.0",
|
"version": "3.2.0",
|
||||||
"resolved": "https://registry.npmmirror.com/escalade/-/escalade-3.2.0.tgz",
|
"resolved": "https://registry.npmmirror.com/escalade/-/escalade-3.2.0.tgz",
|
||||||
"integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
|
"integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
@@ -720,7 +686,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/eslint-scope/-/eslint-scope-5.1.1.tgz",
|
"resolved": "https://registry.npmmirror.com/eslint-scope/-/eslint-scope-5.1.1.tgz",
|
||||||
"integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==",
|
"integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"esrecurse": "^4.3.0",
|
"esrecurse": "^4.3.0",
|
||||||
"estraverse": "^4.1.1"
|
"estraverse": "^4.1.1"
|
||||||
@@ -734,7 +699,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/esrecurse/-/esrecurse-4.3.0.tgz",
|
"resolved": "https://registry.npmmirror.com/esrecurse/-/esrecurse-4.3.0.tgz",
|
||||||
"integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
|
"integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"estraverse": "^5.2.0"
|
"estraverse": "^5.2.0"
|
||||||
},
|
},
|
||||||
@@ -747,7 +711,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/estraverse/-/estraverse-5.3.0.tgz",
|
"resolved": "https://registry.npmmirror.com/estraverse/-/estraverse-5.3.0.tgz",
|
||||||
"integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
|
"integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=4.0"
|
"node": ">=4.0"
|
||||||
}
|
}
|
||||||
@@ -757,7 +720,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/estraverse/-/estraverse-4.3.0.tgz",
|
"resolved": "https://registry.npmmirror.com/estraverse/-/estraverse-4.3.0.tgz",
|
||||||
"integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
|
"integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=4.0"
|
"node": ">=4.0"
|
||||||
}
|
}
|
||||||
@@ -767,7 +729,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/events/-/events-3.3.0.tgz",
|
"resolved": "https://registry.npmmirror.com/events/-/events-3.3.0.tgz",
|
||||||
"integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==",
|
"integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.8.x"
|
"node": ">=0.8.x"
|
||||||
}
|
}
|
||||||
@@ -863,8 +824,7 @@
|
|||||||
"version": "0.4.1",
|
"version": "0.4.1",
|
||||||
"resolved": "https://registry.npmmirror.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz",
|
"resolved": "https://registry.npmmirror.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz",
|
||||||
"integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==",
|
"integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/globby": {
|
"node_modules/globby": {
|
||||||
"version": "14.0.2",
|
"version": "14.0.2",
|
||||||
@@ -908,15 +868,13 @@
|
|||||||
"version": "4.2.11",
|
"version": "4.2.11",
|
||||||
"resolved": "https://registry.npmmirror.com/graceful-fs/-/graceful-fs-4.2.11.tgz",
|
"resolved": "https://registry.npmmirror.com/graceful-fs/-/graceful-fs-4.2.11.tgz",
|
||||||
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
|
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/has-flag": {
|
"node_modules/has-flag": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmmirror.com/has-flag/-/has-flag-4.0.0.tgz",
|
"resolved": "https://registry.npmmirror.com/has-flag/-/has-flag-4.0.0.tgz",
|
||||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
@@ -1001,7 +959,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/jest-worker/-/jest-worker-27.5.1.tgz",
|
"resolved": "https://registry.npmmirror.com/jest-worker/-/jest-worker-27.5.1.tgz",
|
||||||
"integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==",
|
"integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"merge-stream": "^2.0.0",
|
"merge-stream": "^2.0.0",
|
||||||
@@ -1030,8 +987,7 @@
|
|||||||
"version": "2.3.1",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmmirror.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz",
|
"resolved": "https://registry.npmmirror.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz",
|
||||||
"integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==",
|
"integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/json-schema-traverse": {
|
"node_modules/json-schema-traverse": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
@@ -1065,7 +1021,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/loader-runner/-/loader-runner-4.3.0.tgz",
|
"resolved": "https://registry.npmmirror.com/loader-runner/-/loader-runner-4.3.0.tgz",
|
||||||
"integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==",
|
"integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.11.5"
|
"node": ">=6.11.5"
|
||||||
}
|
}
|
||||||
@@ -1095,12 +1050,23 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/lodash/-/lodash-4.17.21.tgz",
|
"resolved": "https://registry.npmmirror.com/lodash/-/lodash-4.17.21.tgz",
|
||||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
||||||
},
|
},
|
||||||
|
"node_modules/marked": {
|
||||||
|
"version": "4.3.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/marked/-/marked-4.3.0.tgz",
|
||||||
|
"integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"bin": {
|
||||||
|
"marked": "bin/marked.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 12"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/merge-stream": {
|
"node_modules/merge-stream": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmmirror.com/merge-stream/-/merge-stream-2.0.0.tgz",
|
"resolved": "https://registry.npmmirror.com/merge-stream/-/merge-stream-2.0.0.tgz",
|
||||||
"integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
|
"integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/merge2": {
|
"node_modules/merge2": {
|
||||||
"version": "1.4.1",
|
"version": "1.4.1",
|
||||||
@@ -1129,7 +1095,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz",
|
"resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz",
|
||||||
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.6"
|
"node": ">= 0.6"
|
||||||
}
|
}
|
||||||
@@ -1139,7 +1104,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz",
|
"resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz",
|
||||||
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"mime-db": "1.52.0"
|
"mime-db": "1.52.0"
|
||||||
},
|
},
|
||||||
@@ -1157,8 +1121,7 @@
|
|||||||
"version": "2.0.19",
|
"version": "2.0.19",
|
||||||
"resolved": "https://registry.npmmirror.com/node-releases/-/node-releases-2.0.19.tgz",
|
"resolved": "https://registry.npmmirror.com/node-releases/-/node-releases-2.0.19.tgz",
|
||||||
"integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==",
|
"integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/normalize-path": {
|
"node_modules/normalize-path": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
@@ -1185,8 +1148,7 @@
|
|||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmmirror.com/picocolors/-/picocolors-1.1.1.tgz",
|
"resolved": "https://registry.npmmirror.com/picocolors/-/picocolors-1.1.1.tgz",
|
||||||
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
|
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/picomatch": {
|
"node_modules/picomatch": {
|
||||||
"version": "2.3.1",
|
"version": "2.3.1",
|
||||||
@@ -1322,6 +1284,7 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/sass/-/sass-1.78.0.tgz",
|
"resolved": "https://registry.npmmirror.com/sass/-/sass-1.78.0.tgz",
|
||||||
"integrity": "sha512-AaIqGSrjo5lA2Yg7RvFZrlXDBCp3nV4XP73GrLGvdRWWwk+8H3l0SDvq/5bA4eF+0RFPLuWUk3E+P1U/YqnpsQ==",
|
"integrity": "sha512-AaIqGSrjo5lA2Yg7RvFZrlXDBCp3nV4XP73GrLGvdRWWwk+8H3l0SDvq/5bA4eF+0RFPLuWUk3E+P1U/YqnpsQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chokidar": ">=3.0.0 <4.0.0",
|
"chokidar": ">=3.0.0 <4.0.0",
|
||||||
"immutable": "^4.0.0",
|
"immutable": "^4.0.0",
|
||||||
@@ -1376,6 +1339,7 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/ajv/-/ajv-6.12.6.tgz",
|
"resolved": "https://registry.npmmirror.com/ajv/-/ajv-6.12.6.tgz",
|
||||||
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
|
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fast-deep-equal": "^3.1.1",
|
"fast-deep-equal": "^3.1.1",
|
||||||
"fast-json-stable-stringify": "^2.0.0",
|
"fast-json-stable-stringify": "^2.0.0",
|
||||||
@@ -1482,7 +1446,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/source-map/-/source-map-0.6.1.tgz",
|
"resolved": "https://registry.npmmirror.com/source-map/-/source-map-0.6.1.tgz",
|
||||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
@@ -1501,7 +1464,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/source-map-support/-/source-map-support-0.5.21.tgz",
|
"resolved": "https://registry.npmmirror.com/source-map-support/-/source-map-support-0.5.21.tgz",
|
||||||
"integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
|
"integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"buffer-from": "^1.0.0",
|
"buffer-from": "^1.0.0",
|
||||||
"source-map": "^0.6.0"
|
"source-map": "^0.6.0"
|
||||||
@@ -1512,7 +1474,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/supports-color/-/supports-color-8.1.1.tgz",
|
"resolved": "https://registry.npmmirror.com/supports-color/-/supports-color-8.1.1.tgz",
|
||||||
"integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
|
"integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"has-flag": "^4.0.0"
|
"has-flag": "^4.0.0"
|
||||||
},
|
},
|
||||||
@@ -1528,7 +1489,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/tapable/-/tapable-2.2.1.tgz",
|
"resolved": "https://registry.npmmirror.com/tapable/-/tapable-2.2.1.tgz",
|
||||||
"integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==",
|
"integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
@@ -1538,7 +1498,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/terser/-/terser-5.39.0.tgz",
|
"resolved": "https://registry.npmmirror.com/terser/-/terser-5.39.0.tgz",
|
||||||
"integrity": "sha512-LBAhFyLho16harJoWMg/nZsQYgTrg5jXOn2nCYjRUcZZEdE3qa2zb8QEDRUGVZBW4rlazf2fxkg8tztybTaqWw==",
|
"integrity": "sha512-LBAhFyLho16harJoWMg/nZsQYgTrg5jXOn2nCYjRUcZZEdE3qa2zb8QEDRUGVZBW4rlazf2fxkg8tztybTaqWw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jridgewell/source-map": "^0.3.3",
|
"@jridgewell/source-map": "^0.3.3",
|
||||||
"acorn": "^8.8.2",
|
"acorn": "^8.8.2",
|
||||||
@@ -1557,7 +1516,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.14.tgz",
|
"resolved": "https://registry.npmmirror.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.14.tgz",
|
||||||
"integrity": "sha512-vkZjpUjb6OMS7dhV+tILUW6BhpDR7P2L/aQSAv+Uwk+m8KATX9EccViHTJR2qDtACKPIYndLGCyl3FMo+r2LMw==",
|
"integrity": "sha512-vkZjpUjb6OMS7dhV+tILUW6BhpDR7P2L/aQSAv+Uwk+m8KATX9EccViHTJR2qDtACKPIYndLGCyl3FMo+r2LMw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jridgewell/trace-mapping": "^0.3.25",
|
"@jridgewell/trace-mapping": "^0.3.25",
|
||||||
"jest-worker": "^27.4.5",
|
"jest-worker": "^27.4.5",
|
||||||
@@ -1613,8 +1571,7 @@
|
|||||||
"version": "6.21.0",
|
"version": "6.21.0",
|
||||||
"resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-6.21.0.tgz",
|
"resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-6.21.0.tgz",
|
||||||
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
|
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/unicorn-magic": {
|
"node_modules/unicorn-magic": {
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
@@ -1647,7 +1604,6 @@
|
|||||||
"url": "https://github.com/sponsors/ai"
|
"url": "https://github.com/sponsors/ai"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"escalade": "^3.2.0",
|
"escalade": "^3.2.0",
|
||||||
"picocolors": "^1.1.1"
|
"picocolors": "^1.1.1"
|
||||||
@@ -1685,7 +1641,6 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/watchpack/-/watchpack-2.4.2.tgz",
|
"resolved": "https://registry.npmmirror.com/watchpack/-/watchpack-2.4.2.tgz",
|
||||||
"integrity": "sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw==",
|
"integrity": "sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"glob-to-regexp": "^0.4.1",
|
"glob-to-regexp": "^0.4.1",
|
||||||
"graceful-fs": "^4.1.2"
|
"graceful-fs": "^4.1.2"
|
||||||
@@ -1746,15 +1701,15 @@
|
|||||||
"resolved": "https://registry.npmmirror.com/webpack-sources/-/webpack-sources-3.2.3.tgz",
|
"resolved": "https://registry.npmmirror.com/webpack-sources/-/webpack-sources-3.2.3.tgz",
|
||||||
"integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==",
|
"integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.13.0"
|
"node": ">=10.13.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/ysk-utils": {
|
"node_modules/ysk-utils": {
|
||||||
"version": "1.0.78",
|
"version": "1.0.85",
|
||||||
"resolved": "https://registry.npmmirror.com/ysk-utils/-/ysk-utils-1.0.78.tgz",
|
"resolved": "https://registry.npmmirror.com/ysk-utils/-/ysk-utils-1.0.85.tgz",
|
||||||
"integrity": "sha512-Bgr5B3WWiy0nbgL91QVKoVPYm4wt13Rlav757zEjMVRHbmTjwFEhi3wJlYus0JGd52mbknSxXHMazAPHXwA7uQ==",
|
"integrity": "sha512-HkbV4Jidi3G6DAuGAN972tClUYtC2zVoxo4crrxexfn0rZa8HjXatUfEbawHOeEzyl6G1CdC+160I2bKfxEBlA==",
|
||||||
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bignumber.js": "^9.3.1",
|
"bignumber.js": "^9.3.1",
|
||||||
"loadsh": "^0.0.4",
|
"loadsh": "^0.0.4",
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
"pinia-plugin-unistorage": "^0.1.2",
|
"pinia-plugin-unistorage": "^0.1.2",
|
||||||
"to-arraybuffer": "^1.0.1",
|
"to-arraybuffer": "^1.0.1",
|
||||||
"uview-plus": "^3.3.32",
|
"uview-plus": "^3.3.32",
|
||||||
"ysk-utils": "^1.0.78"
|
"ysk-utils": "^1.0.85"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"copy-webpack-plugin": "^12.0.2",
|
"copy-webpack-plugin": "^12.0.2",
|
||||||
|
|||||||
@@ -1,188 +1,288 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="topTitle">
|
<view class="topTitle">耗材信息</view>
|
||||||
耗材信息
|
|
||||||
</view>
|
|
||||||
<view class="addConsumables">
|
<view class="addConsumables">
|
||||||
<view>
|
<view>
|
||||||
<view>
|
<view>
|
||||||
<view> 单位 </view>
|
<view>单位</view>
|
||||||
<view> <input type="text" placeholder="请输入单位" v-model="datas.form.conUnit" name="" id=""> </view>
|
<view><input type="text" placeholder="请输入单位" v-model="datas.form.conUnit" name="" id="" /></view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view> 耗材名称 </view>
|
<view>耗材名称</view>
|
||||||
<view> <input type="text" placeholder="请输入耗材名称" v-model="datas.form.conName" name="" id=""> </view>
|
<view><input type="text" placeholder="请输入耗材名称" v-model="datas.form.conName" name="" id="" /></view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view> 耗材价格 </view>
|
<view>耗材价格</view>
|
||||||
<view> <input class="uni-input" placeholder="请输入耗材价格" type="digit" v-model="datas.form.price" > </view>
|
<view><input class="uni-input" placeholder="请输入耗材价格" type="digit" v-model="datas.form.price" /></view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view> 预警值 </view>
|
<view>预警值</view>
|
||||||
<view> <input type="number" placeholder="请输入预警值" v-model="datas.form.conWarning" name="" id=""> </view>
|
<view><input type="number" placeholder="请输入预警值" v-model="datas.form.conWarning" name="" id="" /></view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="!datas.form.id" style="justify-content: space-between;">
|
<view v-if="!datas.form.id" style="justify-content: space-between">
|
||||||
<view> 耗材类型 </view>
|
<view>耗材类型</view>
|
||||||
<view style="width: 54%;" @tap="datas.show = !datas.show">
|
<view style="width: 54%" @tap="datas.show = !datas.show">
|
||||||
{{datas.consGroupName||'请选择耗材类型'}}
|
{{ datas.consGroupName || '请选择耗材类型' }}
|
||||||
</view>
|
</view>
|
||||||
<uni-icons type="bottom" size="16"></uni-icons>
|
<uni-icons type="bottom" size="16"></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<template v-if="datas.form.id">
|
||||||
|
<view class="tips-wrap">
|
||||||
|
<view class="content">
|
||||||
|
<u-icon name="error-circle-fill" color="#e6a23c" size="30"></u-icon>
|
||||||
|
<view class="info">
|
||||||
|
<text class="t1">提示</text>
|
||||||
|
<text class="t2">换算值为第二单位*第二单位转换数量=第一单位</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="form-wrap">
|
||||||
|
<view class="form">
|
||||||
|
<view class="row">
|
||||||
|
<view class="label">第二单位</view>
|
||||||
|
<view class="ipt">
|
||||||
|
<u-input placeholder="请输入第二单位" v-model="datas.form.conUnitTwo"></u-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="row">
|
||||||
|
<view class="label">第二单位转换数量</view>
|
||||||
|
<view class="ipt">
|
||||||
|
<u-input placeholder="请输入第二单位转换数量" v-model="datas.form.conUnitTwoConvert"></u-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="row">
|
||||||
|
<view class="label">默认入库单位</view>
|
||||||
|
<view class="ipt">
|
||||||
|
<u-radio-group v-model="datas.form.defaultUnit">
|
||||||
|
<u-radio :name="item" :label="item" v-for="(item, index) in unitList" :key="index"></u-radio>
|
||||||
|
</u-radio-group>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
<view class="bottombutton">
|
<view class="bottombutton">
|
||||||
<up-button type="primary" style="background-color: #318AFE;color: #fff;" @tap="sumbit" :plain="true"
|
<up-button type="primary" style="background-color: #318afe; color: #fff" @tap="sumbit" :plain="true" text="保存"></up-button>
|
||||||
text="保存"></up-button>
|
|
||||||
</view>
|
</view>
|
||||||
<up-picker :show="datas.show" :columns="datas.typeList" keyName="name" @cancel="datas.show=false" @confirm="confirmConsGroup" ></up-picker>
|
<up-picker :show="datas.show" :columns="datas.typeList" keyName="name" @cancel="datas.show = false" @confirm="confirmConsGroup"></up-picker>
|
||||||
<!-- 消息提示 -->
|
<!-- 消息提示 -->
|
||||||
<up-toast ref="uToastRef"></up-toast>
|
<up-toast ref="uToastRef"></up-toast>
|
||||||
|
<u-picker :show="unitShow" :columns="unitList"></u-picker>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive } from 'vue';
|
import { ref, reactive } from 'vue';
|
||||||
import { onLoad } from '@dcloudio/uni-app';
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
|
|
||||||
import { getConsGrpupList, addCons, editCons } from '@/http/api/cons.js';
|
import { getConsGrpupList, addCons, editCons } from '@/http/api/cons.js';
|
||||||
|
|
||||||
let datas = reactive({
|
let datas = reactive({
|
||||||
show: false,
|
show: false,
|
||||||
form: {
|
form: {
|
||||||
conUnit: '',
|
conUnit: '',
|
||||||
conName: '',
|
conName: '',
|
||||||
price: '',
|
price: '',
|
||||||
conWarning: 999,
|
conWarning: 999,
|
||||||
consGroupId: null,
|
consGroupId: null,
|
||||||
},
|
conUnitTwo: '', // 第二单位
|
||||||
consGroupName: '',
|
conUnitTwoConvert: '', // 第二单位转换数量
|
||||||
typeList: [],
|
defaultUnit: 2
|
||||||
})
|
},
|
||||||
|
consGroupName: '',
|
||||||
|
typeList: []
|
||||||
|
});
|
||||||
|
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
if( options && options.item ) {
|
if (options && options.item) {
|
||||||
let obj = JSON.parse(options.item)
|
let obj = JSON.parse(decodeURIComponent(options.item));
|
||||||
datas.form = obj
|
datas.form = obj;
|
||||||
} else {
|
|
||||||
gettbConsTypeList()
|
unitList.value = [];
|
||||||
|
if (datas.form.conUnit !== '') {
|
||||||
|
unitList.value.push(datas.form.conUnit);
|
||||||
}
|
}
|
||||||
uni.setNavigationBarTitle({
|
if (datas.form.conUnitTwo !== '') {
|
||||||
title: !datas.form.id ? '添加耗材' : '编辑耗材'
|
unitList.value.push(datas.form.conUnitTwo);
|
||||||
})
|
}
|
||||||
})
|
console.log('datas.form', datas.form);
|
||||||
|
console.log('unitList.value', unitList.value);
|
||||||
/**
|
} else {
|
||||||
* 获取耗材类别
|
gettbConsTypeList();
|
||||||
*/
|
|
||||||
let gettbConsTypeList = () => {
|
|
||||||
getConsGrpupList({
|
|
||||||
page: 1,
|
|
||||||
size: 30,
|
|
||||||
}).then(res => {
|
|
||||||
datas.typeList = [res]
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
uni.setNavigationBarTitle({
|
||||||
|
title: !datas.form.id ? '添加耗材' : '编辑耗材'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
function confirmConsGroup(e){
|
/**
|
||||||
datas.show = false
|
* 获取耗材类别
|
||||||
datas.form.consGroupId = e.value[0].id
|
*/
|
||||||
datas.consGroupName = e.value[0].name
|
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) {
|
||||||
let sumbit = async () => {
|
uni.$utils.showToast('价格不能为空');
|
||||||
let conUnitdata = datas.form.conUnit.replace(/(^\s*)|(\s*$)/g, "")
|
return;
|
||||||
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()
|
|
||||||
}
|
}
|
||||||
|
if (!datas.form.consGroupId) {
|
||||||
|
uni.$utils.showToast('耗材类型不能为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!datas.form.id) {
|
||||||
|
await addCons({ ...datas.form });
|
||||||
|
} else {
|
||||||
|
await editCons({ ...datas.form });
|
||||||
|
}
|
||||||
|
uni.navigateBack();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 显示选择单位
|
||||||
|
const unitShow = ref(false);
|
||||||
|
// 单位列表
|
||||||
|
const unitList = ref([]);
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
page {
|
page {
|
||||||
background-color: #f9f9f9;
|
background-color: #f9f9f9;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
.topTitle {
|
.topTitle {
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
margin: 32rpx 28rpx;
|
margin: 32rpx 28rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.addConsumables {
|
.addConsumables {
|
||||||
width: 694rpx;
|
width: 694rpx;
|
||||||
height: 640rpx;
|
background: #ffffff;
|
||||||
background: #FFFFFF;
|
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
margin: 32rpx;
|
||||||
margin: 32rpx;
|
padding: 24rpx;
|
||||||
padding: 1rpx 24rpx;
|
box-sizing: border-box;
|
||||||
box-sizing: border-box;
|
|
||||||
|
|
||||||
>view {
|
> view {
|
||||||
>view {
|
> view {
|
||||||
width: 646rpx;
|
width: 646rpx;
|
||||||
|
height: 84rpx;
|
||||||
|
background: #fcfcfc;
|
||||||
|
border: 2rpx solid #f9f9f9;
|
||||||
|
margin-top: 32rpx;
|
||||||
|
.df;
|
||||||
|
|
||||||
|
> view:first-child {
|
||||||
|
width: 190rpx;
|
||||||
height: 84rpx;
|
height: 84rpx;
|
||||||
background: #fcfcfc;
|
line-height: 84rpx;
|
||||||
border: 2rpx solid #F9F9F9;
|
// text-align: left;
|
||||||
margin-top: 32rpx;
|
padding-left: 24rpx;
|
||||||
.df;
|
background: #f9f9f9;
|
||||||
|
border-radius: 8rpx 0rpx 0rpx 8rpx;
|
||||||
>view:first-child {
|
border: 2rpx solid #f9f9f9;
|
||||||
width: 190rpx;
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
height: 84rpx;
|
font-weight: 400;
|
||||||
line-height: 84rpx;
|
font-size: 32rpx;
|
||||||
// text-align: left;
|
color: #333333;
|
||||||
padding-left: 24rpx;
|
|
||||||
background: #F9F9F9;
|
|
||||||
border-radius: 8rpx 0rpx 0rpx 8rpx;
|
|
||||||
border: 2rpx solid #F9F9F9;
|
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 32rpx;
|
|
||||||
color: #333333;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.bottombutton {
|
.bottombutton {
|
||||||
margin-top: 84rpx;
|
margin-top: 84rpx;
|
||||||
padding: 0 24rpx;
|
padding: 0 24rpx;
|
||||||
|
|
||||||
>button {
|
> button {
|
||||||
width: 530rpx;
|
width: 530rpx;
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
border-radius: 56rpx 56rpx 56rpx 56rpx;
|
border-radius: 56rpx 56rpx 56rpx 56rpx;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.status {
|
.status {
|
||||||
margin: 0 32rpx;
|
margin: 0 32rpx;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
// top: 100%;
|
// top: 100%;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.df() {
|
.df() {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.tips-wrap {
|
||||||
|
--pColor: #e6a23c;
|
||||||
|
--iColor: #fdf6ec;
|
||||||
|
padding: 0 28upx;
|
||||||
|
.content {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
padding: 28upx;
|
||||||
|
background-color: var(--iColor);
|
||||||
|
|
||||||
|
.info {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding-left: 10px;
|
||||||
|
gap: 8upx;
|
||||||
|
.t1 {
|
||||||
|
font-size: 32upx;
|
||||||
|
color: var(--pColor);
|
||||||
|
}
|
||||||
|
.t2 {
|
||||||
|
font-size: 24upx;
|
||||||
|
color: var(--pColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
.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>
|
</style>
|
||||||
773
pageConsumables/batch_in.vue
Normal file
773
pageConsumables/batch_in.vue
Normal file
@@ -0,0 +1,773 @@
|
|||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<u-form ref="formRef" :model="form" :rules="rules" label-position="top">
|
||||||
|
<view class="card">
|
||||||
|
<u-form-item>
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">第一步:上传图片</text>
|
||||||
|
<view class="btn">
|
||||||
|
<u-button type="primary" :disabled="!img" shape="circle" text="开始解析" @click="startCheckOcrRes"></u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<my-upload-img v-model="img"></my-upload-img>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
</view>
|
||||||
|
<view class="card" v-if="form.bodyList">
|
||||||
|
<u-form-item>
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">第二步:编辑信息</text>
|
||||||
|
</view>
|
||||||
|
<view class="top" style="margin-top: 10px">
|
||||||
|
<text class="t">供应商信息</text>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<view style="flex: 1">
|
||||||
|
<selectVendor v-model="form.vendorId" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item>
|
||||||
|
<view class="switch-wrap">
|
||||||
|
<view class="top">
|
||||||
|
<text class="t">耗材信息</text>
|
||||||
|
<view class="btn">
|
||||||
|
<u-button type="primary" shape="circle" text="选择耗材" @click="openSelectCons" v-if="!stockInStatus"></u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="info">
|
||||||
|
<view class="list-wrap">
|
||||||
|
<view class="top-tips">
|
||||||
|
<text class="tb">共{{ form.bodyList.length }}种耗材,</text>
|
||||||
|
<text class="tb">
|
||||||
|
金额合计:¥{{
|
||||||
|
multiplyAndFormat(
|
||||||
|
form.bodyList.reduce((sum, item) => sum + (item.purchasePrice || 0) * (item.inOutNumber || 0), 0),
|
||||||
|
1
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
<view class="item" v-for="(item, index) in form.bodyList" :key="index">
|
||||||
|
<view class="name">
|
||||||
|
<text class="t">{{ item.conName }}</text>
|
||||||
|
<view class="error-text" v-if="stockInStatus">
|
||||||
|
<u-text type="success" v-if="item.conId" text="入库成功" size="12"></u-text>
|
||||||
|
<u-text v-else type="error" :text="`入库失败:${item.failReason}`" size="12"></u-text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="content">
|
||||||
|
<view class="ctt-item">
|
||||||
|
<text class="t1">单价</text>
|
||||||
|
<text class="t2">{{ item.purchasePrice }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="ctt-item">
|
||||||
|
<text class="t1">单位</text>
|
||||||
|
<text class="t2">{{ item.unitName }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="ctt-item">
|
||||||
|
<text class="t1">数量</text>
|
||||||
|
<text class="t2">{{ item.inOutNumber }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="ctt-item">
|
||||||
|
<text class="t1">小计</text>
|
||||||
|
<text class="t2">{{ multiplyAndFormat(item.purchasePrice || 0, item.inOutNumber || 0) }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="footer-btn-wrap">
|
||||||
|
<view>
|
||||||
|
<u-text type="primary" text="编辑" @click="editorFormHandle(item, index)"></u-text>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
<u-text type="error" text="删除" @click="form.bodyList.splice(index, 1)"></u-text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item>
|
||||||
|
<view class="result_wrap" v-if="stockInStatus">
|
||||||
|
上传完成 共{{ form.bodyList.length }}条数据,其中成功
|
||||||
|
<u-text type="success" :text="form.bodyList.filter((item) => item.conId).length"></u-text>
|
||||||
|
条,失败
|
||||||
|
<u-text type="error" :text="form.bodyList.filter((item) => !item.conId).length"></u-text>
|
||||||
|
条
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
</view>
|
||||||
|
</u-form>
|
||||||
|
<u-popup :show="showEditorPopup" round="20" closeable @close="showEditorPopup = false">
|
||||||
|
<view class="editor-popup" v-if="form.bodyList && form.bodyList.length">
|
||||||
|
<view class="title">
|
||||||
|
<text class="t">{{ form.bodyList[editorIndex].conName }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="form">
|
||||||
|
<u-form ref="editorFormRef" :model="editorForm" :rules="editorFormRules" label-width="60px">
|
||||||
|
<u-form-item label="名称" prop="conName" required>
|
||||||
|
<u-input v-model="editorForm.conName" :maxlength="50" placeholder="请输入耗材名称"></u-input>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="单价" prop="purchasePrice" required>
|
||||||
|
<u-input
|
||||||
|
v-model="editorForm.purchasePrice"
|
||||||
|
placeholder="请输入耗材单价"
|
||||||
|
:maxlength="8"
|
||||||
|
@change="
|
||||||
|
(e) =>
|
||||||
|
mySetTimeout(() => {
|
||||||
|
editorForm.purchasePrice = filterNumberInput(e);
|
||||||
|
}, 50)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<template #suffix>
|
||||||
|
<text>元</text>
|
||||||
|
</template>
|
||||||
|
</u-input>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="单位" prop="unitName" required>
|
||||||
|
<u-input v-model="editorForm.unitName" :maxlength="20" placeholder="请选择耗材单位"></u-input>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="数量" prop="inOutNumber" required>
|
||||||
|
<u-input
|
||||||
|
v-model="editorForm.inOutNumber"
|
||||||
|
placeholder="请输入耗材数量"
|
||||||
|
:maxlength="8"
|
||||||
|
@change="
|
||||||
|
(e) =>
|
||||||
|
mySetTimeout(() => {
|
||||||
|
editorForm.inOutNumber = filterNumberInput(e, 1);
|
||||||
|
}, 50)
|
||||||
|
"
|
||||||
|
></u-input>
|
||||||
|
</u-form-item>
|
||||||
|
</u-form>
|
||||||
|
</view>
|
||||||
|
<view class="footer">
|
||||||
|
<view class="btn">
|
||||||
|
<u-button style="width: 100%" shape="circle" @click="showEditorPopup = false">取消</u-button>
|
||||||
|
</view>
|
||||||
|
<view class="btn">
|
||||||
|
<u-button type="primary" style="width: 100%" shape="circle" @click="editorFormSubmitHandle">确认</u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
<my-footer-btn type="horizontal" showCancel @confirm="submitHandle" @cancel="backHandle"></my-footer-btn>
|
||||||
|
<!-- 选择耗材 -->
|
||||||
|
<selectCons ref="selectConsRef" @success="selectConsSuccess" />
|
||||||
|
<view class="loading-page" v-if="checkLoading">
|
||||||
|
<view class="loader"></view>
|
||||||
|
<text class="t">{{ loadingText }}</text>
|
||||||
|
<view class="btn">
|
||||||
|
<u-button type="primary" @click="closeCheckOcrHandle">取消查询</u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import _ from 'lodash';
|
||||||
|
import { ref, computed } from 'vue';
|
||||||
|
import { multiplyAndFormat, filterNumberInput } from '@/utils/index.js';
|
||||||
|
import { stockOcr, ocrResult } from '@/http/api/product.js';
|
||||||
|
import { consStockIn } from '@/http/api/cons.js';
|
||||||
|
import selectVendor from './components/select-vendor.vue';
|
||||||
|
import selectCons from './components/select-cons.vue';
|
||||||
|
|
||||||
|
const selectConsRef = ref(null);
|
||||||
|
function selectConsSuccess(e) {
|
||||||
|
console.log('selectVendorHandle===', e);
|
||||||
|
let arr = e.map((item) => ({
|
||||||
|
id: item.id,
|
||||||
|
conId: item.id,
|
||||||
|
conName: item.conName,
|
||||||
|
purchasePrice: item.price,
|
||||||
|
unitName: item.conUnit,
|
||||||
|
inOutNumber: 1
|
||||||
|
}));
|
||||||
|
form.value.bodyList.push(...arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
function openSelectCons() {
|
||||||
|
const comp = selectConsRef.value;
|
||||||
|
if (comp && typeof comp.show === 'function') {
|
||||||
|
comp.show();
|
||||||
|
} else {
|
||||||
|
console.warn('selectConsRef not ready or show() not available', comp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 封装全局定时器,适配多端
|
||||||
|
const mySetTimeout = (fn, delay) => {
|
||||||
|
if (typeof uni !== 'undefined') {
|
||||||
|
return setTimeout(fn, delay); // 小程序
|
||||||
|
} else {
|
||||||
|
return window.setTimeout(fn, delay); // H5
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 编辑耗材 start
|
||||||
|
const showEditorPopup = ref(false);
|
||||||
|
const editorFormRef = ref(null);
|
||||||
|
const editorIndex = ref(0);
|
||||||
|
const editorForm = ref({
|
||||||
|
conName: '',
|
||||||
|
purchasePrice: '',
|
||||||
|
unitName: '',
|
||||||
|
inOutNumber: ''
|
||||||
|
});
|
||||||
|
const editorFormRules = ref({
|
||||||
|
conName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (editorForm.value.conName === '') {
|
||||||
|
return callback(new Error('请输入耗材名称'));
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
purchasePrice: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (editorForm.value.purchasePrice === '') {
|
||||||
|
return callback(new Error('请输入耗材单价'));
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
unitName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (editorForm.value.unitName === '') {
|
||||||
|
return callback(new Error('请选择耗材单位'));
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
inOutNumber: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (editorForm.value.inOutNumber === '') {
|
||||||
|
return callback(new Error('请输入耗材数量'));
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
// 显示编辑
|
||||||
|
function editorFormHandle(item, index) {
|
||||||
|
editorForm.value = _.cloneDeep(item);
|
||||||
|
editorIndex.value = index;
|
||||||
|
showEditorPopup.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function editorFormSubmitHandle() {
|
||||||
|
editorFormRef.value
|
||||||
|
.validate()
|
||||||
|
.then(() => {
|
||||||
|
form.value.bodyList[editorIndex.value] = _.cloneDeep(editorForm.value);
|
||||||
|
showEditorPopup.value = false;
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
}
|
||||||
|
// 编辑耗材 end
|
||||||
|
|
||||||
|
const resId = ref(null);
|
||||||
|
const img = ref('');
|
||||||
|
const stockInStatus = ref(false);
|
||||||
|
const form = ref({});
|
||||||
|
// const form = ref({
|
||||||
|
// actualPaymentAmount: null,
|
||||||
|
// amountPayable: 1680,
|
||||||
|
// batchNo: 'XS25110410003',
|
||||||
|
// bodyList: [
|
||||||
|
// { conId: '', conName: '哈根达斯-小杯(草莓)', failReason: '', inOutNumber: 24, purchasePrice: 35, subTotal: 840, unitName: '杯' },
|
||||||
|
// { conId: '', conName: '哈根达斯-小杯(香草)', failReason: '', inOutNumber: 24, purchasePrice: 35, subTotal: 840, unitName: '杯' },
|
||||||
|
// { conId: '', conName: '哈根达斯-小杯(比利时巧克力)', failReason: '', inOutNumber: 12, purchasePrice: 0, subTotal: 0, unitName: '杯' },
|
||||||
|
// { conId: '', conName: '哈根达斯-小杯(夏威夷果仁)', failReason: '', inOutNumber: 12, purchasePrice: 0, subTotal: 0, unitName: '杯' }
|
||||||
|
// ],
|
||||||
|
// inOutDate: '2025-11-04',
|
||||||
|
// ocrSaleOrder: {
|
||||||
|
// customerName: '大客河景餐厅',
|
||||||
|
// date: '2025-11-04',
|
||||||
|
// documentType: '销售单',
|
||||||
|
// items: [
|
||||||
|
// { conName: '哈根达斯-小杯(草莓)', inOutNumber: '24', purchasePrice: '35', spec: '81g', subTotal: '840', unitName: '杯' },
|
||||||
|
// { conName: '哈根达斯-小杯(香草)', inOutNumber: '24', purchasePrice: '35', spec: '81g', subTotal: '840', unitName: '杯' },
|
||||||
|
// { conName: '哈根达斯-小杯(比利时巧克力)', inOutNumber: '12', purchasePrice: '0', spec: '81g', subTotal: '0', unitName: '杯' },
|
||||||
|
// { conName: '哈根达斯-小杯(夏威夷果仁)', inOutNumber: '12', purchasePrice: '0', spec: '81g', subTotal: '0', unitName: '杯' }
|
||||||
|
// ],
|
||||||
|
// operator: '陈钦楠',
|
||||||
|
// orderNumber: 'XS25110410003',
|
||||||
|
// remark: '',
|
||||||
|
// totalAmount: '1680'
|
||||||
|
// },
|
||||||
|
// paymentDate: null,
|
||||||
|
// remark: '',
|
||||||
|
// unInCons: [],
|
||||||
|
// vendorId: null
|
||||||
|
// });
|
||||||
|
|
||||||
|
const rules = ref({});
|
||||||
|
|
||||||
|
// 查询OCR结果
|
||||||
|
async function startCheckOcrRes() {
|
||||||
|
try {
|
||||||
|
resId.value = await stockOcr({ url: img.value });
|
||||||
|
stockInStatus.value = false;
|
||||||
|
startQueryInterval()
|
||||||
|
.then((res) => {
|
||||||
|
// console.log('查询成功', JSON.stringify(res));
|
||||||
|
form.value = res;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('查询失败', error);
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开始查询ocr结果
|
||||||
|
// 启动查询方法,每5秒查询一次,五分钟后超时停止查询
|
||||||
|
const checkLoading = ref(false);
|
||||||
|
const speed = 10000; // 查询间隔时间,单位毫秒
|
||||||
|
const timeout = 300000; // 超时时间,单位毫秒
|
||||||
|
// const timeout = 15000; // 超时时间,单位毫秒
|
||||||
|
const interval = ref(null);
|
||||||
|
const checkNumber = ref(0);
|
||||||
|
const loadingText = computed(() => `每${speed / 1000}秒查询1次,已查询:${checkNumber.value}次`);
|
||||||
|
function startQueryInterval() {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (!resId.value) {
|
||||||
|
reject(new Error('无效的 resId,无法查询'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置计数并显示 loading
|
||||||
|
checkNumber.value = 0;
|
||||||
|
checkLoading.value = true;
|
||||||
|
|
||||||
|
const startTime = Date.now();
|
||||||
|
interval.value = null;
|
||||||
|
|
||||||
|
async function checkOnce() {
|
||||||
|
try {
|
||||||
|
checkNumber.value++;
|
||||||
|
console.log('ocr checkNumber:', checkNumber.value);
|
||||||
|
checkLoading.value = true;
|
||||||
|
const res = await ocrResult({ id: resId.value });
|
||||||
|
if (res && res.batchNo) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '查询成功',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
checkLoading.value = false;
|
||||||
|
}, 1000);
|
||||||
|
clearInterval(interval.value);
|
||||||
|
resolve(res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果还未超时,则继续等待下一轮查询
|
||||||
|
if (Date.now() - startTime >= timeout) {
|
||||||
|
setTimeout(() => {
|
||||||
|
checkLoading.value = false;
|
||||||
|
}, 1000);
|
||||||
|
uni.showToast({
|
||||||
|
title: '查询超时',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
clearInterval(interval.value);
|
||||||
|
reject(new Error('查询超时'));
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '查询失败',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
checkLoading.value = false;
|
||||||
|
}, 1000);
|
||||||
|
clearInterval(interval.value);
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 立即执行一次查询,然后按间隔继续查询
|
||||||
|
checkOnce();
|
||||||
|
interval.value = setInterval(checkOnce, speed);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消查询
|
||||||
|
function closeCheckOcrHandle() {
|
||||||
|
checkLoading.value = false;
|
||||||
|
clearInterval(interval.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交批量入库
|
||||||
|
async function submitHandle() {
|
||||||
|
try {
|
||||||
|
console.log('submitHandle', form.value);
|
||||||
|
uni.showLoading({
|
||||||
|
title: '提交中...',
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
const res = await consStockIn(form.value);
|
||||||
|
form.value = res;
|
||||||
|
stockInStatus.value = true;
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '提交成功',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}, 100);
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回
|
||||||
|
function backHandle() {
|
||||||
|
uni.navigateBack();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
page {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.container {
|
||||||
|
padding: 28upx;
|
||||||
|
}
|
||||||
|
.card {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 20px;
|
||||||
|
padding: 28upx;
|
||||||
|
&:not(:last-child) {
|
||||||
|
margin-bottom: 28upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.switch-wrap {
|
||||||
|
flex: 1;
|
||||||
|
width: 100%;
|
||||||
|
.top {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
&.column {
|
||||||
|
align-items: flex-start;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.two {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding-right: 28upx;
|
||||||
|
}
|
||||||
|
.t {
|
||||||
|
font-size: 32upx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.tips {
|
||||||
|
font-size: 24upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.info {
|
||||||
|
padding-top: 16upx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16upx;
|
||||||
|
.i {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.ipt {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.t {
|
||||||
|
font-size: 24upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.list-wrap {
|
||||||
|
flex: 1;
|
||||||
|
.top-tips {
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.item {
|
||||||
|
margin-top: 28upx;
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
border-radius: 12upx;
|
||||||
|
padding: 20upx;
|
||||||
|
.name {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.error-text {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.content {
|
||||||
|
display: flex;
|
||||||
|
padding: 28upx 0;
|
||||||
|
|
||||||
|
.ctt-item {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
&:last-child {
|
||||||
|
align-items: flex-end;
|
||||||
|
}
|
||||||
|
.t1 {
|
||||||
|
color: #666;
|
||||||
|
font-size: 28upx;
|
||||||
|
}
|
||||||
|
.t2 {
|
||||||
|
color: #333;
|
||||||
|
font-size: 28upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.footer-btn-wrap {
|
||||||
|
display: flex;
|
||||||
|
gap: 28upx;
|
||||||
|
justify-content: flex-end;
|
||||||
|
.btn {
|
||||||
|
width: 160upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.package-wrap {
|
||||||
|
flex: 1;
|
||||||
|
.list {
|
||||||
|
.item {
|
||||||
|
border: 1px solid #ececec;
|
||||||
|
border-radius: 12upx;
|
||||||
|
padding: 20upx;
|
||||||
|
&:not(:first-child) {
|
||||||
|
margin-top: 28upx;
|
||||||
|
}
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding-bottom: 20upx;
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.del {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.input-wrap {
|
||||||
|
display: flex;
|
||||||
|
gap: 20upx;
|
||||||
|
padding-bottom: 20upx;
|
||||||
|
.btn {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12upx;
|
||||||
|
.t {
|
||||||
|
color: #318afe;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.table-wrap {
|
||||||
|
padding-bottom: 20upx;
|
||||||
|
margin-bottom: 20upx;
|
||||||
|
.tab-head {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
.tr {
|
||||||
|
display: flex;
|
||||||
|
gap: 12upx;
|
||||||
|
padding: 20upx;
|
||||||
|
border-bottom: 1px solid #ececec;
|
||||||
|
.td {
|
||||||
|
flex: 1;
|
||||||
|
&:nth-child(1) {
|
||||||
|
flex: 2;
|
||||||
|
}
|
||||||
|
&:last-child {
|
||||||
|
flex: 0.5;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.del {
|
||||||
|
color: red;
|
||||||
|
font-size: 28upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.select_num_wrap {
|
||||||
|
padding-bottom: 28upx;
|
||||||
|
.label {
|
||||||
|
padding-bottom: 20upx;
|
||||||
|
.t {
|
||||||
|
color: #333;
|
||||||
|
font-size: 32upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.package-wrap-btn {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
padding-top: 28upx;
|
||||||
|
.btn {
|
||||||
|
display: flex;
|
||||||
|
gap: 8upx;
|
||||||
|
align-items: center;
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #318afe;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.step-wrap {
|
||||||
|
flex: 1;
|
||||||
|
.table-wrap {
|
||||||
|
padding-bottom: 20upx;
|
||||||
|
margin-bottom: 20upx;
|
||||||
|
.tab-head {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
.tr {
|
||||||
|
display: flex;
|
||||||
|
gap: 12upx;
|
||||||
|
padding: 20upx;
|
||||||
|
border-bottom: 1px solid #ececec;
|
||||||
|
.td {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
gap: 20upx;
|
||||||
|
align-items: center;
|
||||||
|
&:last-child {
|
||||||
|
flex: 0.6;
|
||||||
|
}
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.edit {
|
||||||
|
color: #318afe;
|
||||||
|
font-size: 28upx;
|
||||||
|
}
|
||||||
|
.del {
|
||||||
|
color: red;
|
||||||
|
font-size: 28upx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.editor-popup {
|
||||||
|
padding: 0 28upx;
|
||||||
|
.title {
|
||||||
|
padding: 28upx 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
.t {
|
||||||
|
font-size: 32upx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.form {
|
||||||
|
padding: 28upx;
|
||||||
|
}
|
||||||
|
.footer {
|
||||||
|
display: flex;
|
||||||
|
gap: 28upx;
|
||||||
|
.btn {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.result_wrap {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
.loading-page {
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
gap: 20upx;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background-color: #fff;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 999;
|
||||||
|
padding-bottom: 10vh;
|
||||||
|
.loader {
|
||||||
|
width: 50px;
|
||||||
|
aspect-ratio: 1;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: radial-gradient(farthest-side, #ffa516 94%, #0000) top/8px 8px no-repeat, conic-gradient(#0000 30%, #ffa516);
|
||||||
|
-webkit-mask: radial-gradient(farthest-side, #0000 calc(100% - 8px), #000 0);
|
||||||
|
animation: l13 1s infinite linear;
|
||||||
|
}
|
||||||
|
@keyframes l13 {
|
||||||
|
100% {
|
||||||
|
transform: rotate(1turn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.t {
|
||||||
|
font-size: 28upx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.btn {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 10%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
52
pageConsumables/components/select-cons.vue
Normal file
52
pageConsumables/components/select-cons.vue
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
<template>
|
||||||
|
<u-picker
|
||||||
|
title="选择耗材"
|
||||||
|
:show="visable"
|
||||||
|
:columns="columns"
|
||||||
|
keyName="conName"
|
||||||
|
@close="visable = false"
|
||||||
|
closeOnClickOverlay
|
||||||
|
@cancel="visable = false"
|
||||||
|
@confirm="confirmHandle"
|
||||||
|
></u-picker>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, onMounted } from 'vue';
|
||||||
|
import { getConsList } from '@/http/api/cons.js';
|
||||||
|
|
||||||
|
const visable = ref(false);
|
||||||
|
|
||||||
|
const columns = ref([]);
|
||||||
|
|
||||||
|
const emits = defineEmits(['success']);
|
||||||
|
|
||||||
|
function confirmHandle(e) {
|
||||||
|
emits('success', e.value);
|
||||||
|
visable.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取耗材列表
|
||||||
|
async function getConsListAjax() {
|
||||||
|
try {
|
||||||
|
const res = await getConsList();
|
||||||
|
columns.value = [res];
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function show() {
|
||||||
|
visable.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
show
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getConsListAjax();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss"></style>
|
||||||
56
pageConsumables/components/select-vendor.vue
Normal file
56
pageConsumables/components/select-vendor.vue
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<!-- 选择供应商 -->
|
||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<view @click="show = true">
|
||||||
|
<u-input v-model="vendorName" readonly suffixIcon="arrow-down" placeholder="请选择供应商"></u-input>
|
||||||
|
</view>
|
||||||
|
<u-picker
|
||||||
|
title="选择供应商"
|
||||||
|
:show="show"
|
||||||
|
:columns="columns"
|
||||||
|
keyName="name"
|
||||||
|
@close="show = false"
|
||||||
|
closeOnClickOverlay
|
||||||
|
@cancel="show = false"
|
||||||
|
@confirm="confirmHandle"
|
||||||
|
></u-picker>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, onMounted } from 'vue';
|
||||||
|
import { getVendorList } from '@/http/api/vendor.js';
|
||||||
|
|
||||||
|
const vendorName = ref('');
|
||||||
|
|
||||||
|
const vendorId = defineModel({
|
||||||
|
type: [String, Number],
|
||||||
|
default: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
const show = ref(false);
|
||||||
|
const columns = ref([]);
|
||||||
|
|
||||||
|
function confirmHandle(e) {
|
||||||
|
let data = e.value[0];
|
||||||
|
vendorId.value = data.id;
|
||||||
|
vendorName.value = data.name;
|
||||||
|
show.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取供应商列表
|
||||||
|
async function getVendorListAjax() {
|
||||||
|
try {
|
||||||
|
const res = await getVendorList();
|
||||||
|
columns.value = [res];
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getVendorListAjax();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss"></style>
|
||||||
@@ -1,453 +1,479 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="ConsumablesTop">
|
<view class="ConsumablesTop">
|
||||||
<view @tap="pageData.show = !pageData.show" style="display: flex;align-items: center;">
|
<view @tap="pageData.show = !pageData.show" style="display: flex; align-items: center">
|
||||||
{{pageData.title}}<up-icon name="arrow-down" size="12"></up-icon>
|
{{ pageData.title }}
|
||||||
|
<up-icon name="arrow-down" size="12"></up-icon>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<input v-model="pageData.query.conName" @input="inputEvent" type="text" placeholder="请输入耗材名称" />
|
<input v-model="pageData.query.conName" @input="inputEvent" type="text" placeholder="请输入耗材名称" />
|
||||||
</view>
|
</view>
|
||||||
<view @tap="toUrl('PAGES_ADD_TYPE') ">
|
<view @tap="toUrl('PAGES_ADD_TYPE')">新增类别</view>
|
||||||
新增类别
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="ConsumablesConent" v-if="pageData.list.length">
|
<view class="ConsumablesConent" v-if="pageData.list.length">
|
||||||
<view v-for="(item,index) in pageData.list" :key="index">
|
<view v-for="(item, index) in pageData.list" :key="index">
|
||||||
<view> {{item.conName}}
|
<view>
|
||||||
<view> {{item.consGroupName}} </view>
|
{{ item.conName }}
|
||||||
|
<view>{{ item.consGroupName }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view>
|
<view>
|
||||||
<view style="color: #333333;"> {{item.conUnit}} </view>
|
<view style="color: #333333">{{ item.conUnit }}</view>
|
||||||
<view> 耗材单位 </view>
|
<view>耗材单位</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view style="color: #318AFE;"> {{item.stockNumber}} </view>
|
<view style="color: #318afe">{{ item.stockNumber }}</view>
|
||||||
<view> 剩余库存 </view>
|
<view>剩余库存</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view style="background-color: #fff;" @tap="show=true;showData = filtersSproductId(item.productList)">
|
<view
|
||||||
|
style="background-color: #fff"
|
||||||
|
@tap="
|
||||||
|
show = true;
|
||||||
|
showData = filtersSproductId(item.productList);
|
||||||
|
"
|
||||||
|
>
|
||||||
所属商品:
|
所属商品:
|
||||||
{{ filtersSproductId(item.productList).length>7?filtersSproductId(item.productList).substring(0,6)+'...':filtersSproductId(item.productList)}}
|
{{ filtersSproductId(item.productList).length > 7 ? filtersSproductId(item.productList).substring(0, 6) + '...' : filtersSproductId(item.productList) }}
|
||||||
</view>
|
</view>
|
||||||
<view class="">
|
<view class="">
|
||||||
<up-button shape="circle" type="primary" size="mini" color="#999"
|
<up-button
|
||||||
@tap="toUrl('PAGES_VIEWRECORDS',{item:JSON.stringify(item)})" :plain="true"
|
shape="circle"
|
||||||
text="查看记录"></up-button>
|
type="primary"
|
||||||
<up-button type="primary" shape="circle" size="mini" @click="toggle(item)" :plain="true"
|
size="mini"
|
||||||
text="更多操作"></up-button>
|
color="#999"
|
||||||
|
@tap="toUrl('PAGES_VIEWRECORDS', { item: JSON.stringify(item) })"
|
||||||
|
:plain="true"
|
||||||
|
text="查看记录"
|
||||||
|
></up-button>
|
||||||
|
|
||||||
|
<up-button type="primary" shape="circle" size="mini" @click="toggle(item)" :plain="true" text="更多操作"></up-button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view style="background-color: rgba(0,0,0,0); height: 200rpx;"></view>
|
<view style="background-color: rgba(0, 0, 0, 0); height: 200rpx"></view>
|
||||||
</view>
|
</view>
|
||||||
<view v-else style="text-align: center;">
|
<view v-else style="text-align: center">
|
||||||
<image src="./bg.png" style="width: 325rpx;height: 335rpx;" mode=""></image>
|
<image src="./bg.png" style="width: 325rpx; height: 335rpx" mode=""></image>
|
||||||
<view style="font-size: 28rpx;color: #999;">暂无数据</view>
|
<view style="font-size: 28rpx; color: #999">暂无数据</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="ConsumablesBottom">
|
<view class="ConsumablesBottom">
|
||||||
<view @tap="toUrl('PAGES_ADD_CONSUMABLES')"> 新增耗材 </view>
|
<view @tap="toUrl('PAGES_ADD_CONSUMABLES')">新增耗材</view>
|
||||||
<view @tap="toUrl('PAGES_SUPPLIER')"> 供应商管理 </view>
|
<view @tap="toUrl('PAGES_SUPPLIER')">供应商管理</view>
|
||||||
</view>
|
</view>
|
||||||
<my-reportDamage ref="reportDamage" title="耗材报损" :item="report.data" @affirm="affirm"></my-reportDamage>
|
<my-reportDamage ref="reportDamage" title="耗材报损" :item="report.data" @affirm="affirm"></my-reportDamage>
|
||||||
|
<up-popup :show="show" :round="18" mode="center">
|
||||||
<up-popup :show="show" :round="18" mode="center" >
|
|
||||||
<view class="zhezhaopop">
|
<view class="zhezhaopop">
|
||||||
<view class="">
|
<view class="">
|
||||||
<span></span>
|
<span></span>
|
||||||
<span></span>
|
<span></span>
|
||||||
<up-icon @tap="show=false" name="close-circle-fill"></up-icon>
|
<up-icon @tap="show = false" name="close-circle-fill"></up-icon>
|
||||||
</view>
|
</view>
|
||||||
<view class="">
|
<view class="">
|
||||||
{{showData}}
|
{{ showData }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</up-popup>
|
</up-popup>
|
||||||
<up-action-sheet :round="10" @select="actionSelect" @close="actions.show = false" cancelText="取消" :actions="actions.list"
|
<up-action-sheet :round="10" @select="actionSelect" @close="actions.show = false" cancelText="取消" :actions="actions.list" :show="actions.show"></up-action-sheet>
|
||||||
:show="actions.show"></up-action-sheet>
|
<up-picker :show="pageData.show" :columns="pageData.typeList" keyName="name" @cancel="pageData.show = false" @confirm="confirmConsGroup"></up-picker>
|
||||||
<up-picker :show="pageData.show" :columns="pageData.typeList" keyName="name" @cancel="pageData.show=false" @confirm="confirmConsGroup" ></up-picker>
|
<!-- 批量入库悬浮按钮 -->
|
||||||
|
<view class="fixed-in-btn" @click="toBatchPage">
|
||||||
|
<image class="img" src="https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/bd8cde310fc247f6855ad39fbda4d75d.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onShow, onLoad } from '@dcloudio/uni-app'
|
import { onShow, onLoad } from '@dcloudio/uni-app';
|
||||||
import { ref, reactive, computed } from 'vue';
|
import { ref, reactive, computed } from 'vue';
|
||||||
import myReportDamage from './components/my-reportDamage';
|
import myReportDamage from './components/my-reportDamage';
|
||||||
|
|
||||||
import go from '@/commons/utils/go.js';
|
import go from '@/commons/utils/go.js';
|
||||||
import { hasPermission } from '@/commons/utils/hasPermission.js';
|
import { hasPermission } from '@/commons/utils/hasPermission.js';
|
||||||
import { getConsPage,getConsGrpupList } from '@/http/api/cons.js';
|
import { getConsPage, getConsGrpupList } from '@/http/api/cons.js';
|
||||||
|
|
||||||
let reportDamage = ref(null)
|
let reportDamage = ref(null);
|
||||||
let show = ref(false)
|
let show = ref(false);
|
||||||
let showData = ref()
|
let showData = ref();
|
||||||
const report = reactive({
|
const report = reactive({
|
||||||
data: {
|
data: {
|
||||||
name: "美式咖啡",
|
name: '美式咖啡',
|
||||||
unit: "杯",
|
unit: '杯'
|
||||||
},
|
|
||||||
})
|
|
||||||
let pageData = reactive({
|
|
||||||
show: false,
|
|
||||||
query: {
|
|
||||||
conName: '',
|
|
||||||
consGroupId: '',
|
|
||||||
size: 100,
|
|
||||||
page: 1
|
|
||||||
},
|
|
||||||
list: [],
|
|
||||||
// 类型列表
|
|
||||||
typeList: [],
|
|
||||||
title: '耗材类型'
|
|
||||||
})
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更多操作列表
|
|
||||||
*/
|
|
||||||
const actions = reactive({
|
|
||||||
list: [
|
|
||||||
{ name: '报损', color: 'red', fontSize: '16' },
|
|
||||||
{ name: '编辑', color: '#333', fontSize: '16' },
|
|
||||||
{ name: '清点', color: '#333', fontSize: '16' },
|
|
||||||
{ name: '入库', color: '#333', fontSize: '16' },
|
|
||||||
{ name: '出库', color: '#333', fontSize: '16' },
|
|
||||||
],
|
|
||||||
data: null,
|
|
||||||
show: false,
|
|
||||||
})
|
|
||||||
|
|
||||||
onShow(() => {
|
|
||||||
getList()
|
|
||||||
gettbConsTypeList()
|
|
||||||
})
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取耗材列表
|
|
||||||
*/
|
|
||||||
async function getList() {
|
|
||||||
getConsPage(pageData.query).then(res => {
|
|
||||||
pageData.list = res.records
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
let pageData = reactive({
|
||||||
|
show: false,
|
||||||
|
query: {
|
||||||
|
conName: '',
|
||||||
|
consGroupId: '',
|
||||||
|
size: 100,
|
||||||
|
page: 1
|
||||||
|
},
|
||||||
|
list: [],
|
||||||
|
// 类型列表
|
||||||
|
typeList: [],
|
||||||
|
title: '耗材类型'
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取耗材类别
|
* 更多操作列表
|
||||||
*/
|
*/
|
||||||
let gettbConsTypeList = () => {
|
const actions = reactive({
|
||||||
getConsGrpupList({
|
list: [
|
||||||
page: 1,
|
{ name: '报损', color: 'red', fontSize: '16' },
|
||||||
size: 30,
|
{ name: '编辑', color: '#333', fontSize: '16' },
|
||||||
}).then(res => {
|
{ name: '清点', color: '#333', fontSize: '16' },
|
||||||
pageData.typeList = [[{name:'全部',id:''},...res]]
|
{ name: '入库', color: '#333', fontSize: '16' },
|
||||||
})
|
{ name: '出库', color: '#333', fontSize: '16' }
|
||||||
}
|
],
|
||||||
|
data: null,
|
||||||
|
show: false
|
||||||
|
});
|
||||||
|
|
||||||
function confirmConsGroup(e){
|
onShow(() => {
|
||||||
pageData.show = false
|
getList();
|
||||||
pageData.query.consGroupId = e.value[0].id
|
gettbConsTypeList();
|
||||||
pageData.title = e.value[0].name
|
});
|
||||||
getList()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
// 跳转去批量入库
|
||||||
* 报损确认
|
function toBatchPage() {
|
||||||
*/
|
uni.navigateTo({
|
||||||
function affirm() {
|
url: '/pageConsumables/batch_in'
|
||||||
uni.showToast({
|
});
|
||||||
title:'操作成功',
|
}
|
||||||
icon:'none'
|
|
||||||
})
|
|
||||||
getList()
|
|
||||||
// 获取分类列表
|
|
||||||
gettbConsTypeList()
|
|
||||||
}
|
|
||||||
|
|
||||||
let toggle = (d) => {
|
/**
|
||||||
// refMoreSheet.value.open()
|
* 获取耗材列表
|
||||||
actions.show = true;
|
*/
|
||||||
actions.actions = d
|
async function getList() {
|
||||||
report.data.consId = d.id
|
getConsPage(pageData.query).then((res) => {
|
||||||
}
|
pageData.list = res.records;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let actionSelect = ( e ) => {
|
/**
|
||||||
if ( e.name == '报损' ) {
|
* 获取耗材类别
|
||||||
// 权限
|
*/
|
||||||
hasPermission('允许提交报损').then(ele => {
|
let gettbConsTypeList = () => {
|
||||||
if (ele) {
|
getConsGrpupList({
|
||||||
//打开报损弹窗
|
page: 1,
|
||||||
reportDamage.value.open(actions.actions.id);
|
size: 30
|
||||||
report.data.name = actions.actions.conName
|
}).then((res) => {
|
||||||
report.data.unit = actions.actions.conUnit
|
pageData.typeList = [[{ name: '全部', id: '' }, ...res]];
|
||||||
}
|
});
|
||||||
})
|
};
|
||||||
} else if ( e.name == '编辑' ) {
|
|
||||||
toUrl('PAGES_ADD_CONSUMABLES', {
|
|
||||||
item: JSON.stringify(actions.actions)
|
|
||||||
})
|
|
||||||
} else if ( e.name == '清点' ) {
|
|
||||||
hasPermission('允许耗材盘点').then(ele => {
|
|
||||||
if (ele) {
|
|
||||||
toUrl('PAGES_SALES_INVENTORYCHECK', {
|
|
||||||
item: JSON.stringify(actions.actions)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else if ( e.name == '入库' ) {
|
|
||||||
hasPermission('允许耗材入库').then(ele => {
|
|
||||||
if (ele) {
|
|
||||||
toUrl('PAGES_SALES_WAREHOUSEENTRY', {
|
|
||||||
consId: actions.actions.id,
|
|
||||||
item: JSON.stringify(actions.actions)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else if ( e.name == '出库' ) {
|
|
||||||
hasPermission('允许耗材出库').then(ele => {
|
|
||||||
if (ele) {
|
|
||||||
toUrl('PAGES_SALES_OUTBOUND', {
|
|
||||||
consId: actions.actions.id,
|
|
||||||
item: JSON.stringify(actions.actions)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function inputEvent(d) {
|
function confirmConsGroup(e) {
|
||||||
pageData.query.conName = d.detail.value.replace(/\s*/g, "");
|
pageData.show = false;
|
||||||
getList()
|
pageData.query.consGroupId = e.value[0].id;
|
||||||
}
|
pageData.title = e.value[0].name;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
|
||||||
function filtersSproductId(d) {
|
/**
|
||||||
if (!d) return ''
|
* 报损确认
|
||||||
// const dataArr = d.split(',')
|
*/
|
||||||
let str = ''
|
function affirm() {
|
||||||
d.forEach(ele => {
|
uni.showToast({
|
||||||
// str += ele.name
|
title: '操作成功',
|
||||||
// const startIndex = ele.indexOf('_')
|
icon: 'none'
|
||||||
// const productId = ele.slice(0, startIndex)
|
});
|
||||||
// const productName = ele.slice(startIndex + 1, ele.length)
|
getList();
|
||||||
str = ele.name + ',' + str
|
// 获取分类列表
|
||||||
})
|
gettbConsTypeList();
|
||||||
return str
|
}
|
||||||
}
|
|
||||||
let toUrl = (url, d) => {
|
let toggle = (d) => {
|
||||||
go.to(url, d)
|
// refMoreSheet.value.open()
|
||||||
|
actions.show = true;
|
||||||
|
actions.actions = d;
|
||||||
|
report.data.consId = d.id;
|
||||||
|
};
|
||||||
|
|
||||||
|
let actionSelect = (e) => {
|
||||||
|
if (e.name == '报损') {
|
||||||
|
// 权限
|
||||||
|
hasPermission('允许提交报损').then((ele) => {
|
||||||
|
if (ele) {
|
||||||
|
//打开报损弹窗
|
||||||
|
reportDamage.value.open(actions.actions.id);
|
||||||
|
report.data.name = actions.actions.conName;
|
||||||
|
report.data.unit = actions.actions.conUnit;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (e.name == '编辑') {
|
||||||
|
toUrl('PAGES_ADD_CONSUMABLES', {
|
||||||
|
item: JSON.stringify(actions.actions)
|
||||||
|
});
|
||||||
|
} else if (e.name == '清点') {
|
||||||
|
hasPermission('允许耗材盘点').then((ele) => {
|
||||||
|
if (ele) {
|
||||||
|
toUrl('PAGES_SALES_INVENTORYCHECK', {
|
||||||
|
item: JSON.stringify(actions.actions)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (e.name == '入库') {
|
||||||
|
hasPermission('允许耗材入库').then((ele) => {
|
||||||
|
if (ele) {
|
||||||
|
toUrl('PAGES_SALES_WAREHOUSEENTRY', {
|
||||||
|
consId: actions.actions.id,
|
||||||
|
item: JSON.stringify(actions.actions)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (e.name == '出库') {
|
||||||
|
hasPermission('允许耗材出库').then((ele) => {
|
||||||
|
if (ele) {
|
||||||
|
toUrl('PAGES_SALES_OUTBOUND', {
|
||||||
|
consId: actions.actions.id,
|
||||||
|
item: JSON.stringify(actions.actions)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function inputEvent(d) {
|
||||||
|
pageData.query.conName = d.detail.value.replace(/\s*/g, '');
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
function filtersSproductId(d) {
|
||||||
|
if (!d) return '';
|
||||||
|
// const dataArr = d.split(',')
|
||||||
|
let str = '';
|
||||||
|
d.forEach((ele) => {
|
||||||
|
// str += ele.name
|
||||||
|
// const startIndex = ele.indexOf('_')
|
||||||
|
// const productId = ele.slice(0, startIndex)
|
||||||
|
// const productName = ele.slice(startIndex + 1, ele.length)
|
||||||
|
str = ele.name + ',' + str;
|
||||||
|
});
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
let toUrl = (url, d) => {
|
||||||
|
go.to(url, d);
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
page {
|
page {
|
||||||
background-color: #f9f9f9;
|
background-color: #f9f9f9;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
ul,
|
ul,
|
||||||
li {
|
li {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ConsumablesTop {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
align-items: center;
|
||||||
|
padding-bottom: 22rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
|
||||||
|
> view:first-child,
|
||||||
|
> view:last-child {
|
||||||
|
font-size: 24rpx;
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #333333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ConsumablesTop {
|
> view:last-child {
|
||||||
display: flex;
|
color: #318afe;
|
||||||
justify-content: space-around;
|
}
|
||||||
align-items: center;
|
|
||||||
padding-bottom: 22rpx;
|
|
||||||
background-color: #fff;
|
|
||||||
|
|
||||||
>view:first-child,
|
> view:nth-child(2) {
|
||||||
>view:last-child {
|
width: 414rpx;
|
||||||
font-size: 24rpx;
|
height: 60rpx;
|
||||||
|
line-height: 60rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
background: #f9f9f9;
|
||||||
|
border-radius: 32rpx 32rpx 32rpx 32rpx;
|
||||||
|
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ConsumablesConent {
|
||||||
|
min-height: 80vh;
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
padding-top: 1rpx;
|
||||||
|
|
||||||
|
> view {
|
||||||
|
width: 694rpx;
|
||||||
|
height: 332rpx;
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||||||
|
padding: 32rpx 16rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 32rpx auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
> view:first-child {
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
font-size: 24rpx;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
}
|
.df;
|
||||||
|
|
||||||
>view:last-child {
|
> view {
|
||||||
color: #318AFE;
|
// width: 90rpx;
|
||||||
}
|
padding: 2rpx 10rpx;
|
||||||
|
height: 36rpx;
|
||||||
>view:nth-child(2) {
|
line-height: 36rpx;
|
||||||
width: 414rpx;
|
background: #ebf4fc;
|
||||||
height: 60rpx;
|
border-radius: 4rpx 4rpx 4rpx 4rpx;
|
||||||
line-height: 60rpx;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
background: #F9F9F9;
|
|
||||||
border-radius: 32rpx 32rpx 32rpx 32rpx;
|
|
||||||
|
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #999999;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.ConsumablesConent {
|
|
||||||
min-height: 80vh;
|
|
||||||
background-color: #f9f9f9;
|
|
||||||
padding-top: 1rpx;
|
|
||||||
|
|
||||||
>view {
|
|
||||||
width: 694rpx;
|
|
||||||
height: 332rpx;
|
|
||||||
background: #FFFFFF;
|
|
||||||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
|
||||||
padding: 32rpx 16rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
margin: 32rpx auto;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: space-between;
|
|
||||||
|
|
||||||
>view:first-child {
|
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
|
||||||
font-weight: 500;
|
|
||||||
font-size: 24rpx;
|
|
||||||
color: #333333;
|
|
||||||
.df;
|
|
||||||
|
|
||||||
>view {
|
|
||||||
// width: 90rpx;
|
|
||||||
padding: 2rpx 10rpx;
|
|
||||||
height: 36rpx;
|
|
||||||
line-height: 36rpx;
|
|
||||||
background: #EBF4FC;
|
|
||||||
border-radius: 4rpx 4rpx 4rpx 4rpx;
|
|
||||||
text-align: center;
|
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 24rpx;
|
|
||||||
color: #318AFE;
|
|
||||||
margin-left: 12rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
>view:nth-child(2) {
|
|
||||||
width: 662rpx;
|
|
||||||
height: 128rpx;
|
|
||||||
background: #F9F9F9;
|
|
||||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
|
||||||
.df;
|
|
||||||
justify-content: space-around;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #666666;
|
color: #318afe;
|
||||||
|
margin-left: 12rpx;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
>view:last-child {
|
> view:nth-child(2) {
|
||||||
|
width: 662rpx;
|
||||||
|
height: 128rpx;
|
||||||
|
background: #f9f9f9;
|
||||||
|
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||||
|
.df;
|
||||||
|
justify-content: space-around;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #666666;
|
||||||
|
}
|
||||||
|
|
||||||
|
> view:last-child {
|
||||||
|
.df;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
> view:last-child {
|
||||||
.df;
|
.df;
|
||||||
justify-content: space-between;
|
|
||||||
|
|
||||||
>view:last-child {
|
> button {
|
||||||
.df;
|
width: 128rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
background: #ffffff;
|
||||||
|
// border-radius: 28rpx 28rpx 28rpx 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
>button {
|
> button:last-child {
|
||||||
width: 128rpx;
|
margin-left: 24rpx;
|
||||||
height: 48rpx;
|
|
||||||
background: #FFFFFF;
|
|
||||||
// border-radius: 28rpx 28rpx 28rpx 28rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
>button:last-child {
|
|
||||||
margin-left: 24rpx;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.ConsumablesBottom {
|
.ConsumablesBottom {
|
||||||
.df;
|
.df;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 20rpx;
|
bottom: 20rpx;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
transform: translateX(-50%);
|
transform: translateX(-50%);
|
||||||
|
|
||||||
>view {
|
> view {
|
||||||
width: 346rpx;
|
width: 346rpx;
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
line-height: 80rpx;
|
line-height: 80rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border: 2rpx solid #318AFE;
|
border: 2rpx solid #318afe;
|
||||||
|
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
}
|
|
||||||
|
|
||||||
>view:first-child {
|
|
||||||
border-radius: 56rpx 0rpx 0rpx 56rpx;
|
|
||||||
color: #318AFE;
|
|
||||||
background-color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
>view:last-child {
|
|
||||||
border-radius: 0 56rpx 56rpx 0;
|
|
||||||
background-color: #318AFE;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.popup-content {
|
> view:first-child {
|
||||||
padding: 15px;
|
border-radius: 56rpx 0rpx 0rpx 56rpx;
|
||||||
|
color: #318afe;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
margin: 0 auto;
|
}
|
||||||
|
|
||||||
>view {
|
> view:last-child {
|
||||||
|
border-radius: 0 56rpx 56rpx 0;
|
||||||
|
background-color: #318afe;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-content {
|
||||||
|
padding: 15px;
|
||||||
|
background-color: #fff;
|
||||||
|
margin: 0 auto;
|
||||||
|
|
||||||
|
> view {
|
||||||
|
height: 88rpx;
|
||||||
|
line-height: 88rpx;
|
||||||
|
width: 660rpx;
|
||||||
|
border-top: 10rpx solid #f9f9f9;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.operate {
|
||||||
|
> view {
|
||||||
height: 88rpx;
|
height: 88rpx;
|
||||||
line-height: 88rpx;
|
line-height: 88rpx;
|
||||||
width: 660rpx;
|
|
||||||
border-top: 10rpx solid #f9f9f9;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
width: 660rpx;
|
||||||
|
border-bottom: 2rpx solid #e5e5e5;
|
||||||
.operate {
|
|
||||||
>view {
|
|
||||||
height: 88rpx;
|
|
||||||
line-height: 88rpx;
|
|
||||||
text-align: center;
|
|
||||||
width: 660rpx;
|
|
||||||
border-bottom: 2rpx solid #E5E5E5;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.status {
|
.status {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
// top: 100%;
|
// top: 100%;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.zhezhaopop {
|
.zhezhaopop {
|
||||||
padding: 34rpx 32rpx;
|
padding: 34rpx 32rpx;
|
||||||
width: 594rpx;
|
width: 594rpx;
|
||||||
|
|
||||||
>view:first-child {
|
> view:first-child {
|
||||||
|
.df;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
.df;
|
> span:nth-child(2) {
|
||||||
justify-content: space-between;
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
|
font-weight: bold;
|
||||||
>span:nth-child(2) {
|
font-size: 32rpx;
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
color: #333333;
|
||||||
font-weight: bold;
|
|
||||||
font-size: 32rpx;
|
|
||||||
color: #333333;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.df() {
|
.df() {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
}
|
||||||
|
.fixed-in-btn {
|
||||||
|
position: fixed;
|
||||||
|
right: 20upx;
|
||||||
|
bottom: 20%;
|
||||||
|
z-index: 999;
|
||||||
|
.img {
|
||||||
|
width: 120upx;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
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>
|
<template>
|
||||||
<view class="min-page u-font-28">
|
<view class="min-page u-font-28">
|
||||||
<up-sticky>
|
<up-sticky>
|
||||||
<view class="bg-fff top">
|
<view class="bg-fff top">
|
||||||
<view class="bg-fff container u-flex u-m-b-48">
|
<view class="bg-fff container u-flex u-m-b-48">
|
||||||
<image
|
<image style="width: 60rpx; height: 60rpx" src="/pageMarket/static/images/distribution.png"></image>
|
||||||
style="width: 60rpx; height: 60rpx"
|
<view class="u-flex-1 u-flex u-p-l-24">
|
||||||
src="/pageMarket/static/images/distribution.png"
|
<view class="u-font-28 u-flex-1 u-p-r-4">
|
||||||
></image>
|
<view class="color-333 font-bold">分销</view>
|
||||||
<view class="u-flex-1 u-flex u-p-l-24">
|
<view class="color-666 u-m-t-4 u-font-24">用户成为业务员,可促进消费
|
||||||
<view class="u-font-28 u-flex-1 u-p-r-4">
|
</view>
|
||||||
<view class="color-333 font-bold">分销</view>
|
</view>
|
||||||
<view class="color-666 u-m-t-4 u-font-24"
|
<up-switch v-model="distributionStore.config.isEnable" size="18" :active-value="1"
|
||||||
>用户成为业务员,可促进消费
|
:inactive-value="0"></up-switch>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<up-switch
|
<my-tabs v-model="active" :list="tabs" textKey="label"></my-tabs>
|
||||||
v-model="distributionStore.config.isEnable"
|
<view v-if="active == 1 || active == 2" class="u-flex u-row-between u-m-t-32" style="gap: 58rpx">
|
||||||
size="18"
|
<view class="u-flex-1">
|
||||||
:active-value="1"
|
<fenXiaoUserSelect v-model="userId" @change="getList()" />
|
||||||
:inactive-value="0"
|
</view>
|
||||||
></up-switch>
|
<!-- <view class="u-flex-1 filter-box" style="border-radius: 100rpx">
|
||||||
</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">
|
|
||||||
<up-icon name="search" size="18"></up-icon>
|
<up-icon name="search" size="18"></up-icon>
|
||||||
<input
|
<input
|
||||||
class="u-m-l-10 u-font-28"
|
class="u-m-l-10 u-font-28"
|
||||||
@@ -39,476 +30,439 @@
|
|||||||
@blur="keyWordBlur"
|
@blur="keyWordBlur"
|
||||||
/>
|
/>
|
||||||
<up-icon v-if="keyWord" name="close" size="14" @click="clearKeyWord"></up-icon>
|
<up-icon v-if="keyWord" name="close" size="14" @click="clearKeyWord"></up-icon>
|
||||||
</view>
|
</view> -->
|
||||||
<view
|
<view class="u-flex-1 u-font-28 filter-box u-flex u-row-between" @click="showTimeArea = true">
|
||||||
class="u-flex-1 u-font-28 filter-box u-flex u-row-between"
|
<template v-if="userComponentQuery.startTime && userComponentQuery.endTime">
|
||||||
@click="showTimeArea = true"
|
<text class="u-font-20">
|
||||||
>
|
{{ userComponentQuery.startTime }} -
|
||||||
<template
|
{{ userComponentQuery.endTime }}
|
||||||
v-if="userComponentQuery.startTime && userComponentQuery.endTime"
|
</text>
|
||||||
>
|
<view @click.stop="clearTime">
|
||||||
<text class="u-font-20">
|
<up-icon name="close" size="14"></up-icon>
|
||||||
{{ userComponentQuery.startTime }} -
|
</view>
|
||||||
{{ userComponentQuery.endTime }}
|
</template>
|
||||||
</text>
|
<template v-else>
|
||||||
<view @click.stop="clearTime">
|
<text class="color-999">请选择日期范围</text>
|
||||||
<up-icon name="close" size="14"></up-icon>
|
<up-icon name="arrow-right" size="12"></up-icon>
|
||||||
</view>
|
</template>
|
||||||
</template>
|
</view>
|
||||||
<template v-else>
|
</view>
|
||||||
<text class="color-999">请选择日期范围</text>
|
<view v-if="active == 3" class="u-flex u-row-between u-m-t-32" style="gap: 30rpx">
|
||||||
<up-icon name="arrow-right" size="12"></up-icon>
|
<view class="u-font-28 filter-box u-flex u-row-between" @click="showActions = true">
|
||||||
</template>
|
<template v-if="selActions && selActions.value">
|
||||||
</view>
|
<text class="u-font-28 u-m-r-10">{{ selActions.name }} </text>
|
||||||
</view>
|
</template>
|
||||||
<view
|
<template v-else>
|
||||||
v-if="active == 3"
|
<text class="color-999 u-m-r-10">全部</text>
|
||||||
class="u-flex u-row-between u-m-t-32"
|
</template>
|
||||||
style="gap: 30rpx"
|
<up-icon name="arrow-down" size="12"></up-icon>
|
||||||
>
|
</view>
|
||||||
<view
|
<view class="u-flex-1">
|
||||||
class="u-font-28 filter-box u-flex u-row-between"
|
<fenXiaoUserSelect v-model="userId" :maxWidth="200" @change="getList()" />
|
||||||
@click="showActions = true"
|
</view>
|
||||||
>
|
<!-- <view class="u-flex-1 filter-box" style="border-radius: 100rpx">
|
||||||
<template v-if="selActions && selActions.value">
|
<up-icon name="search" size="18"></up-icon>
|
||||||
<text class="u-font-28 u-m-r-10">{{ selActions.name }} </text>
|
<input class="u-m-l-10 u-font-28" type="text" placeholder-class="color-999 u-font-28"
|
||||||
</template>
|
placeholder="分销员昵称/手机号" v-model="keyWord" @blur="keyWordBlur" />
|
||||||
<template v-else>
|
</view> -->
|
||||||
<text class="color-999 u-m-r-10">全部</text>
|
<view class="u-flex-1 u-font-28 filter-box u-flex u-row-between" @click="showTimeArea = true">
|
||||||
</template>
|
<template v-if="userComponentQuery.startTime && userComponentQuery.endTime">
|
||||||
<up-icon name="arrow-down" size="12"></up-icon>
|
<text class="u-font-20">
|
||||||
</view>
|
{{ userComponentQuery.startTime }} -
|
||||||
<view class="u-flex-1 filter-box" style="border-radius: 100rpx">
|
{{ userComponentQuery.endTime }}
|
||||||
<up-icon name="search" size="18"></up-icon>
|
</text>
|
||||||
<input
|
<view @click.stop="clearTime">
|
||||||
class="u-m-l-10 u-font-28"
|
<up-icon name="close" size="14"></up-icon>
|
||||||
type="text"
|
</view>
|
||||||
placeholder-class="color-999 u-font-28"
|
</template>
|
||||||
placeholder="分销员昵称/手机号"
|
<template v-else>
|
||||||
v-model="keyWord"
|
<text class="color-999">请选择日期</text>
|
||||||
@blur="keyWordBlur"
|
<up-icon name="arrow-right" size="12"></up-icon>
|
||||||
/>
|
</template>
|
||||||
</view>
|
</view>
|
||||||
<view
|
</view>
|
||||||
class="u-flex-1 u-font-28 filter-box u-flex u-row-between"
|
<view v-if="active == 2" class="u-flex u-p-l-32 u-p-r-32 u-m-t-32">
|
||||||
@click="showTimeArea = true"
|
<view class="u-flex-1 u-text-center">
|
||||||
>
|
<view class="u-font-32 color-main font-bold">{{
|
||||||
<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
|
listRes.totalCount
|
||||||
}}</view>
|
}}</view>
|
||||||
<view class="u-font-24 color-666 u-m-t-16">支付开通人数</view>
|
<view class="u-font-24 color-666 u-m-t-16">支付开通人数</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex-1 u-text-center">
|
<view class="u-flex-1 u-text-center">
|
||||||
<view class="u-font-32 color-main font-bold">{{
|
<view class="u-font-32 color-main font-bold">{{
|
||||||
listRes.totalAmount
|
listRes.totalAmount
|
||||||
}}</view>
|
}}</view>
|
||||||
<view class="u-font-24 color-666 u-m-t-16">已支付金额(元)</view>
|
<view class="u-font-24 color-666 u-m-t-16">已支付金额(元)</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="active == 3" class="u-flex u-m-t-32">
|
<view v-if="active == 3" class="u-flex u-m-t-32">
|
||||||
<view class="u-flex-1 u-text-center">
|
<view class="u-flex-1 u-text-center">
|
||||||
<view class="u-font-32 color-main font-bold">{{
|
<view class="u-font-32 color-main font-bold">{{
|
||||||
listRes.successAmount
|
listRes.successAmount
|
||||||
}}</view>
|
}}</view>
|
||||||
<view class="u-font-24 color-666 u-m-t-16">已入账金额(元)</view>
|
<view class="u-font-24 color-666 u-m-t-16">已入账金额(元)</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex-1 u-text-center">
|
<view class="u-flex-1 u-text-center">
|
||||||
<view class="u-font-32 color-main font-bold">{{
|
<view class="u-font-32 color-main font-bold">{{
|
||||||
listRes.pendingAmount || 0
|
listRes.pendingAmount || 0
|
||||||
}}</view>
|
}}</view>
|
||||||
<view class="u-font-24 color-666 u-m-t-16">待入账金额(元)</view>
|
<view class="u-font-24 color-666 u-m-t-16">待入账金额(元)</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex-1 u-text-center">
|
<view class="u-flex-1 u-text-center">
|
||||||
<view class="u-font-32 color-main font-bold">{{
|
<view class="u-font-32 color-main font-bold">{{
|
||||||
listRes.balanceAmount
|
listRes.balanceAmount
|
||||||
}}</view>
|
}}</view>
|
||||||
<view class="u-font-24 color-666 u-m-t-16">
|
<view class="u-font-24 color-666 u-m-t-16">
|
||||||
<text>运营余额(元)</text>
|
<text>运营余额(元)</text>
|
||||||
<text class="color-main" @click="go.to('PAGES_PAY')"
|
<text class="color-main" @click="go.to('PAGES_PAY')">充值{{ ">" }}</text>
|
||||||
>充值{{ ">" }}</text
|
</view>
|
||||||
>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</up-sticky>
|
||||||
</view>
|
<configVue v-if="active == 0"></configVue>
|
||||||
</up-sticky>
|
<fenxiaoUserListVue v-if="active == 1" :list="list" :isEnd="isEnd" @refresh="refresh"></fenxiaoUserListVue>
|
||||||
<configVue v-if="active == 0"></configVue>
|
|
||||||
<fenxiaoUserListVue
|
|
||||||
v-if="active == 1"
|
|
||||||
:list="list"
|
|
||||||
:isEnd="isEnd"
|
|
||||||
@refresh="refresh"
|
|
||||||
></fenxiaoUserListVue>
|
|
||||||
|
|
||||||
<openListVue
|
<openListVue v-if="active == 2" :list="list" :isEnd="isEnd" @refresh="refresh"></openListVue>
|
||||||
v-if="active == 2"
|
<fenxiaoMingxiVue v-if="active == 3" :list="list" :isEnd="isEnd" @refresh="refresh"></fenxiaoMingxiVue>
|
||||||
:list="list"
|
<!-- 选择门店 -->
|
||||||
:isEnd="isEnd"
|
<shopSelActionSheetVue @choose="chooseShop" v-model="showShopSelActionSheet" title="选择门店">
|
||||||
@refresh="refresh"
|
</shopSelActionSheetVue>
|
||||||
></openListVue>
|
|
||||||
<fenxiaoMingxiVue
|
|
||||||
v-if="active == 3"
|
|
||||||
:list="list"
|
|
||||||
:isEnd="isEnd"
|
|
||||||
@refresh="refresh"
|
|
||||||
></fenxiaoMingxiVue>
|
|
||||||
<!-- 选择门店 -->
|
|
||||||
<shopSelActionSheetVue
|
|
||||||
@choose="chooseShop"
|
|
||||||
v-model="showShopSelActionSheet"
|
|
||||||
title="选择门店"
|
|
||||||
>
|
|
||||||
</shopSelActionSheetVue>
|
|
||||||
|
|
||||||
<dateAreaSel
|
<dateAreaSel :show="showTimeArea" :minYear="2022" @close="showTimeArea = false" @confirm="confirmTimeArea">
|
||||||
:show="showTimeArea"
|
</dateAreaSel>
|
||||||
:minYear="2022"
|
|
||||||
@close="showTimeArea = false"
|
|
||||||
@confirm="confirmTimeArea"
|
|
||||||
></dateAreaSel>
|
|
||||||
|
|
||||||
<!-- 分销明细状态 -->
|
<!-- 分销明细状态 -->
|
||||||
<up-action-sheet
|
<up-action-sheet :show="showActions" :actions="actions" @select="handleSelect" @close="showActions = false"
|
||||||
:show="showActions"
|
cancel-text="取消"></up-action-sheet>
|
||||||
:actions="actions"
|
</view>
|
||||||
@select="handleSelect"
|
|
||||||
@close="showActions = false"
|
|
||||||
cancel-text="取消"
|
|
||||||
></up-action-sheet>
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import {
|
import {
|
||||||
onLoad,
|
onLoad,
|
||||||
onReady,
|
onReady,
|
||||||
onShow,
|
onShow,
|
||||||
onPageScroll,
|
onPageScroll,
|
||||||
onReachBottom,
|
onReachBottom,
|
||||||
onBackPress,
|
onBackPress,
|
||||||
} from "@dcloudio/uni-app";
|
} from "@dcloudio/uni-app";
|
||||||
import go from "@/commons/utils/go.js";
|
import go from "@/commons/utils/go.js";
|
||||||
import { ref, onMounted, watch, provide } from "vue";
|
import {
|
||||||
import * as consumeCashbackApi from "@/http/api/market/consumeCashback.js";
|
ref,
|
||||||
import * as distributionApi from "@/http/api/market/distribution.js";
|
onMounted,
|
||||||
import configVue from "./components/config.vue";
|
watch,
|
||||||
import shopSelActionSheetVue from "@/pageMarket/components/shop-sel-action-sheet.vue";
|
provide
|
||||||
import dateAreaSel from "@/components/date-range-picker/date-range-picker.vue";
|
} from "vue";
|
||||||
import fenxiaoUserListVue from "./components/fenxiao-user-list.vue";
|
import * as consumeCashbackApi from "@/http/api/market/consumeCashback.js";
|
||||||
import openListVue from "./components/open-list.vue";
|
import * as distributionApi from "@/http/api/market/distribution.js";
|
||||||
import fenxiaoMingxiVue from "./components/fenxiao-mingxi.vue";
|
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 {
|
||||||
import { reactive } from "vue";
|
useDistributionStore
|
||||||
|
} from "@/store/market.js";
|
||||||
|
import {
|
||||||
|
reactive
|
||||||
|
} from "vue";
|
||||||
|
|
||||||
const actions = [
|
const actions = [{
|
||||||
{
|
name: "全部",
|
||||||
name: "全部",
|
value: "",
|
||||||
value: "",
|
},
|
||||||
},
|
{
|
||||||
{
|
name: "已入账",
|
||||||
name: "已入账",
|
value: "success",
|
||||||
value: "success",
|
},
|
||||||
},
|
{
|
||||||
{
|
name: "待入账",
|
||||||
name: "待入账",
|
value: "pending",
|
||||||
value: "pending",
|
},
|
||||||
},
|
{
|
||||||
{
|
name: "已退款",
|
||||||
name: "已退款",
|
value: "refund",
|
||||||
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 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("");
|
const userId = ref('')
|
||||||
function keyWordBlur() {
|
|
||||||
userComponentQuery.user = keyWord.value;
|
|
||||||
}
|
|
||||||
const userComponentQuery = reactive({
|
|
||||||
user: "",
|
|
||||||
startTime: "",
|
|
||||||
endTime: "",
|
|
||||||
});
|
|
||||||
|
|
||||||
const form = ref({
|
function clearKeyWord() {
|
||||||
isEnable: 0,
|
keyWord.value = "";
|
||||||
});
|
userComponentQuery.user = "";
|
||||||
|
}
|
||||||
|
|
||||||
const list = ref([]);
|
function clearTime() {
|
||||||
const pageNum = ref(1);
|
userComponentQuery.startTime = "";
|
||||||
const isEnd = ref(false);
|
userComponentQuery.endTime = "";
|
||||||
const selShop = ref({
|
}
|
||||||
shopId: "",
|
const selActions = ref("");
|
||||||
shopName: "",
|
const showActions = ref(false);
|
||||||
});
|
|
||||||
const searchText = ref("");
|
|
||||||
|
|
||||||
function search() {
|
function handleSelect(e) {
|
||||||
pageNum.value = 1;
|
selActions.value = e;
|
||||||
getList();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function chooseShop(e) {
|
const distributionStore = useDistributionStore();
|
||||||
selShop.value = e;
|
distributionStore.getConfig();
|
||||||
}
|
provide("distributionStore", distributionStore);
|
||||||
|
provide("distributionApi", distributionApi);
|
||||||
|
const showTimeArea = ref(false);
|
||||||
|
|
||||||
watch(
|
function confirmTimeArea(e) {
|
||||||
() => selShop.value.shopId,
|
console.log(e);
|
||||||
(newval) => {
|
userComponentQuery.startTime = e[0];
|
||||||
pageNum.value = 1;
|
userComponentQuery.endTime = e[1];
|
||||||
getList();
|
}
|
||||||
}
|
const tabs = [{
|
||||||
);
|
label: "基础设置",
|
||||||
|
value: "basic",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "分销员",
|
||||||
|
value: "user",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "开通记录",
|
||||||
|
value: "recoders",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "分销明细",
|
||||||
|
value: "details",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
watch(
|
const keyWord = ref("");
|
||||||
() => userComponentQuery,
|
|
||||||
(newval) => {
|
|
||||||
isEnd.value = false;
|
|
||||||
pageNum.value = 1;
|
|
||||||
|
|
||||||
getList();
|
function keyWordBlur() {
|
||||||
},
|
userComponentQuery.user = keyWord.value;
|
||||||
{
|
}
|
||||||
deep: true,
|
const userComponentQuery = reactive({
|
||||||
}
|
user: "",
|
||||||
);
|
startTime: "",
|
||||||
|
endTime: "",
|
||||||
|
});
|
||||||
|
|
||||||
function refresh() {
|
const form = ref({
|
||||||
isEnd.value = false;
|
isEnable: 0,
|
||||||
pageNum.value = 1;
|
});
|
||||||
getList();
|
|
||||||
}
|
|
||||||
|
|
||||||
const listRes = ref({});
|
const list = ref([]);
|
||||||
async function getList() {
|
const pageNum = ref(1);
|
||||||
let res = null;
|
const isEnd = ref(false);
|
||||||
if (active.value == 1) {
|
const selShop = ref({
|
||||||
//分销员列表
|
shopId: "",
|
||||||
res = await distributionApi.distributionUser({
|
shopName: "",
|
||||||
page: pageNum.value,
|
});
|
||||||
size: 10,
|
const searchText = ref("");
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 显示选择门店弹窗
|
function search() {
|
||||||
const showShopSelActionSheet = ref(false);
|
pageNum.value = 1;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
|
||||||
function showShopSelActionSheetFun() {
|
function chooseShop(e) {
|
||||||
showShopSelActionSheet.value = true;
|
selShop.value = e;
|
||||||
}
|
}
|
||||||
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) => {
|
|
||||||
|
|
||||||
refresh();
|
watch(
|
||||||
}
|
() => selShop.value.shopId,
|
||||||
);
|
(newval) => {
|
||||||
watch(
|
pageNum.value = 1;
|
||||||
() => selActions.value,
|
getList();
|
||||||
() => {
|
}
|
||||||
refresh();
|
);
|
||||||
}
|
|
||||||
);
|
watch(
|
||||||
onReachBottom(() => {
|
() => userComponentQuery,
|
||||||
if (!isEnd.value) {
|
(newval) => {
|
||||||
pageNum.value++;
|
isEnd.value = false;
|
||||||
getList();
|
pageNum.value = 1;
|
||||||
}
|
|
||||||
});
|
getList();
|
||||||
watch(
|
}, {
|
||||||
() => distributionStore.config.isEnable,
|
deep: true,
|
||||||
() => {
|
}
|
||||||
distributionStore.editConfig();
|
);
|
||||||
}
|
|
||||||
);
|
function refresh() {
|
||||||
onShow(() => {
|
isEnd.value = false;
|
||||||
pageNum.value = 1;
|
pageNum.value = 1;
|
||||||
getList();
|
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>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.min-page {
|
.min-page {
|
||||||
background: #f7f7f7;
|
background: #f7f7f7;
|
||||||
}
|
}
|
||||||
|
|
||||||
.box {
|
.box {}
|
||||||
}
|
|
||||||
|
|
||||||
.top {
|
.top {
|
||||||
padding: 32rpx 24rpx;
|
padding: 32rpx 24rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list {
|
.list {
|
||||||
padding: 0 30rpx;
|
padding: 0 30rpx;
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
padding: 32rpx 24rpx;
|
padding: 32rpx 24rpx;
|
||||||
border-radius: 14rpx;
|
border-radius: 14rpx;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag {
|
.tag {
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
padding: 8rpx 22rpx;
|
padding: 8rpx 22rpx;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
|
|
||||||
&.success {
|
&.success {
|
||||||
background-color: #edfff0;
|
background-color: #edfff0;
|
||||||
color: #5bbc6d;
|
color: #5bbc6d;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.end {
|
&.end {
|
||||||
background-color: #f7f7f7;
|
background-color: #f7f7f7;
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.my-btn {
|
.my-btn {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
line-height: 36rpx;
|
line-height: 36rpx;
|
||||||
padding: 8rpx 32rpx;
|
padding: 8rpx 32rpx;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.edit-btn {
|
.edit-btn {
|
||||||
background: #e6f0ff;
|
background: #e6f0ff;
|
||||||
color: $my-main-color;
|
color: $my-main-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.delete-btn {
|
.delete-btn {
|
||||||
background: #ffe7e6;
|
background: #ffe7e6;
|
||||||
color: #ff1c1c;
|
color: #ff1c1c;
|
||||||
}
|
}
|
||||||
.filter-box {
|
|
||||||
display: flex;
|
.filter-box {
|
||||||
padding: 8rpx 24rpx;
|
display: flex;
|
||||||
align-items: center;
|
padding: 8rpx 24rpx;
|
||||||
border-radius: 8rpx;
|
align-items: center;
|
||||||
border: 2rpx solid #d9d9d9;
|
border-radius: 8rpx;
|
||||||
background: #f7f7f7;
|
border: 2rpx solid #d9d9d9;
|
||||||
min-height: 62rpx;
|
background: #f7f7f7;
|
||||||
box-sizing: border-box;
|
min-height: 62rpx;
|
||||||
}
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
placeholder-class="color-999 u-font-28"
|
placeholder-class="color-999 u-font-28"
|
||||||
type="digit"
|
type="digit"
|
||||||
@input="checkNumberCommission($event,index)"
|
@input="checkNumberCommission($event,index)"
|
||||||
v-model="item.levelOneCommission"
|
v-model="item.commission"
|
||||||
/>
|
/>
|
||||||
<view class="unit">%</view>
|
<view class="unit">%</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -144,7 +144,7 @@ function toggle(index) {
|
|||||||
const allCommission=()=>{
|
const allCommission=()=>{
|
||||||
let sum=0
|
let sum=0
|
||||||
for(let item of form.levelConfigList){
|
for(let item of form.levelConfigList){
|
||||||
sum+=parseFloat(item.levelOneCommission)
|
sum+=parseFloat(item.commission)
|
||||||
}
|
}
|
||||||
return sum
|
return sum
|
||||||
}
|
}
|
||||||
@@ -162,7 +162,7 @@ function checkNumberCommission(e,index){
|
|||||||
icon:'none'
|
icon:'none'
|
||||||
})
|
})
|
||||||
timer= setTimeout(()=>{
|
timer= setTimeout(()=>{
|
||||||
form.levelConfigList[index].levelOneCommission=''
|
form.levelConfigList[index].commission=''
|
||||||
},30)
|
},30)
|
||||||
|
|
||||||
return false
|
return false
|
||||||
@@ -172,7 +172,7 @@ function checkNumberCommission(e,index){
|
|||||||
const arr=value.split('.')
|
const arr=value.split('.')
|
||||||
if(arr[1].length>2){
|
if(arr[1].length>2){
|
||||||
timer= setTimeout(()=>{
|
timer= setTimeout(()=>{
|
||||||
form.levelConfigList[index].levelOneCommission=arr[0]+'.'+arr[1].substring(0,2)
|
form.levelConfigList[index].commission=arr[0]+'.'+arr[1].substring(0,2)
|
||||||
},30)
|
},30)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -200,7 +200,7 @@ function remove(index){
|
|||||||
function addLevelConfig(){
|
function addLevelConfig(){
|
||||||
form.levelConfigList.push({
|
form.levelConfigList.push({
|
||||||
name:'',
|
name:'',
|
||||||
levelOneCommission:'',
|
commission:'',
|
||||||
inviteCount:'',
|
inviteCount:'',
|
||||||
costAmount:''
|
costAmount:''
|
||||||
})
|
})
|
||||||
@@ -217,7 +217,7 @@ function addLevelConfig(){
|
|||||||
})
|
})
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if(!item.levelOneCommission){
|
if(!item.commission){
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title:'请输入分成比例',
|
title:'请输入分成比例',
|
||||||
icon:'none'
|
icon:'none'
|
||||||
@@ -279,7 +279,7 @@ onLoad(()=>{
|
|||||||
const levelConfigList=[...distributionStore.config.levelConfigList||[]]
|
const levelConfigList=[...distributionStore.config.levelConfigList||[]]
|
||||||
form.levelConfigList=levelConfigList.length?levelConfigList:[
|
form.levelConfigList=levelConfigList.length?levelConfigList:[
|
||||||
{ name:'',
|
{ name:'',
|
||||||
levelOneCommission:'',
|
commission:'',
|
||||||
inviteCount:0,
|
inviteCount:0,
|
||||||
costAmount:0}
|
costAmount:0}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,366 +1,432 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="boxconstant min-page">
|
<view class="boxconstant min-page">
|
||||||
<view class="bg-fff u-flex u-m-b-32 top">
|
<view class="bg-fff u-flex u-m-b-32 top">
|
||||||
<image
|
<image style="width: 60rpx; height: 60rpx" src="/pageMarket/static/images/cost.png"></image>
|
||||||
style="width: 60rpx; height: 60rpx"
|
<view class="u-flex-1 u-flex u-p-l-24">
|
||||||
src="/pageMarket/static/images/cost.png"
|
<view class="u-font-28 u-flex-1 u-p-r-4">
|
||||||
></image>
|
<view class="color-333 font-bold">私域引流</view>
|
||||||
<view class="u-flex-1 u-flex u-p-l-24">
|
<view class="color-666 u-m-t-4 u-font-24">可设置用户下单后展示的群二维码</view>
|
||||||
<view class="u-font-28 u-flex-1 u-p-r-4">
|
</view>
|
||||||
<view class="color-333 font-bold">私域引流</view>
|
<!-- <up-switch v-model="form.isEnable" size="18" :active-value="1" :inactive-value="0"></up-switch> -->
|
||||||
<view class="color-666 u-m-t-4 u-font-24"
|
</view>
|
||||||
>可设置用户下单后展示的群二维码</view
|
</view>
|
||||||
>
|
<view class="boxconstantbox" style="padding: 32rpx 0">
|
||||||
</view>
|
<view class="u-flex u-row-between x-padding">
|
||||||
<up-switch
|
<view class="boxconstantbox_one">群二维码</view>
|
||||||
v-model="form.isEnable"
|
<button class="upload" @click="uploadImage">上传</button>
|
||||||
size="18"
|
</view>
|
||||||
:active-value="1"
|
<view class="u-m-t-24 u-flex u-row-center">
|
||||||
:inactive-value="0"
|
<view class="code" @click="uploadImage">
|
||||||
></up-switch>
|
<up-icon name="plus" v-if="!form.qrCode" size="20" color="#999"></up-icon>
|
||||||
</view>
|
<image v-else style="width: 260rpx; height: 260rpx" :src="form.qrCode" mode="scaleToFill" />
|
||||||
</view>
|
</view>
|
||||||
<view class="boxconstantbox">
|
</view>
|
||||||
<view class="boxconstantbox_one"> 可使用类型 </view>
|
<view class="u-m-t-32">
|
||||||
<view class="u-m-t-16">
|
<up-line></up-line>
|
||||||
<my-dine-types v-model="form.useType"></my-dine-types>
|
</view>
|
||||||
</view>
|
<view class="u-m-t-32 u-font-28 x-padding">
|
||||||
</view>
|
<view class="boxconstantbox_one u-m-b-24">模块标题</view>
|
||||||
|
<up-input placeholderClass="u-font-28" v-model="form.title" :maxlength="20" placeholder="请输入模块标题"></up-input>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<up-line></up-line>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32 u-font-28 x-padding">
|
||||||
|
<view class="boxconstantbox_one u-m-b-24">模块提示语</view>
|
||||||
|
<up-input placeholderClass="u-font-28" v-model="defaultNote" :maxlength="20" placeholder="请输入模块提示语" disabled></up-input>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<up-line></up-line>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32 u-font-28 x-padding">
|
||||||
|
<view class="boxconstantbox_one u-m-b-24">模块内容</view>
|
||||||
|
<up-textarea type="textarea" :maxlength="50" placeholderClass="u-font-28" v-model="form.content" placeholder="请输入模块内容"></up-textarea>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32">
|
||||||
|
<up-line></up-line>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32 u-font-28 x-padding">
|
||||||
|
<view class="boxconstantbox_one u-m-b-24">支付完成弹窗</view>
|
||||||
|
<u-switch :active-value="1" :inactive-value="0" v-model="form.orderEnable"></u-switch>
|
||||||
|
</view>
|
||||||
|
<view class="boxconstantbox">
|
||||||
|
<view class="boxconstantbox_one">可使用类型</view>
|
||||||
|
<view class="u-m-t-16">
|
||||||
|
<my-dine-types v-model="form.orderType"></my-dine-types>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-m-t-32 u-font-28 x-padding">
|
||||||
|
<view class="boxconstantbox_one u-m-b-24">首页弹窗</view>
|
||||||
|
<u-switch :active-value="1" :inactive-value="0" v-model="form.homeEnable"></u-switch>
|
||||||
|
</view>
|
||||||
|
<view class="boxconstantbox">
|
||||||
|
<view class="boxconstantbox_one">可使用类型</view>
|
||||||
|
<view class="u-m-t-16">
|
||||||
|
<u-radio-group v-model="form.homeType">
|
||||||
|
<u-radio name="only" label="仅显示1次"></u-radio>
|
||||||
|
<u-radio name="day" label="每天显示1次"></u-radio>
|
||||||
|
<u-radio name="every" label="每次达成触发条件都显示"></u-radio>
|
||||||
|
</u-radio-group>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="x-padding u-m-t-32">
|
||||||
|
<button class="preview" @click="showPreview = true">预览</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<up-popup :show="showPreview" mode="center" round="16rpx" closeOnClickOverlay @close="showPreview = false" :safeAreaInsetBottom="false">
|
||||||
|
<!-- <view class="preview-box">
|
||||||
|
<view class="u-flex" style="align-items: stretch">
|
||||||
|
<view class="u-flex-1 u-p-r-24 u-flex u-flex-col" style="align-items: start; justify-content: space-between">
|
||||||
|
<view>
|
||||||
|
<view class="u-font-28 font-bold color-333">{{ form.title }}</view>
|
||||||
|
<view class="u-m-t-16 u-font-24 color-666">{{ form.content }}</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class="boxconstantbox" style="padding: 32rpx 0">
|
<view class="color-999 u-font-24 u-m-t-16">{{ form.note }}</view>
|
||||||
<view class="u-flex u-row-between x-padding">
|
</view>
|
||||||
<view class="boxconstantbox_one"> 群二维码</view>
|
<image :src="form.qrCode" style="width: 240rpx; height: 240rpx" mode="scaleToFill"></image>
|
||||||
<button class="upload" @click="uploadImage">上传</button>
|
</view>
|
||||||
</view>
|
</view> -->
|
||||||
<view class="u-m-t-24 u-flex u-row-center">
|
<view class="new_preview">
|
||||||
<view class="code" @click="uploadImage">
|
<view class="header">{{ shopInfo.shopName }}</view>
|
||||||
<up-icon
|
<view class="content">
|
||||||
name="plus"
|
<view class="title">{{ form.title }}</view>
|
||||||
v-if="!form.qrCode"
|
<view class="img_wrap">
|
||||||
size="20"
|
<image class="img" :src="form.qrCode"></image>
|
||||||
color="#999"
|
</view>
|
||||||
></up-icon>
|
<view class="intro">
|
||||||
<image
|
{{ form.content }}
|
||||||
v-else
|
</view>
|
||||||
style="width: 260rpx; height: 260rpx"
|
<view class="foot">
|
||||||
:src="form.qrCode"
|
{{ form.note }}
|
||||||
mode="scaleToFill"
|
</view>
|
||||||
/>
|
</view>
|
||||||
</view>
|
<view class="close" @click="showPreview = false">
|
||||||
</view>
|
<u-icon name="close" color="#fff" size="14"></u-icon>
|
||||||
<view class="u-m-t-32">
|
</view>
|
||||||
<up-line ></up-line>
|
</view>
|
||||||
</view>
|
</up-popup>
|
||||||
<view class="u-m-t-32 u-font-28 x-padding">
|
<my-bottom-btn-group @cancel="cancel" @save="editFreeDing"></my-bottom-btn-group>
|
||||||
<view class="boxconstantbox_one u-m-b-24"> 模块标题 </view>
|
</view>
|
||||||
<up-input
|
|
||||||
placeholderClass="u-font-28"
|
|
||||||
v-model="form.title"
|
|
||||||
:maxlength="20"
|
|
||||||
|
|
||||||
placeholder="请输入模块标题"
|
|
||||||
></up-input>
|
|
||||||
</view>
|
|
||||||
<view class="u-m-t-32">
|
|
||||||
<up-line ></up-line>
|
|
||||||
</view>
|
|
||||||
<view class="u-m-t-32 u-font-28 x-padding">
|
|
||||||
<view class="boxconstantbox_one u-m-b-24"> 模块提示语</view>
|
|
||||||
<up-input
|
|
||||||
placeholderClass="u-font-28"
|
|
||||||
v-model="form.note"
|
|
||||||
:maxlength="20"
|
|
||||||
placeholder="请输入模块提示语"
|
|
||||||
></up-input>
|
|
||||||
</view>
|
|
||||||
<view class="u-m-t-32">
|
|
||||||
<up-line ></up-line>
|
|
||||||
</view>
|
|
||||||
<view class="u-m-t-32 u-font-28 x-padding">
|
|
||||||
<view class="boxconstantbox_one u-m-b-24"> 模块内容</view>
|
|
||||||
<up-textarea
|
|
||||||
type="textarea"
|
|
||||||
:maxlength="50"
|
|
||||||
placeholderClass="u-font-28"
|
|
||||||
v-model="form.content"
|
|
||||||
placeholder="请输入模块内容"
|
|
||||||
></up-textarea>
|
|
||||||
</view>
|
|
||||||
<view class="u-m-t-32">
|
|
||||||
<up-line ></up-line>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="x-padding u-m-t-32">
|
|
||||||
<button class="preview" @click="showPreview = true">预览</button>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<up-popup
|
|
||||||
:show="showPreview"
|
|
||||||
mode="center"
|
|
||||||
round="16rpx"
|
|
||||||
closeOnClickOverlay
|
|
||||||
@close="showPreview = false"
|
|
||||||
:safeAreaInsetBottom="false"
|
|
||||||
>
|
|
||||||
<view class="preview-box">
|
|
||||||
<view class="u-flex" style="align-items: stretch">
|
|
||||||
<view
|
|
||||||
class="u-flex-1 u-p-r-24 u-flex u-flex-col"
|
|
||||||
style="align-items: start; justify-content: space-between"
|
|
||||||
>
|
|
||||||
<view>
|
|
||||||
<view class="u-font-28 font-bold color-333">{{
|
|
||||||
form.title
|
|
||||||
}}</view>
|
|
||||||
<view class="u-m-t-16 u-font-24 color-666">{{
|
|
||||||
form.content
|
|
||||||
}}</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="color-999 u-font-24 u-m-t-16">{{ form.note }}</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<image
|
|
||||||
:src="form.qrCode"
|
|
||||||
style="width: 240rpx; height: 240rpx"
|
|
||||||
mode="scaleToFill"
|
|
||||||
></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</up-popup>
|
|
||||||
|
|
||||||
<my-bottom-btn-group
|
|
||||||
@cancel="cancel"
|
|
||||||
@save="editFreeDing"
|
|
||||||
></my-bottom-btn-group>
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onShow, onLoad } from "@dcloudio/uni-app";
|
import { onShow, onLoad } from '@dcloudio/uni-app';
|
||||||
import { reactive, ref, watch } from "vue";
|
import { reactive, ref, watch } from 'vue';
|
||||||
import { uploadFile } from "@/http/api/index.js";
|
import { uploadFile } from '@/http/api/index.js';
|
||||||
|
import { getConfig, update } from '@/http/api/market/drainageConfig.js';
|
||||||
|
const shopInfo = ref('');
|
||||||
|
|
||||||
import { getConfig, update } from "@/http/api/market/drainageConfig.js";
|
|
||||||
const showPreview = ref(false);
|
const showPreview = ref(false);
|
||||||
|
const defaultNote = ref('如果长按不能识别,可截图或保存二维码图片至相册,通过微信扫码入群');
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
content: "",
|
id: '',
|
||||||
isEnable: 0,
|
orderType: [], // 订单页显示类型: 堂食 dine-in 外带 take-out 外卖 take-away
|
||||||
note: "长按识别,微信内扫一扫加好友",
|
homeType: '', // 首页显示类型:only 仅显示 1 次,day 每天显示一次,every 每次进入小程序
|
||||||
qrCode: "",
|
qrCode: '',
|
||||||
title: "扫码进取,优惠多多",
|
title: '',
|
||||||
useType: [],
|
content: '', //
|
||||||
});
|
note: defaultNote.value,
|
||||||
onLoad(() => {
|
orderEnable: 1, // 订单页是否开启
|
||||||
// uni.$utils.inputReg.bind()()
|
homeEnable: 1 // 首页是否开启
|
||||||
});
|
|
||||||
onShow(() => {
|
|
||||||
getlist();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取配置信息
|
* 获取配置信息
|
||||||
*/
|
*/
|
||||||
const getlist = async () => {
|
const getConfigAjax = async () => {
|
||||||
let res = await getConfig();
|
let res = await getConfig();
|
||||||
res.useType = res.useType || [];
|
res.useType = res.useType || [];
|
||||||
res.note=res.note||"长按识别,微信内扫一扫加好友"
|
res.note = res.note || '长按识别,微信内扫一扫加好友';
|
||||||
res.title=res.title||"扫码进取,优惠多多"
|
res.title = res.title || '扫码进取,优惠多多';
|
||||||
Object.assign(form, res);
|
Object.assign(form, res);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改配置信息
|
* 修改配置信息
|
||||||
*/
|
*/
|
||||||
const editFreeDing = async () => {
|
const editFreeDing = async () => {
|
||||||
if(form.useType.length == 0){
|
if (form.orderEnable == 1 && form.orderType.length == 0) {
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
title: "请选择可使用类型",
|
title: '请选择可使用类型'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!form.qrCode) {
|
if (!form.qrCode) {
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
title: "请上传群二维码",
|
title: '请上传群二维码'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!form.title) {
|
if (!form.title) {
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
title: "请输入模块标题",
|
title: '请输入模块标题'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (form.homeEnable == 1 && form.homeType.length == 0) {
|
||||||
let res = await update(form);
|
return uni.showToast({
|
||||||
uni.showToast({
|
icon: 'none',
|
||||||
title: "保存成功",
|
title: '请选择首页显示类型'
|
||||||
});
|
});
|
||||||
Object.assign(form, res);
|
}
|
||||||
setTimeout(() => {
|
form.note = defaultNote.value;
|
||||||
uni.navigateBack();
|
let res = await update(form);
|
||||||
}, 1500);
|
uni.showToast({
|
||||||
|
title: '保存成功'
|
||||||
|
});
|
||||||
|
Object.assign(form, res);
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateBack();
|
||||||
|
}, 1500);
|
||||||
};
|
};
|
||||||
|
|
||||||
function uploadImage() {
|
function uploadImage() {
|
||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: 1,
|
count: 1,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
uploadFile(res.tempFiles[0]).then((res) => {
|
uploadFile(res.tempFiles[0]).then((res) => {
|
||||||
if (res) {
|
if (res) {
|
||||||
form.qrCode = res;
|
form.qrCode = res;
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
title: "上传失败",
|
title: '上传失败'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancel() {
|
function cancel() {
|
||||||
uni.navigateBack();
|
uni.navigateBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onLoad(() => {
|
||||||
|
shopInfo.value = uni.getStorageSync('shopInfo');
|
||||||
|
// uni.$utils.inputReg.bind()()
|
||||||
|
});
|
||||||
|
|
||||||
|
onShow(() => {
|
||||||
|
getConfigAjax();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
.x-padding {
|
.x-padding {
|
||||||
padding-left: 28rpx;
|
padding-left: 28rpx;
|
||||||
padding-right: 28rpx;
|
padding-right: 28rpx;
|
||||||
}
|
}
|
||||||
.boxconstant {
|
.boxconstant {
|
||||||
padding: 32rpx 28rpx;
|
padding: 32rpx 28rpx;
|
||||||
background: #f7f7f7;
|
background: #f7f7f7;
|
||||||
.boxconstantbox {
|
.boxconstantbox {
|
||||||
padding: 32rpx 24rpx;
|
padding: 32rpx 24rpx;
|
||||||
border-radius: 16rpx;
|
border-radius: 16rpx;
|
||||||
margin-top: 32rpx;
|
margin-top: 32rpx;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
|
|
||||||
.boxconstantbox_one {
|
.boxconstantbox_one {
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.boxconstantbox_tow {
|
.boxconstantbox_tow {
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
// display: flex;
|
// display: flex;
|
||||||
// justify-content: flex-start;
|
// justify-content: flex-start;
|
||||||
// align-items: center;
|
// align-items: center;
|
||||||
// flex-wrap: wrap;
|
// flex-wrap: wrap;
|
||||||
// align-content: flex-start;
|
// align-content: flex-start;
|
||||||
.text {
|
.text {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin: 0 12rpx;
|
margin: 0 12rpx;
|
||||||
width: 118rpx;
|
width: 118rpx;
|
||||||
height: 48rpx;
|
height: 48rpx;
|
||||||
line-height: 48rpx;
|
line-height: 48rpx;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||||
border: 2rpx solid #e5e5e5;
|
border: 2rpx solid #e5e5e5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.oneboxconstant {
|
.oneboxconstant {
|
||||||
margin-top: 32rpx;
|
margin-top: 32rpx;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
padding: 32rpx 24rpx;
|
padding: 32rpx 24rpx;
|
||||||
|
|
||||||
.oneboxconstant_one {
|
.oneboxconstant_one {
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.save {
|
.save {
|
||||||
margin: 100rpx auto 50rpx auto;
|
margin: 100rpx auto 50rpx auto;
|
||||||
width: 530rpx;
|
width: 530rpx;
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
background: #318afe;
|
background: #318afe;
|
||||||
border-radius: 56rpx 56rpx 56rpx 56rpx;
|
border-radius: 56rpx 56rpx 56rpx 56rpx;
|
||||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
line-height: 80rpx;
|
line-height: 80rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.top {
|
.top {
|
||||||
padding: 24rpx 20rpx 28rpx 28rpx;
|
padding: 24rpx 20rpx 28rpx 28rpx;
|
||||||
}
|
}
|
||||||
.number-box {
|
.number-box {
|
||||||
width: 260rpx;
|
width: 260rpx;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
padding: 10rpx 26rpx;
|
padding: 10rpx 26rpx;
|
||||||
border-radius: 6rpx 0 0 6rpx;
|
border-radius: 6rpx 0 0 6rpx;
|
||||||
border-top: 2rpx solid #d9d9d9;
|
border-top: 2rpx solid #d9d9d9;
|
||||||
border-bottom: 2rpx solid #d9d9d9;
|
border-bottom: 2rpx solid #d9d9d9;
|
||||||
border-left: 2rpx solid #d9d9d9;
|
border-left: 2rpx solid #d9d9d9;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
.bei {
|
.bei {
|
||||||
display: flex;
|
display: flex;
|
||||||
padding: 10rpx 38rpx;
|
padding: 10rpx 38rpx;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border-radius: 0 6rpx 6rpx 0;
|
border-radius: 0 6rpx 6rpx 0;
|
||||||
border: 2rpx solid #d9d9d9;
|
border: 2rpx solid #d9d9d9;
|
||||||
background: #f7f7fa;
|
background: #f7f7fa;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #999999;
|
color: #999999;
|
||||||
}
|
}
|
||||||
.upload {
|
.upload {
|
||||||
padding: 8rpx 32rpx;
|
padding: 8rpx 32rpx;
|
||||||
border-radius: 60rpx;
|
border-radius: 60rpx;
|
||||||
background: $my-main-color;
|
background: $my-main-color;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
line-height: 40rpx;
|
line-height: 40rpx;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
.code {
|
.code {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 264rpx;
|
width: 264rpx;
|
||||||
height: 264rpx;
|
height: 264rpx;
|
||||||
padding: 108rpx;
|
padding: 108rpx;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 20rpx;
|
gap: 20rpx;
|
||||||
border: 3rpx dashed #d9d9d9;
|
border: 3rpx dashed #d9d9d9;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
padding: 2rpx;
|
padding: 2rpx;
|
||||||
}
|
}
|
||||||
.preview {
|
.preview {
|
||||||
padding: 8rpx 32rpx;
|
padding: 8rpx 32rpx;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
background: $my-main-color;
|
background: $my-main-color;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
line-height: 40rpx;
|
line-height: 40rpx;
|
||||||
}
|
}
|
||||||
.preview-box {
|
.preview-box {
|
||||||
width: 700rpx;
|
width: 700rpx;
|
||||||
padding: 32rpx 28rpx;
|
padding: 32rpx 28rpx;
|
||||||
|
}
|
||||||
|
.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>
|
</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>
|
</view>
|
||||||
<my-tabs v-model="active" :list="tabs" textKey="label"></my-tabs>
|
<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 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>
|
<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" />
|
<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>
|
<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>
|
||||||
<view class="u-flex-1 u-font-28 filter-box u-flex u-row-between" @click="showTimeArea = true">
|
<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">
|
<template v-if="userComponentQuery.startTime && userComponentQuery.endTime">
|
||||||
@@ -215,6 +218,7 @@ function refresh() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const listRes = ref({});
|
const listRes = ref({});
|
||||||
|
const userId=ref('')
|
||||||
async function getList() {
|
async function getList() {
|
||||||
let res = null;
|
let res = null;
|
||||||
if (active.value == 1) {
|
if (active.value == 1) {
|
||||||
@@ -232,7 +236,8 @@ async function getList() {
|
|||||||
res = await memberApi.orderList({
|
res = await memberApi.orderList({
|
||||||
page: pageNum.value,
|
page: pageNum.value,
|
||||||
size: 10,
|
size: 10,
|
||||||
key: userComponentQuery.user,
|
// key: userComponentQuery.user,
|
||||||
|
key: userId.value,
|
||||||
startTime: userComponentQuery.startTime ? userComponentQuery.startTime + ' 00:00:00' : '',
|
startTime: userComponentQuery.startTime ? userComponentQuery.startTime + ' 00:00:00' : '',
|
||||||
endTime: userComponentQuery.endTime ? userComponentQuery.endTime + ' 23:59:59' : ''
|
endTime: userComponentQuery.endTime ? userComponentQuery.endTime + ' 23:59:59' : ''
|
||||||
});
|
});
|
||||||
@@ -264,6 +269,7 @@ watch(
|
|||||||
userComponentQuery.startTime = '';
|
userComponentQuery.startTime = '';
|
||||||
userComponentQuery.endTime = '';
|
userComponentQuery.endTime = '';
|
||||||
keyWord.value = '';
|
keyWord.value = '';
|
||||||
|
userId.value=''
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user