Compare commits

..

No commits in common. '48cb65941e10f0344334cb713222147bbf7b8eea' and '39fc2cc8cc440331e03c98754bfdc3ed1edfd4a4' have entirely different histories.

@ -1,91 +0,0 @@
import {
request
} from "@/utils/request";
export default {
SalesDiscounts: {
List(data) {
return request({
url: "/shop/SalesDiscounts/List",
method: "GET",
data,
type: 'mall'
});
},
GetItem(data) {
return request({
url: "/shop/SalesDiscounts/GetItem",
method: "GET",
data,
type: 'mall'
});
},
Create(data) {
return request({
url: "/shop/SalesDiscounts/Create",
method: "POST",
data,
type: 'mall'
});
},
},
SalesFullDiscounts: {
List(data) {
return request({
url: "/shop/SalesFullDiscounts/List",
method: "GET",
data,
type: 'mall'
});
},
GetItem(data) {
return request({
url: "/shop/SalesFullDiscounts/GetItem",
method: "GET",
data,
type: 'mall'
});
},
Create(data) {
return request({
url: "/shop/SalesFullDiscounts/Create",
method: "POST",
data,
type: 'mall'
});
},
},
SalesFullSetRedution: {
List(data) {
return request({
url: "/shop/SalesFullSetRedution/List",
method: "GET",
data,
type: 'mall'
});
},
GetItem(data) {
return request({
url: "/shop/SalesFullSetRedution/GetItem",
method: "GET",
data,
type: 'mall'
});
},
Create(data) {
return request({
url: "/shop/SalesFullSetRedution/Create",
method: "POST",
data,
type: 'mall'
});
},
}
};

@ -37,14 +37,4 @@ export default {
}, },
getSetting(data) {
return request({
url: "/admin/common/getSetting",
method: "GET",
data,
})
},
}; };

@ -1,135 +0,0 @@
import {
request
} from "@/utils/request";
export default {
PointsList(data) {
return request({
url: "/admin/PointsGoods/PointsList",
method: "POST",
data,
type: 'store'
})
},
PointsSave(data) {
return request({
url: "/admin/PointsGoods/PointsSave",
method: "POST",
data,
type: 'store'
})
},
classifyList(data) {
return request({
url: "/admin/PointsGoods/classifyList",
method: "POST",
data,
type: 'store'
})
},
ClassifySave(data) {
return request({
url: "/admin/PointsGoods/ClassifySave",
method: "POST",
data,
type: 'store'
})
},
list(data) {
return request({
url: "/admin/PointsGoods/goodsList",
method: "POST",
data,
type: 'store'
});
},
goodsItem(data) {
return request({
url: "/admin/PointsGoods/goodsItem",
method: "POST",
data,
type: 'store'
});
},
goodsEdit(data) {
return request({
url: "/admin/PointsGoods/goodsEdit",
method: "POST",
data,
type: 'store'
});
},
goodsDel(data) {
return request({
url: "/admin/PointsGoods/goodsDel",
method: "POST",
data,
type: 'store'
});
},
orderList(data) {
return request({
url: "/admin/PointsOrder/orderList",
method: "POST",
data,
type: 'store'
});
},
orderSend(data) {
return request({
url: "/admin/PointsOrder/orderSend",
method: "POST",
data,
type: 'store'
});
},
GetExpressList(data) {
return request({
url: "/admin/PointsOrder/GetExpressList",
method: "POST",
data,
type: 'store'
});
},
printOrder(data) {
return request({
url: "/admin/PointsOrder/printOrder",
method: "POST",
data,
type: 'store'
});
},
updateNotes(data) {
return request({
url: "/admin/PointsOrder/updateNotes",
method: "POST",
data,
type: 'store'
});
},
confirmCancel(data) {
return request({
url: "/admin/PointsOrder/confirmCancel",
method: "POST",
data,
type: 'store'
});
},
};

@ -30,16 +30,6 @@ export default {
}); });
}, },
del(data) {
return request({
url: "/admin/recharge/del",
method: "GET",
data,
type: 'store'
});
},
rechargeSet: { rechargeSet: {
list(data) { list(data) {
return request({ return request({

@ -2,10 +2,6 @@
<view class="myTabbar"> <view class="myTabbar">
<wd-tabbar custom-class="mb-3" fixed safeAreaInsetBottom placeholder v-model="tab" shape="round"> <wd-tabbar custom-class="mb-3" fixed safeAreaInsetBottom placeholder v-model="tab" shape="round">
<wd-tabbar-item @click="utils.toUrl('/mall/index/index')" name="home" title="首页" icon="home"></wd-tabbar-item> <wd-tabbar-item @click="utils.toUrl('/mall/index/index')" name="home" title="首页" icon="home"></wd-tabbar-item>
<wd-tabbar-item name="function" @click="utils.toUrl('/mall/function/index')" title="应用中心"
icon="layers"></wd-tabbar-item>
<wd-tabbar-item v-if="is_store" @click="utils.toUrl('/store/index/index')" name="商城" title="返回商城" <wd-tabbar-item v-if="is_store" @click="utils.toUrl('/store/index/index')" name="商城" title="返回商城"
icon="rollback"></wd-tabbar-item> icon="rollback"></wd-tabbar-item>
<!-- <wd-tabbar-item name="cart" title="分类" icon="cart"></wd-tabbar-item> --> <!-- <wd-tabbar-item name="cart" title="分类" icon="cart"></wd-tabbar-item> -->

@ -1,184 +0,0 @@
<template>
<view>
<kevyloading v-if="loading" type="bsm-loader" color="#618af8" transparent></kevyloading>
<wd-form v-if="!loading" :model="form" :rules="rules" :disabled="mode == 'show'" ref="dialogForm" label-width="100px">
<wd-form-item label="折扣名称" prop="name">
<wd-input placeholder="请输入折扣名称" v-model="dataForm.name" clearable style="width: 100%"></wd-input>
</wd-form-item>
<wd-cell-group class="flex py-2 w-full" title="活动背景">
<view class="ml-3">
<yUpload v-model="dataForm.bg_pic" :size="1"></yUpload>
</view>
</wd-cell-group>
<wd-form-item label="活动背景颜色" prop="name">
<wd-input placeholder="请输入十六进制颜色" v-model="dataForm.bg_color" clearable style="width: 100%"></wd-input>
</wd-form-item>
<wd-form-item label="折扣比例" prop="discount">
<wd-input type="number" placeholder="请输入折扣比例" step="1" v-model.number="dataForm.discount" clearable
style="width: 100%"></wd-input>
<div style="color: #666;font-size: 12px;">
如商品单价100折扣比例40 (4)仅需付40元
</div>
</wd-form-item>
<wd-form-item label="选择商品">
<yGoods v-model="dataForm.deatil" :size="1"></yGoods>
</wd-form-item>
<div style="display: flex;flex-direction: column;">
<wd-datetime-picker v-model="dataForm.start_time" label="开始时间" />
<wd-datetime-picker v-model="dataForm.end_time" label="结束时间" />
</div>
<!-- 是否启用 -->
<wd-form-item label="是否启用:" prop="status">
<wd-switch v-model="dataForm.status" :active-value="1" :inactive-value="0"></wd-switch>
</wd-form-item>
<!-- 提交按钮 -->
<view class="mt-2 px-12 py-3 bg-slate-50">
<wd-button type="primary" size="large" @click="handleSubmit" block>
保存
</wd-button>
</view>
</wd-form>
</view>
</template>
<script>
import yGoods from "@/components/yGoods/index.vue";
import uniDataPicker from "@/components/uni-data-picker/components/uni-data-picker/uni-data-picker.vue";
import kevyloading from "@/components/kevy-loading/kevy-loading";
import utils from '@/utils/utils.js'
import { useApi } from "@/hooks/useApi.js"
import discountApi from '@/api/mall/discount.js';
import yUpload from "@/components/yUpload/index.vue";
console.log(yGoods);
/**
* 从本地存储中获取用户信息
*/
const user_info = uni.getStorageSync("user_info");
export default {
components: {
yGoods, uniDataPicker, kevyloading, yUpload
},
data() {
return {
utils,
user_info,
//
dataForm: {
"id": 0,
},
columns: [],
loading: false
};
},
onLoad(e) {
if (e.id) {
this.getData(e.id)
// this.dataForm = JSON.parse(e.edit)
// this.dataForm.start_time = new Date(this.dataForm.start_time * 1000)
// this.dataForm.end_time = new Date(this.dataForm.end_time * 1000)
// console.log(this.dataForm);
} else {
this.dataForm.start_time = new Date()
this.dataForm.end_time = new Date()
}
for (let index = 1; index <= 100; index++) {
this.columns.push(index)
}
},
methods: {
async getData(id) {
const { fetchData } = await useApi(discountApi.SalesDiscounts.GetItem)
fetchData({ id }).then(res => {
console.log(res);
this.dataForm = res.data
this.dataForm.deatil = res.data.deatil.filter(item => item)
this.dataForm.start_time = new Date(res.data.start_time * 1000)
this.dataForm.end_time = new Date(res.data.end_time * 1000)
})
},
/**
* 处理省市区选择变化
* @param {Object} value - 选择的值
*/
areaChange(value) {
//
},
/**
* 处理省市区选择
* @param {Object} detail - 选择器详细信息
*/
select({ detail }) {
if (detail.value.length) {
const [province_id, city_id, district_id] = detail.value.map(
(el) => el.value
);
this.datadataForm.province_id = province_id;
this.datadataForm.city_id = city_id;
this.datadataForm.district_id = district_id;
this.datadataForm.district = [province_id, city_id, district_id];
}
},
/**
* 处理表单提交
*/
async handleSubmit() {
console.log(this.dataForm.deatil.map(item => [item.id]));
//
const res = await discountApi.SalesDiscounts.Create({
...this.dataForm,
start_time: utils.dateFormat(this.dataForm.start_time),
end_time: utils.dateFormat(this.dataForm.end_time),
mix_id_list: this.dataForm.deatil.map(item => [item.id])
});
if (res.code == 0) {
setTimeout(() => {
uni.showToast({
title: '保存成功!',
icon: 'success'
});
}, 100);
uni.navigateBack()
}
},
},
};
</script>
<style>
/* 在这里添加样式,根据需要自定义表单样式 */
</style>

@ -1,247 +0,0 @@
<template>
<view class="content">
<kevyloading v-if="loading" type="bsm-loader" color="#618af8" transparent></kevyloading>
<!-- <view class="w-full">
<wd-navbar fixed safeAreaInsetTop :leftText="coupon_info?.info?.name || '商城首页'">
<template #right>
<wd-icon @click="utils.toUrl('/mall/setup/index')" name="setting" size="22px"></wd-icon>
</template>
</wd-navbar>
</view> -->
<view class=" bg-white sticky top-0 z-50 flex items-center">
<view class="flex-1">
<wd-search @search="search" @clear="search" v-model="params.keywords" hide-cancel>
<template #prefix>
<wd-popover v-model="popover" mode="menu" :content="menu" @menuclick="changeSearchType">
<view class="search-type">
<text>{{ searchType }}</text>
<wd-icon custom-class="icon-arrow" name="fill-arrow-down"></wd-icon>
</view>
</wd-popover>
</template>
</wd-search>
</view>
<view class="mr-2">
<wd-button @click="utils.toUrl('/mall/discount/discount/edit')" size="small">新增折扣</wd-button>
</view>
<!-- <view class="mr-2">
<wd-button @click="utils.toUrl('/mall/coupon/userCoupon')" size="small">领取记录</wd-button>
</view> -->
</view>
<!-- <view class="flex-1 bg-white pb-2">
<div class="rounded-md overflow-hidden">
<wd-tabs @change="search">
<wd-tab :title="`全部`" :name="null"></wd-tab>
<wd-tab :title="`领取后过期`" :name="0"></wd-tab>
<wd-tab :title="`定时过期`" :name="1"></wd-tab>
</wd-tabs>
</div>
</view> -->
<view class="grid p-2">
<yList height="91vh" ref="yListRef" :apiObj="discountApi.SalesDiscounts.List" :params="{ ...params }">
<template #default="{ list }">
<view>
<view v-for="item of list" class="goods">
<wd-card type="rectangle">
<template #title>
<view class="title">
<view>
<span class="mr-2">ID{{ item?.id }}</span>
</view>
<!-- <view @click="utils.copy(item.order_no, '已复制单号')" class="title-tip">
<span style="font-size: 24rpx;margin-left: 8px;">单号{{ item.order_no }}</span>
</view> -->
</view>
</template>
<view class="bg-gray-50 p-2 mb-2 flex justify-between" style="font-size: 22rpx;">
<view>折扣名称<text class="text-black">{{ item.name }}</text></view>
<view>折扣<text class="text-black">{{ item.discount || 0 }}</text></view>
</view>
<view class="bg-gray-50 p-2 mb-2 flex justify-between" style="font-size: 22rpx;">
<view>
时间
<wd-tag type="primary">{{ utils.dateFormat(item.start_time * 1000) }}</wd-tag> - <wd-tag>{{
utils.dateFormat(item.end_time * 1000) }}</wd-tag>
</view>
</view>
<template #footer>
<!-- <view class="bg-gray-50 p-2 mb-2.5 flex justify-between" style="font-size: 22rpx;">
<view>
售后状态:
</view>
</view> -->
<view class="flex justify-between items-center">
<!-- <view class="font-bold">实付: {{ item.pay_price }} </view> -->
<view>
<wd-button :round="false" size="small"
:type="['warning', 'success', 'warning', 'success', 'info'][item.status]">
<div>{{ ["关闭", "开启", "已取消"][item.status] }}</div>
</wd-button>
</view>
<view class="flex-1 flex justify-end">
<view class="mr-2">
<wd-button @click="utils.toUrl('/mall/discount/discount/edit?id=' + item.id)"
size="small">编辑</wd-button>
</view>
<!-- <view v-if="item.apply_cancel === 1" class="mr-2">
<wd-button type="error" @click="orderApproval(item)" size="small">退款</wd-button>
</view>
<view class="mr-2">
<wd-button @click="printing(item)" size="small">小票打印</wd-button>
</view>
<view class="mr-2">
<wd-button @click="orderNotes(item)" size="small">备注</wd-button>
</view>
<view v-if="item.status == 1" class="">
<wd-button @click="shipments(item)" size="small">发货</wd-button>
</view> -->
</view>
</view>
</template>
</wd-card>
</view>
</view>
</template>
</yList>
</view>
<wd-toast />
<wd-message-box></wd-message-box>
</view>
</template>
<script setup>
import { ref, nextTick } from 'vue';
import utils from '@/utils/utils.js';
import discountApi from '@/api/mall/discount.js';
import kevyloading from "@/components/kevy-loading/kevy-loading";
import yList from "/components/yList/index.vue";
import {
onShow,
} from "@dcloudio/uni-app";
const yListRef = ref(null);
const searchType = ref('折扣名称');
const popover = ref(false);
const search = () => {
if (searchType.value == '折扣名称') {
yListRef.value.upData({
name: params.value.keywords,
});
} else if (searchType.value == '折扣') {
yListRef.value.upData({
discount: params.value.keywords
});
}
};
const menu = ref([
{ content: '折扣名称' },
{ content: '折扣' },
]);
const params = ref({
name: null,
price: null,
send_type: null
});
/**
* 切换搜索类型
* @param {Object} item - 切换的项
*/
function changeSearchType({ item, index }) {
searchType.value = item.content;
search(params.value.keywords)
}
/**
* @type {Ref<boolean>}
* 控制页面加载状态的 Ref
*/
const loading = ref(false);
//
onShow(() => {
search?.()
// search('')
// getcouponList();
})
</script>
<style lang="scss" scoped>
.search-type {
position: relative;
height: 30px;
line-height: 30px;
padding: 0 8px 0 16px;
font-size: 24rpx;
color: rgba(0, 0, 0, .45);
}
.search-type::after {
position: absolute;
content: '';
width: 1px;
right: 0;
top: 5px;
bottom: 5px;
background: rgba(0, 0, 0, 0.25);
}
.search-type {
:deep(.icon-arrow) {
display: inline-block;
font-size: 20px;
vertical-align: middle;
}
}
.couponBox,
.title {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
}
.couponBox {
justify-content: flex-start;
}
.title {
justify-content: space-between;
}
.title-tip {
color: rgba(0, 0, 0, 0.25);
font-size: 12px;
}
</style>

@ -1,136 +0,0 @@
<template>
<view>
<kevyloading v-if="loading" type="bsm-loader" color="#618af8" transparent></kevyloading>
<wd-form v-if="!loading" :model="form" :rules="rules" :disabled="mode == 'show'" ref="dialogForm" label-width="100px">
<wd-form-item label="折扣名称" prop="name">
<wd-input placeholder="请输入折扣名称" v-model="dataForm.name" clearable style="width: 100%"></wd-input>
</wd-form-item>
<wd-form-item label="满减数量" prop="full_discount">
<wd-input type="number" placeholder="请输入折扣比例" step="1" v-model.number="dataForm.full_discount" clearable
style="width: 100%"></wd-input>
</wd-form-item>
<wd-form-item label="折扣比例" prop="discount">
<wd-input type="number" placeholder="请输入折扣比例" step="1" v-model.number="dataForm.discount" clearable
style="width: 100%"></wd-input>
<div style="color: #666;font-size: 12px;">
如商品单价100折扣比例40 (4)仅需付40元
</div>
</wd-form-item>
<!-- 是否启用 -->
<wd-form-item label="是否启用:" prop="status">
<wd-switch v-model="dataForm.status" :active-value="1" :inactive-value="0"></wd-switch>
</wd-form-item>
<!-- 提交按钮 -->
<view class="mt-2 px-12 py-3 bg-slate-50">
<wd-button type="primary" size="large" @click="handleSubmit" block>
保存
</wd-button>
</view>
</wd-form>
</view>
</template>
<script>
import yGoods from "@/components/yGoods/index.vue";
import uniDataPicker from "@/components/uni-data-picker/components/uni-data-picker/uni-data-picker.vue";
import kevyloading from "@/components/kevy-loading/kevy-loading";
import utils from '@/utils/utils.js'
import { useApi } from "@/hooks/useApi.js"
import discountApi from '@/api/mall/discount.js';
import yUpload from "@/components/yUpload/index.vue";
console.log(yGoods);
/**
* 从本地存储中获取用户信息
*/
const user_info = uni.getStorageSync("user_info");
export default {
components: {
yGoods, uniDataPicker, kevyloading, yUpload
},
data() {
return {
utils,
user_info,
//
dataForm: {
"id": 0,
},
columns: [],
loading: false
};
},
onLoad(e) {
if (e.id) {
this.getData(e.id)
// this.dataForm = JSON.parse(e.edit)
// this.dataForm.start_time = new Date(this.dataForm.start_time * 1000)
// this.dataForm.end_time = new Date(this.dataForm.end_time * 1000)
// console.log(this.dataForm);
} else {
}
for (let index = 1; index <= 100; index++) {
this.columns.push(index)
}
},
methods: {
async getData(id) {
const { fetchData } = await useApi(discountApi.SalesFullDiscounts.GetItem)
fetchData({ id }).then(res => {
this.dataForm = res.data
})
},
/**
* 处理省市区选择变化
* @param {Object} value - 选择的值
*/
areaChange(value) {
//
},
/**
* 处理表单提交
*/
async handleSubmit() {
//
const res = await discountApi.SalesFullDiscounts.Create({
...this.dataForm,
});
if (res.code == 0) {
setTimeout(() => {
uni.showToast({
title: '保存成功!',
icon: 'success'
});
}, 100);
uni.navigateBack()
}
},
},
};
</script>
<style>
/* 在这里添加样式,根据需要自定义表单样式 */
</style>

@ -1,237 +0,0 @@
<template>
<view class="content">
<kevyloading v-if="loading" type="bsm-loader" color="#618af8" transparent></kevyloading>
<!-- <view class="w-full">
<wd-navbar fixed safeAreaInsetTop :leftText="coupon_info?.info?.name || '商城首页'">
<template #right>
<wd-icon @click="utils.toUrl('/mall/setup/index')" name="setting" size="22px"></wd-icon>
</template>
</wd-navbar>
</view> -->
<view class=" bg-white sticky top-0 z-50 flex items-center">
<view class="flex-1">
<wd-search @search="search" @clear="search" v-model="params.keywords" hide-cancel>
<template #prefix>
<wd-popover v-model="popover" mode="menu" :content="menu" @menuclick="changeSearchType">
<view class="search-type">
<text>{{ searchType }}</text>
<wd-icon custom-class="icon-arrow" name="fill-arrow-down"></wd-icon>
</view>
</wd-popover>
</template>
</wd-search>
</view>
<view class="mr-2">
<wd-button @click="utils.toUrl('/mall/discount/full_discount/edit')" size="small">新增折扣</wd-button>
</view>
<!-- <view class="mr-2">
<wd-button @click="utils.toUrl('/mall/coupon/userCoupon')" size="small">领取记录</wd-button>
</view> -->
</view>
<!-- <view class="flex-1 bg-white pb-2">
<div class="rounded-md overflow-hidden">
<wd-tabs @change="search">
<wd-tab :title="`全部`" :name="null"></wd-tab>
<wd-tab :title="`领取后过期`" :name="0"></wd-tab>
<wd-tab :title="`定时过期`" :name="1"></wd-tab>
</wd-tabs>
</div>
</view> -->
<view class="grid p-2">
<yList height="91vh" ref="yListRef" :apiObj="fullDiscountApi.SalesFullDiscounts.List" :params="{ ...params }">
<template #default="{ list }">
<view>
<view v-for="item of list" class="goods">
<wd-card type="rectangle">
<template #title>
<view class="title">
<view>
<span class="mr-2">ID{{ item?.id }}</span>
</view>
<!-- <view @click="utils.copy(item.order_no, '已复制单号')" class="title-tip">
<span style="font-size: 24rpx;margin-left: 8px;">单号{{ item.order_no }}</span>
</view> -->
</view>
</template>
<view class="bg-gray-50 p-2 mb-2 flex justify-between" style="font-size: 22rpx;">
<view>折扣名称<text class="text-black">{{ item.name }}</text></view>
<view>折扣<text class="text-black">{{ item.fullDiscount || 0 }}</text></view>
</view>
<template #footer>
<!-- <view class="bg-gray-50 p-2 mb-2.5 flex justify-between" style="font-size: 22rpx;">
<view>
售后状态:
</view>
</view> -->
<view class="flex justify-between items-center">
<!-- <view class="font-bold">实付: {{ item.pay_price }} </view> -->
<view>
<wd-button :round="false" size="small"
:type="['warning', 'success', 'warning', 'success', 'info'][item.status]">
<div>{{ ["关闭", "开启", "已取消"][item.status] }}</div>
</wd-button>
</view>
<view class="flex-1 flex justify-end">
<view class="mr-2">
<wd-button @click="utils.toUrl('/mall/discount/full_discount/edit?id=' + item.id)"
size="small">编辑</wd-button>
</view>
<!-- <view v-if="item.apply_cancel === 1" class="mr-2">
<wd-button type="error" @click="orderApproval(item)" size="small">退款</wd-button>
</view>
<view class="mr-2">
<wd-button @click="printing(item)" size="small">小票打印</wd-button>
</view>
<view class="mr-2">
<wd-button @click="orderNotes(item)" size="small">备注</wd-button>
</view>
<view v-if="item.status == 1" class="">
<wd-button @click="shipments(item)" size="small">发货</wd-button>
</view> -->
</view>
</view>
</template>
</wd-card>
</view>
</view>
</template>
</yList>
</view>
<wd-toast />
<wd-message-box></wd-message-box>
</view>
</template>
<script setup>
import { ref, nextTick } from 'vue';
import utils from '@/utils/utils.js';
import fullDiscountApi from '@/api/mall/discount.js';
import kevyloading from "@/components/kevy-loading/kevy-loading";
import yList from "/components/yList/index.vue";
import {
onShow,
} from "@dcloudio/uni-app";
const yListRef = ref(null);
const searchType = ref('折扣名称');
const popover = ref(false);
const search = () => {
if (searchType.value == '折扣名称') {
yListRef.value.upData({
name: params.value.keywords,
});
} else if (searchType.value == '折扣') {
yListRef.value.upData({
fullDiscount: params.value.keywords
});
}
};
const menu = ref([
{ content: '折扣名称' },
{ content: '折扣' },
]);
const params = ref({
name: null,
price: null,
send_type: null
});
/**
* 切换搜索类型
* @param {Object} item - 切换的项
*/
function changeSearchType({ item, index }) {
searchType.value = item.content;
search(params.value.keywords)
}
/**
* @type {Ref<boolean>}
* 控制页面加载状态的 Ref
*/
const loading = ref(false);
//
onShow(() => {
search?.()
// search('')
// getcouponList();
})
</script>
<style lang="scss" scoped>
.search-type {
position: relative;
height: 30px;
line-height: 30px;
padding: 0 8px 0 16px;
font-size: 24rpx;
color: rgba(0, 0, 0, .45);
}
.search-type::after {
position: absolute;
content: '';
width: 1px;
right: 0;
top: 5px;
bottom: 5px;
background: rgba(0, 0, 0, 0.25);
}
.search-type {
:deep(.icon-arrow) {
display: inline-block;
font-size: 20px;
vertical-align: middle;
}
}
.couponBox,
.title {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
}
.couponBox {
justify-content: flex-start;
}
.title {
justify-content: space-between;
}
.title-tip {
color: rgba(0, 0, 0, 0.25);
font-size: 12px;
}
</style>

@ -1,193 +0,0 @@
<template>
<view>
<kevyloading v-if="loading" type="bsm-loader" color="#618af8" transparent></kevyloading>
<wd-form v-if="!loading" :model="form" :rules="rules" :disabled="mode == 'show'" ref="dialogForm" label-width="100px">
<wd-form-item label="折扣名称" prop="name">
<wd-input placeholder="请输入折扣名称" v-model="dataForm.name" clearable style="width: 100%"></wd-input>
</wd-form-item>
<wd-cell-group class="flex py-2 w-full" title="活动背景">
<view class="ml-3">
<yUpload v-model="dataForm.bg_pic" :size="1"></yUpload>
</view>
</wd-cell-group>
<wd-form-item label="活动背景颜色" prop="name">
<wd-input placeholder="请输入十六进制颜色" v-model="dataForm.bg_color" clearable style="width: 100%"></wd-input>
</wd-form-item>
<wd-form-item label="满减金额" prop="name">
<wd-input placeholder="请输入" v-model="dataForm.full_price" clearable style="width: 100%"></wd-input>
</wd-form-item>
<wd-form-item label="折扣比例" prop="discount">
<wd-input type="number" placeholder="请输入折扣比例" step="1" v-model.number="dataForm.discount" clearable
style="width: 100%"></wd-input>
<div style="color: #666;font-size: 12px;">
如商品单价100折扣比例40 (4)仅需付40元
</div>
</wd-form-item>
<wd-form-item label="选择商品">
<yGoods v-model="dataForm.deatil" :size="1"></yGoods>
</wd-form-item>
<div style="display: flex;flex-direction: column;">
<wd-datetime-picker v-model="dataForm.start_time" label="开始时间" />
<wd-datetime-picker v-model="dataForm.end_time" label="结束时间" />
</div>
<!-- 是否启用 -->
<wd-form-item label="是否启用:" prop="status">
<wd-switch v-model="dataForm.status" :active-value="1" :inactive-value="0"></wd-switch>
</wd-form-item>
<!-- 提交按钮 -->
<view class="mt-2 px-12 py-3 bg-slate-50">
<wd-button type="primary" size="large" @click="handleSubmit" block>
保存
</wd-button>
</view>
</wd-form>
</view>
</template>
<script>
import { ref } from 'vue';
import yGoods from "@/components/yGoods/index.vue";
import uniDataPicker from "@/components/uni-data-picker/components/uni-data-picker/uni-data-picker.vue";
import kevyloading from "@/components/kevy-loading/kevy-loading";
import utils from '@/utils/utils.js'
import userMembers from '@/api/mall/userMembers.js';
import { useApi } from "@/hooks/useApi.js"
import discountApi from '@/api/mall/discount.js';
import yUpload from "@/components/yUpload/index.vue";
console.log(yGoods);
/**
* 从本地存储中获取用户信息
*/
const user_info = uni.getStorageSync("user_info");
export default {
components: {
yGoods, uniDataPicker, kevyloading, yUpload
},
data() {
return {
utils,
user_info,
//
dataForm: {
"id": 0,
},
columns: [],
loading: false
};
},
onLoad(e) {
if (e.id) {
this.getData(e.id)
// this.dataForm = JSON.parse(e.edit)
// this.dataForm.start_time = new Date(this.dataForm.start_time * 1000)
// this.dataForm.end_time = new Date(this.dataForm.end_time * 1000)
// console.log(this.dataForm);
} else {
this.dataForm.start_time = new Date()
this.dataForm.end_time = new Date()
}
for (let index = 1; index <= 100; index++) {
this.columns.push(index)
}
},
methods: {
async getData(id) {
const { fetchData } = await useApi(discountApi.SalesFullSetRedution.GetItem)
fetchData({ id }).then(res => {
console.log(res);
this.dataForm = res.data
this.dataForm.deatil = res.data.deatil.filter(item => item)
this.dataForm.start_time = new Date(res.data.start_time * 1000)
this.dataForm.end_time = new Date(res.data.end_time * 1000)
})
},
/**
* 处理省市区选择变化
* @param {Object} value - 选择的值
*/
areaChange(value) {
//
},
/**
* 处理省市区选择
* @param {Object} detail - 选择器详细信息
*/
select({ detail }) {
if (detail.value.length) {
const [province_id, city_id, district_id] = detail.value.map(
(el) => el.value
);
this.datadataForm.province_id = province_id;
this.datadataForm.city_id = city_id;
this.datadataForm.district_id = district_id;
this.datadataForm.district = [province_id, city_id, district_id];
}
},
/**
* 处理表单提交
*/
async handleSubmit() {
console.log(this.dataForm.deatil.map(item => [item.id]));
//
const res = await discountApi.SalesFullSetRedution.Create({
...this.dataForm,
start_time: utils.dateFormat(this.dataForm.start_time),
end_time: utils.dateFormat(this.dataForm.end_time),
mix_id_list: this.dataForm.deatil.map(item => [item.id])
});
if (res.code == 0) {
setTimeout(() => {
uni.showToast({
title: '保存成功!',
icon: 'success'
});
}, 100);
uni.navigateBack()
}
},
},
};
</script>
<style>
/* 在这里添加样式,根据需要自定义表单样式 */
</style>

@ -1,247 +0,0 @@
<template>
<view class="content">
<kevyloading v-if="loading" type="bsm-loader" color="#618af8" transparent></kevyloading>
<!-- <view class="w-full">
<wd-navbar fixed safeAreaInsetTop :leftText="coupon_info?.info?.name || '商城首页'">
<template #right>
<wd-icon @click="utils.toUrl('/mall/setup/index')" name="setting" size="22px"></wd-icon>
</template>
</wd-navbar>
</view> -->
<view class=" bg-white sticky top-0 z-50 flex items-center">
<view class="flex-1">
<wd-search @search="search" @clear="search" v-model="params.keywords" hide-cancel>
<template #prefix>
<wd-popover v-model="popover" mode="menu" :content="menu" @menuclick="changeSearchType">
<view class="search-type">
<text>{{ searchType }}</text>
<wd-icon custom-class="icon-arrow" name="fill-arrow-down"></wd-icon>
</view>
</wd-popover>
</template>
</wd-search>
</view>
<view class="mr-2">
<wd-button @click="utils.toUrl('/mall/discount/full_set_redution/edit')" size="small">新增折扣</wd-button>
</view>
<!-- <view class="mr-2">
<wd-button @click="utils.toUrl('/mall/coupon/userCoupon')" size="small">领取记录</wd-button>
</view> -->
</view>
<!-- <view class="flex-1 bg-white pb-2">
<div class="rounded-md overflow-hidden">
<wd-tabs @change="search">
<wd-tab :title="`全部`" :name="null"></wd-tab>
<wd-tab :title="`领取后过期`" :name="0"></wd-tab>
<wd-tab :title="`定时过期`" :name="1"></wd-tab>
</wd-tabs>
</div>
</view> -->
<view class="grid p-2">
<yList height="91vh" ref="yListRef" :apiObj="discountApi.SalesFullSetRedution.List" :params="{ ...params }">
<template #default="{ list }">
<view>
<view v-for="item of list" class="goods">
<wd-card type="rectangle">
<template #title>
<view class="title">
<view>
<span class="mr-2">ID{{ item?.id }}</span>
</view>
<!-- <view @click="utils.copy(item.order_no, '已复制单号')" class="title-tip">
<span style="font-size: 24rpx;margin-left: 8px;">单号{{ item.order_no }}</span>
</view> -->
</view>
</template>
<view class="bg-gray-50 p-2 mb-2 flex justify-between" style="font-size: 22rpx;">
<view>折扣名称<text class="text-black">{{ item.name }}</text></view>
<view>满减金额<text class="text-black">{{ item.full_price || 0 }}</text></view>
<view>折扣<text class="text-black">{{ item.discount || 0 }}</text></view>
</view>
<view class="bg-gray-50 p-2 mb-2 flex justify-between" style="font-size: 22rpx;">
<view>
时间
<wd-tag type="primary">{{ utils.dateFormat(item.start_time * 1000) }}</wd-tag> - <wd-tag>{{
utils.dateFormat(item.end_time * 1000) }}</wd-tag>
</view>
</view>
<template #footer>
<!-- <view class="bg-gray-50 p-2 mb-2.5 flex justify-between" style="font-size: 22rpx;">
<view>
售后状态:
</view>
</view> -->
<view class="flex justify-between items-center">
<!-- <view class="font-bold">实付: {{ item.pay_price }} </view> -->
<view>
<wd-button :round="false" size="small"
:type="['warning', 'success', 'warning', 'success', 'info'][item.status]">
<div>{{ ["关闭", "开启", "已取消"][item.status] }}</div>
</wd-button>
</view>
<view class="flex-1 flex justify-end">
<view class="mr-2">
<wd-button @click="utils.toUrl('/mall/discount/full_set_redution/edit?id=' + item.id)"
size="small">编辑</wd-button>
</view>
<!-- <view v-if="item.apply_cancel === 1" class="mr-2">
<wd-button type="error" @click="orderApproval(item)" size="small">退款</wd-button>
</view>
<view class="mr-2">
<wd-button @click="printing(item)" size="small">小票打印</wd-button>
</view>
<view class="mr-2">
<wd-button @click="orderNotes(item)" size="small">备注</wd-button>
</view>
<view v-if="item.status == 1" class="">
<wd-button @click="shipments(item)" size="small">发货</wd-button>
</view> -->
</view>
</view>
</template>
</wd-card>
</view>
</view>
</template>
</yList>
</view>
<wd-toast />
<wd-message-box></wd-message-box>
</view>
</template>
<script setup>
import { ref, nextTick } from 'vue';
import utils from '@/utils/utils.js';
import discountApi from '@/api/mall/discount.js';
import kevyloading from "@/components/kevy-loading/kevy-loading";
import yList from "/components/yList/index.vue";
import {
onShow,
} from "@dcloudio/uni-app";
const yListRef = ref(null);
const searchType = ref('折扣名称');
const popover = ref(false);
const search = () => {
if (searchType.value == '折扣名称') {
yListRef.value?.upData({
name: params.value.keywords,
});
} else if (searchType.value == '折扣') {
yListRef.value?.upData({
discount: params.value.keywords
});
}
};
const menu = ref([
{ content: '折扣名称' },
{ content: '折扣' },
]);
const params = ref({
name: null,
price: null,
send_type: null
});
/**
* 切换搜索类型
* @param {Object} item - 切换的项
*/
function changeSearchType({ item, index }) {
searchType.value = item.content;
search(params.value.keywords)
}
/**
* @type {Ref<boolean>}
* 控制页面加载状态的 Ref
*/
const loading = ref(false);
//
onShow(() => {
search?.()
// search('')
// getcouponList();
})
</script>
<style lang="scss" scoped>
.search-type {
position: relative;
height: 30px;
line-height: 30px;
padding: 0 8px 0 16px;
font-size: 24rpx;
color: rgba(0, 0, 0, .45);
}
.search-type::after {
position: absolute;
content: '';
width: 1px;
right: 0;
top: 5px;
bottom: 5px;
background: rgba(0, 0, 0, 0.25);
}
.search-type {
:deep(.icon-arrow) {
display: inline-block;
font-size: 20px;
vertical-align: middle;
}
}
.couponBox,
.title {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
}
.couponBox {
justify-content: flex-start;
}
.title {
justify-content: space-between;
}
.title-tip {
color: rgba(0, 0, 0, 0.25);
font-size: 12px;
}
</style>

@ -1,143 +0,0 @@
<template>
<view class="content pt-2">
<kevyloading v-if="loading" type="bsm-loader" color="#618af8" transparent></kevyloading>
<view class="px-2 my-1">
<div class="relative flex flex-col rounded-xl bg-white p-4 shadow-sm">
<div class="mb-2 pointer-events-auto relative inline-flex bg-white font-medium ">
<div class="flex items-baseline text-xs px-2">
<span class="mr-2 warn-state warn-status-processing bg-emerald-400"></span>
基础功能
</div>
</div>
<view class="grid grid-cols-3 gap-3">
<div @click="utils.toUrl('/mall/cat/index')"
class="item border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;">
商品分类
</div>
<div @click="utils.toUrl('/mall/goods/index')"
class="item border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;">
商品管理
</div>
</view>
</div>
</view>
<view class="px-2 my-1">
<div class="relative flex flex-col rounded-xl bg-white p-4 shadow-sm">
<div class="mb-2 pointer-events-auto relative inline-flex bg-white font-medium ">
<div class="flex items-baseline text-xs px-2">
<span class="mr-2 warn-state warn-status-processing bg-yellow-600"></span>
订单管理
</div>
</div>
<view class="grid grid-cols-3 gap-3">
<div @click="utils.toUrl('/mall/order/index')"
class="item border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;">
普通订单
</div>
<div @click="utils.toUrl('/mall/pickUp/index')"
class="item border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;">
自提订单
</div>
<div @click="utils.toUrl('/mall/inpersonPay/index')"
class="item border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;">
当面付订单
</div>
</view>
</div>
</view>
<view class="px-2 my-1">
<div class="relative flex flex-col rounded-xl bg-white p-4 shadow-sm">
<div class="mb-2 pointer-events-auto relative inline-flex bg-white font-medium ">
<div class="flex items-baseline text-xs px-2">
<span class="mr-2 warn-state warn-status-processing bg-stone-800"></span>
折扣管理
</div>
</div>
<view class="grid grid-cols-3 gap-3">
<div @click="utils.toUrl('/mall/discount/discount/index')"
class="item border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;">
限时折扣
</div>
<div @click="utils.toUrl('/mall/discount/full_discount/index')"
class="item border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;">
梯度折扣
</div>
<div @click="utils.toUrl('/mall/discount/full_set_redution/index')"
class="item border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;">
满额立减
</div>
<!-- <div class="item border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;">
套餐优惠
</div> -->
</view>
</div>
</view>
<view class="bg-transparent h-[80px]"></view>
<view class="fixed left-2 right-2 bottom-4 z-50">
<myTabbar tab="function"></myTabbar>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue';
import utils from '@/utils/utils.js';
import index from '@/api/store/index.js';
import myTabbar from "../components/myTabbar/index.vue";
import bar from "../components/bar/bar.vue";
import kevyloading from "@/components/kevy-loading/kevy-loading";
/**
* @type {Ref<boolean>}
* 控制页面加载状态的 Ref
*/
const loading = ref(false);
/**
* 从本地存储中获取用户信息
*/
const store_info = uni.getStorageSync("store_info");
</script>
<style lang="scss" scoped>
.content {}
</style>

@ -49,7 +49,7 @@
</view> </view>
</view> </view>
<!-- <view @click="utils.toUrl('/mall/pickUp/index')" class="text-white rounded-3xl p-4 pb-0 shadow-lg overflow-hidden" <view @click="utils.toUrl('/mall/pickUp/index')" class="text-white rounded-3xl p-4 pb-0 shadow-lg overflow-hidden"
style="background-image: linear-gradient(to top, #7ea0ff 0%, #a9bdf5 100%);"> style="background-image: linear-gradient(to top, #7ea0ff 0%, #a9bdf5 100%);">
<view class="font-bold">自提订单</view> <view class="font-bold">自提订单</view>
<view class="h-0.5 w-5 mt-0.5 bg-white"></view> <view class="h-0.5 w-5 mt-0.5 bg-white"></view>
@ -72,7 +72,7 @@
<wd-icon name="gift opacity-80" class="opacity-80" size="42px"></wd-icon> <wd-icon name="gift opacity-80" class="opacity-80" size="42px"></wd-icon>
</div> </div>
</view> </view>
</view> --> </view>
<!-- <view @click="utils.toUrl('/mall/check/list')" class="text-white rounded-3xl p-4 pb-0 shadow-lg overflow-hidden" <!-- <view @click="utils.toUrl('/mall/check/list')" class="text-white rounded-3xl p-4 pb-0 shadow-lg overflow-hidden"
style="background-image: linear-gradient(to top, #7ea0ff 0%, #a9bdf5 100%);"> style="background-image: linear-gradient(to top, #7ea0ff 0%, #a9bdf5 100%);">
@ -299,6 +299,7 @@ const getOrderGood = (e) => {
// //
getOrderGood({ index: 0 }); getOrderGood({ index: 0 });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

@ -1,5 +1,5 @@
{ {
"name" : "数字化平台", "name" : "yydht",
"appid" : "__UNI__D7DC1FF", "appid" : "__UNI__D7DC1FF",
"description" : "", "description" : "",
"versionName" : "1.0.0", "versionName" : "1.0.0",

@ -21,280 +21,408 @@
"path": "index/index", "path": "index/index",
"style": { "style": {
"navigationBarTitleText": "商城首页", "navigationBarTitleText": "商城首页",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "function/index", "path": "function/index",
"style": { "style": {
"navigationBarTitleText": "应用中心", "navigationBarTitleText": "应用中心",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "goods/index", "path": "goods/index",
"style": { "style": {
"navigationBarTitleText": "商品管理", "navigationBarTitleText": "商品管理",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "goods/edit", "path": "goods/edit",
"style": { "style": {
"navigationBarTitleText": "修改商品", "navigationBarTitleText": "修改商品",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "order/index", "path": "order/index",
"style": { "style": {
"navigationBarTitleText": "订单管理", "navigationBarTitleText": "订单管理",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "coupon/index", "path": "coupon/index",
"style": { "style": {
"navigationBarTitleText": "优惠券列表", "navigationBarTitleText": "优惠券列表",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "coupon/edit", "path": "coupon/edit",
"style": { "style": {
"navigationBarTitleText": "优惠券编辑", "navigationBarTitleText": "优惠券编辑",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "coupon/userCoupon", "path": "coupon/userCoupon",
"style": { "style": {
"navigationBarTitleText": "领取记录", "navigationBarTitleText": "领取记录",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "discount/discount/index", "path": "discount/discount/index",
"style": { "style": {
"navigationBarTitleText": "限时折扣", "navigationBarTitleText": "限时折扣",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "discount/discount/edit", "path": "discount/discount/edit",
"style": { "style": {
"navigationBarTitleText": "限时折扣", "navigationBarTitleText": "限时折扣",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "discount/full_discount/index", "path": "discount/full_discount/index",
"style": { "style": {
"navigationBarTitleText": "梯度折扣", "navigationBarTitleText": "梯度折扣",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "discount/full_discount/edit", "path": "discount/full_discount/edit",
"style": { "style": {
"navigationBarTitleText": "梯度折扣", "navigationBarTitleText": "梯度折扣",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "discount/full_set_redution/index", "path": "discount/full_set_redution/index",
"style": { "style": {
"navigationBarTitleText": "满额立减", "navigationBarTitleText": "满额立减",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "discount/full_set_redution/edit", "path": "discount/full_set_redution/edit",
"style": { "style": {
"navigationBarTitleText": "满额立减", "navigationBarTitleText": "满额立减",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "recharge/index", "path": "recharge/index",
"style": { "style": {
"navigationBarTitleText": "充值管理", "navigationBarTitleText": "充值管理",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "recharge/edit", "path": "recharge/edit",
"style": { "style": {
"navigationBarTitleText": "充值方案", "navigationBarTitleText": "充值方案",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "recharge/userRecharge", "path": "recharge/userRecharge",
"style": { "style": {
"navigationBarTitleText": "充值记录", "navigationBarTitleText": "充值记录",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "recharge/setUp", "path": "recharge/setUp",
"style": { "style": {
"navigationBarTitleText": "设置", "navigationBarTitleText": "设置",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "inpersonPay/index", "path": "inpersonPay/index",
"style": { "style": {
"navigationBarTitleText": "当面付订单", "navigationBarTitleText": "当面付订单",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "afterSale/index", "path": "afterSale/index",
"style": { "style": {
"navigationBarTitleText": "订单售后", "navigationBarTitleText": "订单售后",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "afterSale/details", "path": "afterSale/details",
"style": { "style": {
"navigationBarTitleText": "订单售后", "navigationBarTitleText": "订单售后",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "setup/index", "path": "setup/index",
"style": { "style": {
"navigationBarTitleText": "设置", "navigationBarTitleText": "设置",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "cat/index", "path": "cat/index",
"style": { "style": {
"navigationBarTitleText": "分类管理", "navigationBarTitleText": "分类管理",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "cat/edit", "path": "cat/edit",
"style": { "style": {
"navigationBarTitleText": "分类编辑", "navigationBarTitleText": "分类编辑",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "shop/list", "path": "shop/list",
"style": { "style": {
"navigationBarTitleText": "门店列表", "navigationBarTitleText": "门店列表",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "shop/edit", "path": "shop/edit",
"style": { "style": {
"navigationBarTitleText": "门店编辑", "navigationBarTitleText": "门店编辑",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "shop/to", "path": "shop/to",
"style": { "style": {
"navigationBarTitleText": "门店登录", "navigationBarTitleText": "门店登录",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "user/list", "path": "user/list",
"style": { "style": {
"navigationBarTitleText": "用户列表", "navigationBarTitleText": "用户列表",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "user/memberList", "path": "user/memberList",
"style": { "style": {
"navigationBarTitleText": "用户等级", "navigationBarTitleText": "用户等级",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "user/editMember", "path": "user/editMember",
"style": { "style": {
"navigationBarTitleText": "等级编辑", "navigationBarTitleText": "等级编辑",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "user/editGoods", "path": "user/editGoods",
"style": { "style": {
"navigationBarTitleText": "折扣编辑", "navigationBarTitleText": "折扣编辑",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "user/edit", "path": "user/edit",
"style": { "style": {
"navigationBarTitleText": "用户信息", "navigationBarTitleText": "用户信息",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "user/setUp", "path": "user/setUp",
"style": { "style": {
"navigationBarTitleText": "页面配置", "navigationBarTitleText": "页面配置",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "check/list", "path": "check/list",
"style": { "style": {
"navigationBarTitleText": "核销记录", "navigationBarTitleText": "核销记录",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
} }
},
{
"path": "points/setUp",
"style": {
"navigationBarTitleText": "积分设置",
"enablePullDownRefresh": false
}
},
{
"path": "points/cat",
"style": {
"navigationBarTitleText": "商品分类",
"enablePullDownRefresh": false
}
},
{
"path": "points/catEdit",
"style": {
"navigationBarTitleText": "商品分类",
"enablePullDownRefresh": false
}
},
{
"path": "points/goods/index",
"style": {
"navigationBarTitleText": "商品管理",
"enablePullDownRefresh": false
}
},
{
"path": "points/goods/edit",
"style": {
"navigationBarTitleText": "修改商品",
"enablePullDownRefresh": false
}
},
{
"path": "points/order",
"style": {
"navigationBarTitleText": "订单管理",
"enablePullDownRefresh": false
} }
} }
] ]
@ -306,119 +434,120 @@
"path": "index/index", "path": "index/index",
"style": { "style": {
"navigationBarTitleText": "门店首页", "navigationBarTitleText": "门店首页",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
} }
},
{
"path": "function/index",
"style": {
"navigationBarTitleText": "应用中心",
"enablePullDownRefresh": false
} }
}, },
{ {
"path": "goods/index", "path": "goods/index",
"style": { "style": {
"navigationBarTitleText": "商品管理", "navigationBarTitleText": "商品管理",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "goods/edit", "path": "goods/edit",
"style": { "style": {
"navigationBarTitleText": "修改商品", "navigationBarTitleText": "修改商品",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "cat/index", "path": "cat/index",
"style": { "style": {
"navigationBarTitleText": "分类管理", "navigationBarTitleText": "分类管理",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "cat/edit", "path": "cat/edit",
"style": { "style": {
"navigationBarTitleText": "分类编辑", "navigationBarTitleText": "分类编辑",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "check/list", "path": "check/list",
"style": { "style": {
"navigationBarTitleText": "核销记录", "navigationBarTitleText": "核销记录",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "order/index", "path": "order/index",
"style": { "style": {
"navigationBarTitleText": "订单管理", "navigationBarTitleText": "订单管理",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "setup/index", "path": "setup/index",
"style": { "style": {
"navigationBarTitleText": "设置", "navigationBarTitleText": "设置",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "pickUp/index", "path": "pickUp/index",
"style": { "style": {
"navigationBarTitleText": "自提订单", "navigationBarTitleText": "自提订单",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
}
} }
}, },
{ {
"path": "inpersonPay/index", "path": "inpersonPay/index",
"style": { "style": {
"navigationBarTitleText": "当面付订单", "navigationBarTitleText": "当面付订单",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"mp-alipay": {
"transparentTitle": "always",
"titlePenetrate": "YES",
"gestureBack": "YES"
} }
},
{
"path": "discount/discount/index",
"style": {
"navigationBarTitleText": "限时折扣",
"enablePullDownRefresh": false
}
},
{
"path": "discount/discount/edit",
"style": {
"navigationBarTitleText": "限时折扣",
"enablePullDownRefresh": false
}
},
{
"path": "discount/full_discount/index",
"style": {
"navigationBarTitleText": "梯度折扣",
"enablePullDownRefresh": false
}
},
{
"path": "discount/full_discount/edit",
"style": {
"navigationBarTitleText": "梯度折扣",
"enablePullDownRefresh": false
}
},
{
"path": "discount/full_set_redution/index",
"style": {
"navigationBarTitleText": "满额立减",
"enablePullDownRefresh": false
}
},
{
"path": "discount/full_set_redution/edit",
"style": {
"navigationBarTitleText": "满额立减",
"enablePullDownRefresh": false
} }
} }
] ]

@ -1,44 +1,14 @@
<template> <template>
<view class="content flex items-center justify-center px-4"> <view class="content min-h-dvh flex items-center justify-center px-4">
<wd-form class="mb-36" ref="form" :model="model">
<div class="flex items-center justify-center mb-2 fixed top-4 left-4">
<wd-transition duration="300" :show="true" name="fade-left">
<view class="flex-1 overflow-hidden ">
<wd-img :width="34" :height="34" :src="webInfo.logo" mode="aspectFill" />
</view>
</wd-transition>
<wd-transition duration="400" :show="true" name="fade-left">
<text class="flex px-2 text-center justify-center">
{{ webInfo.name }}
</text>
</wd-transition>
</div>
<wd-form class="mb-24" ref="form" :model="model">
<view class="rounded-md overflow-hidden">
<wd-cell-group border> <wd-cell-group border>
<wd-transition duration="400" :show="true" name="fade-left"> <wd-input label="用户名" label-width="100px" prop="username" clearable v-model="model.username" placeholder="请输入用户名"
<wd-input label="用户名" label-width="100px" prop="username" clearable v-model="model.username" :rules="[{ required: true, message: '请填写用户名' }]" />
placeholder="请输入用户名" :rules="[{ required: true, message: '请填写用户名' }]" />
</wd-transition>
<wd-transition duration="450" :show="true" name="fade-left">
<wd-input label="密码" label-width="100px" prop="password" show-password clearable v-model="model.password" <wd-input label="密码" label-width="100px" prop="password" show-password clearable v-model="model.password"
placeholder="请输入密码" :rules="[{ required: true, message: '请填写密码' }]" /> placeholder="请输入密码" :rules="[{ required: true, message: '请填写密码' }]" />
</wd-transition>
</wd-cell-group> </wd-cell-group>
</view> <view class="footer mt-4">
<view class="footer mt-4 px-6">
<wd-transition duration="500" :show="true" name="fade-left">
<wd-button :loading="loading" type="primary" size="medium" @click="handleSubmit" block>登录</wd-button> <wd-button :loading="loading" type="primary" size="medium" @click="handleSubmit" block>登录</wd-button>
</wd-transition>
</view> </view>
</wd-form> </wd-form>
</view> </view>
@ -47,22 +17,10 @@
<script setup> <script setup>
import { ref } from 'vue' import { ref } from 'vue'
import user from '@/api/modules/user.js' import user from '@/api/modules/user.js'
import systemApi from '@/api/modules/system.js'
import utils from '@/utils/utils.js' import utils from '@/utils/utils.js'
import md5 from 'js-md5'; import md5 from 'js-md5';
uni.clearStorage(); // uni.clearStorage(); //
const webInfo = ref({})
const getWebInfo = () => {
systemApi.getSetting().then(res => {
webInfo.value = res.data
})
}
getWebInfo()
const model = ref({ const model = ref({
username: "", username: "",
password: "", password: "",
@ -142,7 +100,6 @@ function handleSubmit() {
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
min-height: 100vh;
} }
.logo { .logo {

@ -1,255 +1,154 @@
<template> <template>
<view class="content pt-2"> <view class="content">
<kevyloading v-if="loading" type="bsm-loader" color="#618af8" transparent></kevyloading> <kevyloading v-if="loading" type="bsm-loader" color="#618af8" transparent></kevyloading>
<wd-transition duration="320" :show="true" name="zoom-in">
<view class="px-2 my-1">
<view class="relative flex flex-col rounded-xl bg-white p-4 shadow-sm">
<view class="mb-2 pointer-events-auto relative inline-flex bg-white font-medium "> <view class="px-2 my-2">
<view class="flex items-baseline text-xs px-2"> <div class="relative flex flex-col rounded-md bg-white p-4 shadow-sm">
<div class="mb-2 pointer-events-auto relative inline-flex bg-white font-medium ">
<div class="flex items-baseline text-xs px-2">
<span class="mr-2 warn-state warn-status-processing bg-emerald-400"></span> <span class="mr-2 warn-state warn-status-processing bg-emerald-400"></span>
基础功能 基础功能
</view> </div>
</view> </div>
<view class="grid grid-cols-3 gap-3"> <view class="grid grid-cols-3 gap-3">
<view @click="utils.toUrl('/store/cat/index')" <div @click="utils.toUrl('/store/cat/index')"
class="items-center border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between" class="item border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;"> style="font-size: 0.75rem;">
商品分类 商品分类
<wd-icon name="setting1 opacity-80" class="opacity-80" size="12px"></wd-icon> </div>
</view>
<view @click="utils.toUrl('/store/goods/index')" <div @click="utils.toUrl('/store/goods/index')"
class="items-center border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between" class="item border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;"> style="font-size: 0.75rem;">
商品管理 商品管理
<wd-icon name="goods opacity-80" class="opacity-80" size="12px"></wd-icon> </div>
</view>
<view @click="utils.toUrl('/store/user/list')"
class="items-center border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;">
会员管理
<wd-icon name="user opacity-80" class="opacity-80" size="12px"></wd-icon>
</view> </view>
<view @click="utils.toUrl('/store/user/memberList')" </div>
class="items-center border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;">
会员等级
<wd-icon name="lenovo opacity-80" class="opacity-80" size="12px"></wd-icon>
</view> </view>
</view>
</view>
</view>
</wd-transition>
<wd-transition duration="340" :show="true" name="zoom-in"> <view class="px-2 my-2">
<view class="px-2 my-1"> <div class="relative flex flex-col rounded-md bg-white p-4 shadow-sm">
<view class="relative flex flex-col rounded-xl bg-white p-4 shadow-sm">
<view class="mb-2 pointer-events-auto relative inline-flex bg-white font-medium "> <div class="mb-2 pointer-events-auto relative inline-flex bg-white font-medium ">
<view class="flex items-baseline text-xs px-2"> <div class="flex items-baseline text-xs px-2">
<span class="mr-2 warn-state warn-status-processing bg-yellow-600"></span> <span class="mr-2 warn-state warn-status-processing bg-yellow-600"></span>
订单管理 订单管理
</view> </div>
</view> </div>
<view class="grid grid-cols-3 gap-3"> <view class="grid grid-cols-3 gap-3">
<view @click="utils.toUrl('/store/order/index')" <div @click="utils.toUrl('/store/order/index')"
class="items-center border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between" class="item border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;"> style="font-size: 0.75rem;">
普通订单 普通订单
<wd-icon name="cart opacity-80" class="opacity-80" size="12px"></wd-icon> </div>
</view>
<view @click="utils.toUrl('/store/afterSale/index')" <div @click="utils.toUrl('/store/afterSale/index')"
class="items-center border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between" class="item border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;"> style="font-size: 0.75rem;">
售后订单 售后订单
<wd-icon name="cart opacity-80" class="opacity-80" size="12px"></wd-icon> </div>
</view>
<view @click="utils.toUrl('/store/inpersonPay/index')" <div @click="utils.toUrl('/store/inpersonPay/index')"
class="items-center border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between" class="item border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;"> style="font-size: 0.75rem;">
当面付订单 当面付订单
<wd-icon name="cart opacity-80" class="opacity-80" size="12px"></wd-icon> </div>
</view>
</view> </view>
</div>
</view> </view>
</view>
</wd-transition>
<wd-transition duration="360" :show="true" name="zoom-in"> <view class="px-2 my-2">
<view class="px-2 my-1"> <div class="relative flex flex-col rounded-md bg-white p-4 shadow-sm">
<view class="relative flex flex-col rounded-xl bg-white p-4 shadow-sm">
<view class="mb-2 pointer-events-auto relative inline-flex bg-white font-medium "> <div class="mb-2 pointer-events-auto relative inline-flex bg-white font-medium ">
<view class="flex items-baseline text-xs px-2"> <div class="flex items-baseline text-xs px-2">
<span class="mr-2 warn-state warn-status-processing bg-stone-800"></span> <span class="mr-2 warn-state warn-status-processing bg-stone-800"></span>
折扣管理 折扣管理
</view> </div>
</view> </div>
<view class="grid grid-cols-3 gap-3"> <view class="grid grid-cols-2 gap-3">
<view @click="utils.toUrl('/store/discount/discount/index')" <div @click="utils.toUrl('/store/discount/discount/index')"
class="items-center border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between" class="item border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;"> style="font-size: 0.75rem;">
限时折扣 限时折扣
<wd-icon name="chart-bubble opacity-80" class="opacity-80" size="12px"></wd-icon> </div>
</view>
<view @click="utils.toUrl('/store/discount/full_discount/index')" <div @click="utils.toUrl('/store/discount/full_discount/index')"
class="items-center border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between" class="item border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;"> style="font-size: 0.75rem;">
梯度折扣 梯度折扣
<wd-icon name="chart-bubble opacity-80" class="opacity-80" size="12px"></wd-icon> </div>
</view>
<view @click="utils.toUrl('/store/discount/full_set_redution/index')" <div @click="utils.toUrl('/store/discount/full_set_redution/index')"
class="items-center border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between" class="item border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;"> style="font-size: 0.75rem;">
满额立减 满额立减
<wd-icon name="chart-bubble opacity-80" class="opacity-80" size="12px"></wd-icon> </div>
</view>
<!-- <view class="items-center border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between" <!-- <div class="item border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;"> style="font-size: 0.75rem;">
套餐优惠 套餐优惠
</view> --> </div> -->
</view>
</view>
</view>
</wd-transition>
<wd-transition duration="380" :show="true" name="zoom-in">
<view class="px-2 my-1">
<view class="relative flex flex-col rounded-xl bg-white p-4 shadow-sm">
<view class="mb-2 pointer-events-auto relative inline-flex bg-white font-medium ">
<view class="flex items-baseline text-xs px-2">
<span class="mr-2 warn-state warn-status-processing bg-teal-300"></span>
积分商城
</view>
</view>
<view class="grid grid-cols-2 gap-3">
<view @click="utils.toUrl('/store/points/setUp')"
class="items-center border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;">
积分设置
<wd-icon name="detection opacity-80" class="opacity-80" size="12px"></wd-icon>
</view>
<view @click="utils.toUrl('/store/points/cat')"
class="items-center border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;">
商品分类
<wd-icon name="setting1 opacity-80" class="opacity-80" size="12px"></wd-icon>
</view>
<view @click="utils.toUrl('/store/points/goods/index')"
class="items-center border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;">
商品管理
<wd-icon name="goods opacity-80" class="opacity-80" size="12px"></wd-icon>
</view> </view>
<view @click="utils.toUrl('/store/points/order')"
class="items-center border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;">
订单管理
<wd-icon name="lenovo opacity-80" class="opacity-80" size="12px"></wd-icon>
</view>
</div>
</view> </view>
</view>
</view>
</wd-transition>
<wd-transition duration="400" :show="true" name="zoom-in"> <view class="px-2 my-2">
<view class="px-2 my-1"> <div class="relative flex flex-col rounded-md bg-white p-4 shadow-sm">
<view class="relative flex flex-col rounded-xl bg-white p-4 shadow-sm">
<view class="mb-2 pointer-events-auto relative inline-flex bg-white font-medium "> <div class="mb-2 pointer-events-auto relative inline-flex bg-white font-medium ">
<view class="flex items-baseline text-xs px-2"> <div class="flex items-baseline text-xs px-2">
<span class="mr-2 warn-state warn-status-processing bg-fuchsia-950"></span> <span class="mr-2 warn-state warn-status-processing bg-violet-700"></span>
提现管理 更多功能
</view> </div>
</view> </div>
<view class="grid grid-cols-2 gap-3"> <view class="grid grid-cols-2 gap-3">
<view @click="utils.toUrl('')" <div @click="utils.toUrl('/store/coupon/index')"
class="items-center border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between" class="item border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;"> style="font-size: 0.75rem;">
提现设置 优惠券
<wd-icon name="chart-bubble opacity-80" class="opacity-80" size="12px"></wd-icon> </div>
</view>
<view @click="utils.toUrl('')" <div @click="utils.toUrl('/store/check/list')"
class="items-center border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between" class="item border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;"> style="font-size: 0.75rem;">
分销提现 核销记录
<wd-icon name="chart-bubble opacity-80" class="opacity-80" size="12px"></wd-icon> </div>
</view>
</view>
</view>
</view>
</wd-transition>
<wd-transition duration="420" :show="true" name="zoom-in">
<view class="px-2 my-1">
<view class="relative flex flex-col rounded-xl bg-white p-4 shadow-sm">
<view class="mb-2 pointer-events-auto relative inline-flex bg-white font-medium ">
<view class="flex items-baseline text-xs px-2">
<span class="mr-2 warn-state warn-status-processing bg-violet-700"></span>
更多功能
</view>
</view>
<view class="grid grid-cols-2 gap-3"> <div @click="utils.toUrl('/store/user/list')"
<view @click="utils.toUrl('/store/recharge/index')" class="item border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
class="items-center border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;"> style="font-size: 0.75rem;">
充值管理 会员管理
<wd-icon name="chart-bubble opacity-80" class="opacity-80" size="12px"></wd-icon> </div>
</view>
<view @click="utils.toUrl('/store/coupon/index')" <div @click="utils.toUrl('/store/user/memberList')"
class="items-center border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between" class="item border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;"> style="font-size: 0.75rem;">
优惠券 会员等级
<wd-icon name="chart-bubble opacity-80" class="opacity-80" size="12px"></wd-icon> </div>
</view>
<view @click="utils.toUrl('/store/check/list')"
class="items-center border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;">
核销记录
<wd-icon name="chart-bubble opacity-80" class="opacity-80" size="12px"></wd-icon>
</view> </view>
</view>
</div>
</view> </view>
</view>
</wd-transition>
<view class="bg-transparent h-[80px]"></view> <view class="bg-transparent h-[80px]"></view>

@ -1,6 +1,7 @@
<template> <template>
<view class="content pt-[44px]"> <view class="content pt-[44px]">
<kevyloading v-if="loading" type="bsm-loader" color="#618af8" transparent></kevyloading> <kevyloading v-if="loading" type="bsm-loader" color="#618af8" transparent></kevyloading>
<view class="w-full"> <view class="w-full">
<wd-navbar fixed safeAreaInsetTop> <wd-navbar fixed safeAreaInsetTop>
<template #right> <template #right>
@ -19,54 +20,7 @@
</wd-navbar> </wd-navbar>
</view> </view>
<view class="px-2 my-2 mb-3"> <view bg-color="#f7f8fa" class="w-full grid grid-cols-3 gap-3 px-3 my-4">
<view class="relative flex flex-col rounded-2xl bg-white p-4 shadow-sm">
<view class="mb-2 pointer-events-auto relative inline-flex bg-white font-medium ">
<view class="flex items-baseline text-xs px-2">
<span class="mr-2 warn-state warn-status-processing bg-red-300"></span>
猜您想用 ?
</view>
</view>
<view v-if="recommend.length" class="grid grid-cols-3 gap-3">
<view v-for="item of recommend" @click="utils.toUrl(item.url)"
class="items-center border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;">
{{ item.name }}
<wd-icon :name="item.icon" class="opacity-80" size="12px"></wd-icon>
</view>
</view>
<view v-else class="grid grid-cols-3 gap-3">
<view @click="utils.toUrl('/store/user/list')"
class="items-center border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;">
会员管理
<wd-icon name="user opacity-80" class="opacity-80" size="12px"></wd-icon>
</view>
<view @click="utils.toUrl('/store/goods/index')"
class="items-center border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;">
商品管理
<wd-icon name="goods opacity-80" class="opacity-80" size="12px"></wd-icon>
</view>
<view @click="utils.toUrl('/store/order/index')"
class="items-center border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between"
style="font-size: 0.75rem;">
订单管理
<wd-icon name="lenovo opacity-80" class="opacity-80" size="12px"></wd-icon>
</view>
</view>
</view>
</view>
<!-- <view bg-color="#f7f8fa" class="w-full grid grid-cols-3 gap-3 px-3 my-4">
<view @click="utils.toUrl('/store/user/list')" class="text-white rounded-3xl p-4 pb-0 shadow-lg overflow-hidden" <view @click="utils.toUrl('/store/user/list')" class="text-white rounded-3xl p-4 pb-0 shadow-lg overflow-hidden"
style="background-image: linear-gradient(to top, #7ea0ff 0%, #a9bdf5 100%);"> style="background-image: linear-gradient(to top, #7ea0ff 0%, #a9bdf5 100%);">
@ -92,9 +46,9 @@
</view> </view>
</view> </view>
<view @click="utils.toUrl('/store/order/index')" class="text-white rounded-3xl p-4 pb-0 shadow-lg overflow-hidden" <view @click="utils.toUrl('/store/check/list')" class="text-white rounded-3xl p-4 pb-0 shadow-lg overflow-hidden"
style="background-image: linear-gradient(to top, #7ea0ff 0%, #a9bdf5 100%);"> style="background-image: linear-gradient(to top, #7ea0ff 0%, #a9bdf5 100%);">
<view class="font-bold">订单管理</view> <view class="font-bold">核销记录</view>
<view class="h-0.5 w-5 mt-0.5 bg-white"></view> <view class="h-0.5 w-5 mt-0.5 bg-white"></view>
<view class="flex justify-end"> <view class="flex justify-end">
@ -104,7 +58,7 @@
</view> </view>
</view> </view>
</view> --> </view>
<view style="transition: 1s;" class="w-full h-full bg-white pt-2 rounded-tr-2xl rounded-tl-2xl shadow-lg oh"> <view style="transition: 1s;" class="w-full h-full bg-white pt-2 rounded-tr-2xl rounded-tl-2xl shadow-lg oh">
<view class="order mb-2"> <view class="order mb-2">
@ -193,7 +147,6 @@ import myTabbar from "../components/myTabbar/index.vue";
import bar from "../components/bar/bar.vue"; import bar from "../components/bar/bar.vue";
import kevyloading from "@/components/kevy-loading/kevy-loading"; import kevyloading from "@/components/kevy-loading/kevy-loading";
/** /**
* @type {Ref<boolean>} * @type {Ref<boolean>}
* 控制页面加载状态的 Ref * 控制页面加载状态的 Ref
@ -315,7 +268,6 @@ const getOrderGood = (e) => {
// //
getOrderGood({ index: 0 }); getOrderGood({ index: 0 });
const recommend = utils.recommendPage()
</script> </script>

@ -1,130 +0,0 @@
<template>
<view class="charts-box bg-white content">
<view v-show="classifyList.length" class="flex overflow-auto flex-wrap">
<div class="grid grid-cols-3 gap-4 p-4 w-full">
<wd-button @click="utils.toUrl('/store/cat/edit?edit=' + JSON.stringify({}))" style="width: 100%;"
class="bg-[#f0f0f0] w-full flex-1" :round="false">
新增
</wd-button>
<wd-button @click="showActions(cat)" style="width: 100%;" v-for="cat of classifyList"
class="bg-[#f0f0f0] w-full flex-1" type="info" :round="false">
{{ cat.name }}
</wd-button>
</div>
</view>
<wd-action-sheet v-model="show" :actions="actions" @close="close" @select="select" />
<kevyloading v-if="loading" type="bsm-loader" color="#618af8" transparent></kevyloading>
</view>
</template>
<script setup>
import { ref } from 'vue'
import utils from '@/utils/utils.js'
import pointsGoodsApi from '@/api/store/pointsGoods.js';
import kevyloading from "@/components/kevy-loading/kevy-loading";
/** @type {Ref<boolean>} */
const loading = ref(false);
import {
onShow,
} from "@dcloudio/uni-app";
const model = ref({})
const baseForm = ref({})
const show = ref(false)
const actions = ref([
{
name: '编辑分类'
},
{
name: '新增子项'
}
])
const opt = ref("编辑分类")
function showActions(row) {
show.value = true
model.value = row
console.log(row);
}
function close() {
show.value = false
}
function select({ item, index }) {
opt.value = item.name
if (opt.value == '编辑分类') {
// message.alert({
// title: ""
// })
baseForm.value = model.value
utils.toUrl('/store/points/catEdit?edit=' + JSON.stringify(baseForm.value))
}
if (opt.value == '新增子项') {
console.log(model.value);
if (model.value.parentIds.length == 3) {
return uni.showToast({
title: '三级分类不可新增子级',
icon: 'none'
})
} else {
baseForm.value = model.value
utils.toUrl('/store/cat/edit?edit=' + JSON.stringify({}) + "&parent=" + JSON.stringify(baseForm.value))
}
// baseForm.value = model.value
// utils.toUrl('/store/cat/edit?edit=' + JSON.stringify(baseForm.value))
}
}
const classifyList = ref([])
const getClassify = () => {
loading.value = true
function flattenCategories(categories, parentIds = []) {
let flatCategories = [];
for (const category of categories) {
const categoryWithParents = {
...category,
parentIds: [...parentIds, category.id],
};
flatCategories.push(categoryWithParents);
if (category.children && category.children.length > 0) {
flatCategories = flatCategories.concat(flattenCategories(category.children, [...parentIds, category.id]));
}
}
return flatCategories;
}
pointsGoodsApi.classifyList().then(res => {
classifyList.value = flattenCategories(res.data)
loading.value = false
})
}
onShow(() => {
getClassify()
})
</script>
<style scoped>
/* 请根据实际需求修改父元素尺寸,组件自动识别宽高 */
.charts-box {
width: 100%;
height: 300px;
}
</style>

@ -1,87 +0,0 @@
<template>
<view class="charts-box bg-white content p-2">
<view v-if="parent.id" class="p-4 mb-2 bg-slate-50">
上级分类 ({{ parent.name }})
</view>
<wd-form ref="form" :model="baseForm">
<wd-cell-group class="flex py-2 w-full" title="分类图片">
<view class="ml-3">
<yUpload v-model="baseForm.pic_url" :size="1"></yUpload>
</view>
</wd-cell-group>
<wd-form-item label-width="76px" label="分类名称" prop="address">
<wd-input v-model="baseForm.name" placeholder="请输入分类名称" clearable />
</wd-form-item>
<wd-form-item label-width="80px" label="分类排序" prop="address">
<view class="ml-3 flex">
<wd-input-number v-model="baseForm.sort" />
</view>
</wd-form-item>
<wd-form-item label-width="80px" label="状态" prop="address">
<view class="ml-3 flex">
<wd-switch v-model="baseForm.status" :active-value="1" :inactive-value="0" />
</view>
</wd-form-item>
<view class="footer m-4">
<wd-button @click="saveCat" type="primary" size="large" block>保存</wd-button>
</view>
</wd-form>
</view>
</template>
<script setup>
import { ref } from 'vue'
import pointsGoodsApi from '@/api/store/pointsGoods.js';
import yUpload from "@/components/yUpload/index.vue"
import {
onLoad,
} from "@dcloudio/uni-app";
const parent = ref({})
const baseForm = ref({})
onLoad(async (e) => {
if (e.parent) {
parent.value = JSON.parse(e.parent)
}
if (e.edit) {
baseForm.value = JSON.parse(e.edit)
}
})
const saveCat = () => {
pointsGoodsApi.ClassifySave({
parent_id: parent.value.id || baseForm.value.id || 0,
...baseForm.value
}).then(res => {
if (res.code == 0) {
uni.showToast({
title: '操作成功!',
icon: 'success'
})
uni.navigateBack()
}
})
}
</script>
<style scoped>
/* 请根据实际需求修改父元素尺寸,组件自动识别宽高 */
.charts-box {
width: 100%;
height: 300px;
}
</style>

@ -1,374 +0,0 @@
<template>
<view class="skuEdit">
<wd-table rowHeight="100" :data="Pdata.use_sku == 0
? skuDefault
: skuLibrary
" :stripe="false">
<wd-table-col prop="name" label="SKU">
<template #value="scope">
<view class="custom-class">
<span style="margin-right: 4px" v-for="(item, index) of scope.row
.attr_list" :key="index">
{{ item.name }}
</span>
</view>
</template>
</wd-table-col>
<wd-table-col prop="school" label="售价">
<template #value="scope">
<view class="px-2 pb-1 bg-white">
<wd-input placeholder="售价" v-model="scope.row.price" type="number" />
</view>
</template>
</wd-table-col>
<wd-table-col prop="major" label="原价">
<template #value="scope">
<view class="px-2 pb-1 bg-white">
<wd-input placeholder="原价" v-model="scope.row.original_price" type="number">
</wd-input>
</view>
</template>
</wd-table-col>
<wd-table-col prop="major" label="库存">
<template #value="scope">
<view class="px-2 pb-1 bg-white">
<wd-input placeholder="库存" v-model="scope.row.stock" type="number">
</wd-input>
</view>
</template>
</wd-table-col>
<wd-table-col prop="major" label="产品号">
<template #value="scope">
<view class="px-2 pb-1 bg-white">
<wd-input placeholder="产品号" v-model="scope.row.no">
</wd-input>
</view>
</template>
</wd-table-col>
<wd-table-col prop="major" label="产品图">
<template #value="scope">
<view class="overflow-hidden w-full h-full flex items-center justify-center">
<view class="px-2 pb-1 bg-white flex items-center justify-center mt-4 overflow-hidden">
<yUpload v-model="scope.row.pic_url"></yUpload>
</view>
</view>
</template>
</wd-table-col>
</wd-table>
<view v-show="Pdata.use_sku == 1" class="bg-gray-100 rounded mb-2">
<div class="p-2 bg-white w-full">
<div class="name mb-2 text-xs">规格设置</div>
<view class="flex bg-white px-3 py-1 rounded w-full">
<div class="flex-1 mr-4">
<wd-input type="text" v-model="addGroupData.name" />
</div>
<wd-button @click="addSkuGroup"></wd-button>
</view>
</div>
<div class="p-2 bg-white">
<div style="display: flex; flex-flow: column; align-items: flex-start;">
<div class="name mb-2 text-xs">规格组</div>
<div class="w-full bg-gray-100 p-2" v-for="(item, index) in skuGroup" :key="index">
<div class="flex items-center justify-between w-full bg-white p-2">
<div class="mr-3">
<wd-tag type="primary" custom-class="space" closable @close="moveGroup(index)">{{
item.name }}</wd-tag>
</div>
<div class="mr-3">
<wd-input type="text" v-model="addGouppItemData[index]" />
</div>
<wd-button type="warning" @click="addGroupItem(index)"></wd-button>
</div>
<div type="flex" style="margin: 12px 0;">
<div class="name mb-2 text-xs">规格:</div>
<view class="flex gap-2 flex-wrap">
<wd-tag custom-class="space1" closable round type="warning" class="mx-1"
v-for="(value, key) in item.groupItem" :key="key" style="margin-left: 10px"
@close="removeGroupItem(index, key)">{{ value.name
}}</wd-tag>
</view>
</div>
</div>
</div>
</div>
</view>
</view>
</template>
<script>
import yUpload from "@/components/yUpload/index.vue"
import { useToast } from '@/uni_modules/wot-design-uni'
const toast = useToast()
export default {
name: "skuEdit",
props: {
Pdata: {
type: Object,
default: () => ({})
},
},
components: {
yUpload
},
data() {
return {
// sku
skuDefault: [
{
attr_list: [{ group_name: "默认", name: "默认" }],
price: "", //
original_price: "", //
stock: "", //
pic_url: "", //
no: "", //
},
],
skuGroup: [],
addGroupData: {
name: "",
groupItem: [],
}, //
addGouppItemData: [],
skuLibrary: [], //
//
all_price: "",
all_original_price: "",
all_stock: "",
all_no: "",
// sku
}
},
created() {
this.skuDefault = this.Pdata.skuDefault.length ? this.Pdata.skuDefault : this.skuDefault
this.skuLibrary = this.Pdata.skuLibrary
this.skuGroup = this.Pdata.skuGroup
},
methods: {
successImage($event, index) {
console.log($event, index);
},
/**
* 处理规格数据
*/
setGoodsAttrItem(attrGroup, attrList, index) {
var attrList1 = [];
if (index < attrGroup.length) {
if (index === 0 || attrList.length === 0) {
if (attrGroup[index].groupItem.length > 0) {
attrGroup[index].groupItem.forEach((element) => {
element.group_name = attrGroup[index].name;
attrList1.push([element]);
});
}
} else {
if (attrGroup[index].groupItem.length > 0) {
attrList.forEach((element) => {
attrGroup[index].groupItem.forEach((element1) => {
element1.group_name = attrGroup[index].name;
attrList1.push(element.concat([element1]));
});
});
} else {
attrList1 = attrList;
}
}
++index;
return this.setGoodsAttrItem(attrGroup, attrList1, index);
} else {
return attrList;
}
},
/**
* 获取其他详细数据
*/
getAttrDataInfo(attr) {
var attrList = [];
attr.forEach((element) => {
var setAttr = {};
if (this.skuLibrary) {
this.skuLibrary.forEach((element2) => {
if (element2.attr_list.length === element.length) {
var loading = true;
if (
loading &&
this.compareAttr(element2.attr_list, element)
) {
setAttr = element2;
loading = false;
}
}
});
}
var data = {
id: setAttr && setAttr.id ? setAttr.id : 0,
attr_list: element,
price: setAttr && setAttr.price ? setAttr.price : element.reduce((price, i) => price + i.price, 0).toFixed(2),
original_price:
setAttr && setAttr.original_price
? setAttr.original_price
: element.reduce((price, i) => price + i.price, 0).toFixed(2),
stock: setAttr && setAttr.stock ? setAttr.stock : 0,
pic_url: setAttr && setAttr.pic_url ? setAttr.pic_url : "",
no: setAttr && setAttr.no ? setAttr.no : "",
};
for (const key in setAttr) {
if (key.indexOf("member") !== -1) {
data[key] = setAttr[key];
}
}
attrList.push(data);
});
return attrList;
},
compareAttr(val1, val2) {
var compareLen = 0;
val1.forEach((element1) => {
val2.forEach((element2) => {
if (element1.name === element2.name) {
compareLen++;
}
});
});
return compareLen === val1.length;
},
//
addSkuGroup() {
if (!this.addGroupData.name) {
uni.showToast({
title: '请填写规格组名称',
icon: 'none'
})
return
}
//
console.log("添加了一个规格组");
this.skuGroup.push(this.addGroupData);
console.log("skuGroup发生了变换");
//
this.addGroupData = {
name: "",
groupItem: [],
};
},
//
moveGroup(index) {
if (this.skuGroup[index].groupItem.length === 0) {
console.log("删除的组合没有规格!!!");
this.skuGroup.splice(index, 1);
return
}
this.skuGroup.splice(index, 1);
var attrList = this.setGoodsAttrItem(this.skuGroup, [], 0);
this.skuLibrary = this.getAttrDataInfo(attrList);
this.calculateCombinationPrice(this.skuLibrary);
},
//
calculateCombinationPrice(skuLibrary) {
console.log(skuLibrary);
skuLibrary.forEach((sku) => {
// SKU
let combinationPrice = 0;
// SKU
sku.attr_list.forEach((attr) => {
//
combinationPrice += attr.price;
});
// SKU
sku.price = combinationPrice.toFixed(2);
sku.original_price = combinationPrice.toFixed(2);
});
this.skuLibrary = skuLibrary
},
//
addGroupItem(index) {
const _skuGroup = this.skuGroup
if (this.skuGroup[index].groupItem.length === 0) {
console.log("新的组合出现了!!!");
//
setTimeout(() => {
// console.log(this.skuGroup);
this.calculateCombinationPrice(this.skuLibrary);
});
} else {
console.log(_skuGroup);
}
if (!this.addGouppItemData[index]) {
if (!this.addGroupData.name) {
uni.showToast({
title: '请填写规格名称',
icon: 'none'
})
return
}
return
}
this.skuGroup[index].groupItem.push({
group_name: this.skuGroup[index].name,
name: this.addGouppItemData[index],
price: 0
});
console.log(this.skuGroup);
// todo
var attrList = this.setGoodsAttrItem(this.skuGroup, [], 0);
console.log(attrList);
this.skuLibrary = this.getAttrDataInfo(attrList);
this.addGouppItemData = [];
// //
// this.calculateCombinationPrice(this.skuLibrary);
},
//
removeGroupItem(index, key) {
this.skuGroup[index].groupItem.splice(key, 1);
var attrList = this.setGoodsAttrItem(this.skuGroup, [], 0);
this.skuLibrary = this.getAttrDataInfo(attrList);
},
}
}
</script>
<style lang="scss" scoped>
:deep(.space) {
padding: 6px 10px;
}
:deep(.space1) {
padding: 6px 10px;
background: #f0883a !important;
color: white !important;
.wd-tag__close {
color: white;
}
}
</style>

@ -1,56 +0,0 @@
## 1.0.32022-02-25
- 修复 nvue 不支持的 v-show 的 bug
## 1.0.22022-02-25
- 修复 条件编译 nvue 不支持的 css 样式
## 1.0.12021-11-23
- 修复 由上个版本引发的map、v-model等属性不生效的bug
## 1.0.02021-11-19
- 优化 组件 UI并提供设计资源详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-data-picker](https://uniapp.dcloud.io/component/uniui/uni-data-picker)
## 0.4.92021-10-28
- 修复 VUE2 v-model 概率无效的 bug
## 0.4.82021-10-27
- 修复 v-model 概率无效的 bug
## 0.4.72021-10-25
- 新增 属性 spaceInfo 服务空间配置 HBuilderX 3.2.11+
- 修复 树型 uniCloud 数据类型为 int 时报错的 bug
## 0.4.62021-10-19
- 修复 非 VUE3 v-model 为 0 时无法选中的 bug
## 0.4.52021-09-26
- 新增 清除已选项的功能(通过 clearIcon 属性配置是否显示按钮),同时提供 clear 方法以供调用,二者等效
- 修复 readonly 为 true 时报错的 bug
## 0.4.42021-09-26
- 修复 上一版本造成的 map 属性失效的 bug
- 新增 ellipsis 属性,支持配置 tab 选项长度过长时是否自动省略
## 0.4.32021-09-24
- 修复 某些情况下级联未触发的 bug
## 0.4.22021-09-23
- 新增 提供 show 和 hide 方法,开发者可以通过 ref 调用
- 新增 选项内容过长自动添加省略号
## 0.4.12021-09-15
- 新增 map 属性 字段映射,将 text/value 映射到数据中的其他字段
## 0.4.02021-07-13
- 组件兼容 vue3如何创建 vue3 项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 0.3.52021-06-04
- 修复 无法加载云端数据的问题
## 0.3.42021-05-28
- 修复 v-model 无效问题
- 修复 loaddata 为空数据组时加载时间过长问题
- 修复 上个版本引出的本地数据无法选择带有 children 的 2 级节点
## 0.3.32021-05-12
- 新增 组件示例地址
## 0.3.22021-04-22
- 修复 非树形数据有 where 属性查询报错的问题
## 0.3.12021-04-15
- 修复 本地数据概率无法回显时问题
## 0.3.02021-04-07
- 新增 支持云端非树形表结构数据
- 修复 根节点 parent_field 字段等于 null 时选择界面错乱问题
## 0.2.02021-03-15
- 修复 nodeclick、popupopened、popupclosed 事件无法触发的问题
## 0.1.92021-03-09
- 修复 微信小程序某些情况下无法选择的问题
## 0.1.82021-02-05
- 优化 部分样式在 nvue 上的兼容表现
## 0.1.72021-02-05
- 调整为 uni_modules 目录规范

@ -1,45 +0,0 @@
// #ifdef H5
export default {
name: 'Keypress',
props: {
disable: {
type: Boolean,
default: false
}
},
mounted () {
const keyNames = {
esc: ['Esc', 'Escape'],
tab: 'Tab',
enter: 'Enter',
space: [' ', 'Spacebar'],
up: ['Up', 'ArrowUp'],
left: ['Left', 'ArrowLeft'],
right: ['Right', 'ArrowRight'],
down: ['Down', 'ArrowDown'],
delete: ['Backspace', 'Delete', 'Del']
}
const listener = ($event) => {
if (this.disable) {
return
}
const keyName = Object.keys(keyNames).find(key => {
const keyName = $event.key
const value = keyNames[key]
return value === keyName || (Array.isArray(value) && value.includes(keyName))
})
if (keyName) {
// 避免和其他按键事件冲突
setTimeout(() => {
this.$emit(keyName, {})
}, 0)
}
}
document.addEventListener('keyup', listener)
this.$once('hook:beforeDestroy', () => {
document.removeEventListener('keyup', listener)
})
},
render: () => {}
}
// #endif

@ -1,598 +0,0 @@
<template>
<view class="uni-data-tree">
<view class="uni-data-tree-input" @click="handleInput">
<slot :options="options" :data="inputSelected" :error="errorMessage">
<view class="input-value" :class="{ 'input-value-border': border }">
<text v-if="errorMessage" class="selected-area error-text">{{
errorMessage
}}</text>
<view v-else-if="loading && !isOpened" class="selected-area">
<uni-load-more
class="load-more"
:contentText="loadMore"
status="loading"
></uni-load-more>
</view>
<scroll-view
v-else-if="inputSelected.length"
class="selected-area"
scroll-x="true"
>
<view class="selected-list">
<view
class="selected-item"
v-for="(item, index) in inputSelected"
:key="index"
>
<text>{{ item.text }}</text
><text
v-if="index < inputSelected.length - 1"
class="input-split-line"
>{{ split }}</text
>
</view>
</view>
</scroll-view>
<text v-else class="selected-area placeholder">{{
placeholder
}}</text>
<view
v-if="clearIcon && !readonly && inputSelected.length"
class="icon-clear"
@click.stop="clear"
>
<!-- <uni-icons type="clear" color="#e1e1e1" size="14"></uni-icons> -->
<!-- <i class="iconfont icon-reeor-fill"></i> -->
</view>
<view
class="arrow-area"
v-if="(!clearIcon || !inputSelected.length) && !readonly"
>
<view class="input-arrow"></view>
</view>
</view>
</slot>
</view>
<view
class="uni-data-tree-cover"
v-if="isOpened"
@click="handleClose"
></view>
<view class="uni-data-tree-dialog" v-if="isOpened">
<view class="uni-popper__arrow"></view>
<view class="dialog-caption">
<view class="title-area">
<text class="dialog-title">{{ popupTitle }}</text>
</view>
<view class="dialog-close" @click="handleClose">
<view class="dialog-close-plus" data-id="close"></view>
<view
class="dialog-close-plus dialog-close-rotate"
data-id="close"
></view>
</view>
</view>
<data-picker-view
class="picker-view"
ref="pickerView"
v-model="dataValue"
:localdata="localdata"
:preload="preload"
:collection="collection"
:field="field"
:orderby="orderby"
:where="where"
:step-searh="stepSearh"
:self-field="selfField"
:parent-field="parentField"
:managed-mode="true"
:map="map"
:ellipsis="ellipsis"
@change="onchange"
@datachange="ondatachange"
@nodeclick="onnodeclick"
>
</data-picker-view>
</view>
</view>
</template>
<script>
import dataPicker from "../uni-data-pickerview/uni-data-picker.js";
import DataPickerView from "../uni-data-pickerview/uni-data-pickerview.vue";
/**
* DataPicker 级联选择
* @description 支持单列和多列级联选择列数没有限制如果屏幕显示不全顶部tab区域会左右滚动
* @tutorial https://ext.dcloud.net.cn/plugin?id=3796
* @property {String} popup-title 弹出窗口标题
* @property {Array} localdata 本地数据参考
* @property {Boolean} border = [true|false] 是否有边框
* @property {Boolean} readonly = [true|false] 是否仅读
* @property {Boolean} preload = [true|false] 是否预加载数据
* @value true 开启预加载数据点击弹出窗口后显示已加载数据
* @value false 关闭预加载数据点击弹出窗口后开始加载数据
* @property {Boolean} step-searh = [true|false] 是否分布查询
* @value true 启用分布查询仅查询当前选中节点
* @value false 关闭分布查询一次查询出所有数据
* @property {String|DBFieldString} self-field 分布查询当前字段名称
* @property {String|DBFieldString} parent-field 分布查询父字段名称
* @property {String|DBCollectionString} collection 表名
* @property {String|DBFieldString} field 查询字段多个字段用 `,` 分割
* @property {String} orderby 排序字段及正序倒叙设置
* @property {String|JQLString} where 查询条件
* @event {Function} popupshow 弹出的选择窗口打开时触发此事件
* @event {Function} popuphide 弹出的选择窗口关闭时触发此事件
*/
export default {
name: "UniDataPicker",
emits: [
"popupopened",
"popupclosed",
"nodeclick",
"input",
"change",
"update:modelValue",
],
mixins: [dataPicker],
components: {
DataPickerView,
},
props: {
options: {
type: [Object, Array],
default() {
return {};
},
},
popupTitle: {
type: String,
default: "请选择",
},
placeholder: {
type: String,
default: "请选择",
},
heightMobile: {
type: String,
default: "",
},
readonly: {
type: Boolean,
default: false,
},
clearIcon: {
type: Boolean,
default: true,
},
border: {
type: Boolean,
default: true,
},
split: {
type: String,
default: "/",
},
ellipsis: {
type: Boolean,
default: true,
},
},
data() {
return {
isOpened: false,
inputSelected: [],
};
},
created() {
this.form = this.getForm("uniForms");
this.formItem = this.getForm("uniFormsItem");
if (this.formItem) {
if (this.formItem.name) {
this.rename = this.formItem.name;
this.form.inputChildrens.push(this);
}
}
this.$nextTick(() => {
this.load();
});
},
methods: {
clear() {
this.inputSelected.splice(0);
this._dispatchEvent([]);
},
onPropsChange() {
this._treeData = [];
this.selectedIndex = 0;
this.load();
},
load() {
if (this.readonly) {
this._processReadonly(this.localdata, this.dataValue);
return;
}
if (this.isLocaldata) {
this.loadData();
this.inputSelected = this.selected.slice(0);
} else if (!this.parentField && !this.selfField && this.hasValue) {
this.getNodeData(() => {
this.inputSelected = this.selected.slice(0);
});
} else if (this.hasValue) {
this.getTreePath(() => {
this.inputSelected = this.selected.slice(0);
});
}
},
getForm(name = "uniForms") {
let parent = this.$parent;
let parentName = parent.$options.name;
while (parentName !== name) {
parent = parent.$parent;
if (!parent) return false;
parentName = parent.$options.name;
}
return parent;
},
show() {
this.isOpened = true;
this.$nextTick(() => {
this.$refs.pickerView.updateData({
treeData: this._treeData,
selected: this.selected,
selectedIndex: this.selectedIndex,
});
});
this.$emit("popupopened");
},
hide() {
this.isOpened = false;
this.$emit("popupclosed");
},
handleInput() {
if (this.readonly) {
return;
}
this.show();
},
handleClose(e) {
this.hide();
},
onnodeclick(e) {
this.$emit("nodeclick", e);
},
ondatachange(e) {
this._treeData = this.$refs.pickerView._treeData;
},
onchange(e) {
this.hide();
this.inputSelected = e;
this._dispatchEvent(e);
},
_processReadonly(dataList, value) {
var isTree = dataList.findIndex((item) => {
return item.children;
});
if (isTree > -1) {
let inputValue;
if (Array.isArray(value)) {
inputValue = value[value.length - 1];
if (typeof inputValue === "object" && inputValue.value) {
inputValue = inputValue.value;
}
} else {
inputValue = value;
}
this.inputSelected = this._findNodePath(inputValue, this.localdata);
return;
}
if (!this.hasValue) {
this.inputSelected = [];
return;
}
let result = [];
for (let i = 0; i < value.length; i++) {
var val = value[i];
var item = dataList.find((v) => {
return v.value == val;
});
if (item) {
result.push(item);
}
}
if (result.length) {
this.inputSelected = result;
}
},
_filterForArray(data, valueArray) {
var result = [];
for (let i = 0; i < valueArray.length; i++) {
var value = valueArray[i];
var found = data.find((item) => {
return item.value == value;
});
if (found) {
result.push(found);
}
}
return result;
},
_dispatchEvent(selected) {
let item = {};
if (selected.length) {
var value = new Array(selected.length);
for (var i = 0; i < selected.length; i++) {
value[i] = selected[i].value;
}
item = selected[selected.length - 1];
} else {
item.value = "";
}
if (this.formItem) {
this.formItem.setValue(item.value);
}
this.$emit("input", item.value);
this.$emit("update:modelValue", item.value);
this.$emit("change", {
detail: {
value: selected,
},
});
},
},
};
</script>
<style>
.uni-data-tree {
position: relative;
font-size: 14px;
}
.error-text {
color: #dd524d;
}
.input-value {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
flex-wrap: nowrap;
font-size: 14px;
line-height: 38px;
padding: 0 5px;
overflow: hidden;
/* #ifdef APP-NVUE */
height: 40px;
/* #endif */
}
.input-value-border {
border: 1px solid #e5e5e5;
border-radius: 5px;
}
.selected-area {
/* #ifndef MP-ALIPAY */
flex: 1;
/* #endif */
overflow: hidden;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
}
.load-more {
/* #ifndef APP-NVUE */
margin-right: auto;
/* #endif */
/* #ifdef APP-NVUE */
width: 40px;
/* #endif */
}
.selected-list {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
flex-wrap: nowrap;
padding: 0 5px;
}
.selected-item {
flex-direction: row;
padding: 0 1px;
/* #ifndef APP-NVUE */
white-space: nowrap;
/* #endif */
}
.placeholder {
color: grey;
}
.input-split-line {
opacity: 0.5;
}
.arrow-area {
position: relative;
width: 20px;
/* #ifndef APP-NVUE */
margin-bottom: 5px;
margin-left: auto;
display: flex;
/* #endif */
justify-content: center;
transform: rotate(-45deg);
transform-origin: center;
}
.input-arrow {
width: 7px;
height: 7px;
border-left: 1px solid #999;
border-bottom: 1px solid #999;
}
.uni-data-tree-cover {
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.4);
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
z-index: 100;
}
.uni-data-tree-dialog {
position: fixed;
left: 0;
top: 20%;
right: 0;
bottom: 0;
background-color: #ffffff;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
z-index: 102;
overflow: hidden;
/* #ifdef APP-NVUE */
width: 750rpx;
/* #endif */
}
.dialog-caption {
position: relative;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
/* border-bottom: 1px solid #f0f0f0; */
}
.title-area {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
align-items: center;
/* #ifndef APP-NVUE */
margin: auto;
/* #endif */
padding: 0 10px;
}
.dialog-title {
/* font-weight: bold; */
line-height: 44px;
}
.dialog-close {
position: absolute;
top: 0;
right: 0;
bottom: 0;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
padding: 0 15px;
}
.dialog-close-plus {
width: 16px;
height: 2px;
background-color: #666;
border-radius: 2px;
transform: rotate(45deg);
}
.dialog-close-rotate {
position: absolute;
transform: rotate(-45deg);
}
.picker-view {
flex: 1;
overflow: hidden;
}
/* #ifdef H5 */
@media all and (min-width: 768px) {
.uni-data-tree-cover {
background-color: transparent;
}
.uni-data-tree-dialog {
position: absolute;
top: 55px;
height: auto;
min-height: 400px;
max-height: 50vh;
background-color: #fff;
border: 1px solid #ebeef5;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
border-radius: 4px;
overflow: unset;
}
.dialog-caption {
display: none;
}
.icon-clear {
margin-right: 5px;
}
}
/* #endif */
/* picker 弹出层通用的指示小三角, todo扩展至上下左右方向定位 */
/* #ifndef APP-NVUE */
.uni-popper__arrow,
.uni-popper__arrow::after {
position: absolute;
display: block;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
border-width: 6px;
}
.uni-popper__arrow {
filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
top: -6px;
left: 10%;
margin-right: 3px;
border-top-width: 0;
border-bottom-color: #ebeef5;
}
.uni-popper__arrow::after {
content: " ";
top: 1px;
margin-left: -6px;
border-top-width: 0;
border-bottom-color: #fff;
}
/* #endif */
</style>

@ -1,563 +0,0 @@
export default {
props: {
localdata: {
type: [Array, Object],
default () {
return []
}
},
spaceInfo: {
type: Object,
default () {
return {}
}
},
collection: {
type: String,
default: ''
},
action: {
type: String,
default: ''
},
field: {
type: String,
default: ''
},
orderby: {
type: String,
default: ''
},
where: {
type: [String, Object],
default: ''
},
pageData: {
type: String,
default: 'add'
},
pageCurrent: {
type: Number,
default: 1
},
pageSize: {
type: Number,
default: 20
},
getcount: {
type: [Boolean, String],
default: false
},
getone: {
type: [Boolean, String],
default: false
},
gettree: {
type: [Boolean, String],
default: false
},
manual: {
type: Boolean,
default: false
},
value: {
type: [Array, String, Number],
default () {
return []
}
},
modelValue: {
type: [Array, String, Number],
default () {
return []
}
},
preload: {
type: Boolean,
default: false
},
stepSearh: {
type: Boolean,
default: true
},
selfField: {
type: String,
default: ''
},
parentField: {
type: String,
default: ''
},
multiple: {
type: Boolean,
default: false
},
map: {
type: Object,
default() {
return {
text: "text",
value: "value"
}
}
}
},
data() {
return {
loading: false,
errorMessage: '',
loadMore: {
contentdown: '',
contentrefresh: '',
contentnomore: ''
},
dataList: [],
selected: [],
selectedIndex: 0,
page: {
current: this.pageCurrent,
size: this.pageSize,
count: 0
}
}
},
computed: {
isLocaldata() {
return !this.collection.length
},
postField() {
let fields = [this.field];
if (this.parentField) {
fields.push(`${this.parentField} as parent_value`);
}
return fields.join(',');
},
dataValue() {
let isModelValue = Array.isArray(this.modelValue) ? (this.modelValue.length > 0) : (this.modelValue !== null || this.modelValue !== undefined)
return isModelValue ? this.modelValue : this.value
},
hasValue() {
if (typeof this.dataValue === 'number') {
return true
}
return (this.dataValue != null) && (this.dataValue.length > 0)
}
},
created() {
this.$watch(() => {
var al = [];
['pageCurrent',
'pageSize',
'spaceInfo',
'value',
'modelValue',
'localdata',
'collection',
'action',
'field',
'orderby',
'where',
'getont',
'getcount',
'gettree'
].forEach(key => {
al.push(this[key])
});
return al
}, (newValue, oldValue) => {
let needReset = false
for (let i = 2; i < newValue.length; i++) {
if (newValue[i] != oldValue[i]) {
needReset = true
break
}
}
if (newValue[0] != oldValue[0]) {
this.page.current = this.pageCurrent
}
this.page.size = this.pageSize
this.onPropsChange()
})
this._treeData = []
},
methods: {
onPropsChange() {
this._treeData = []
},
getCommand(options = {}) {
/* eslint-disable no-undef */
let db = uniCloud.database(this.spaceInfo)
const action = options.action || this.action
if (action) {
db = db.action(action)
}
const collection = options.collection || this.collection
db = db.collection(collection)
const where = options.where || this.where
if (!(!where || !Object.keys(where).length)) {
db = db.where(where)
}
const field = options.field || this.field
if (field) {
db = db.field(field)
}
const orderby = options.orderby || this.orderby
if (orderby) {
db = db.orderBy(orderby)
}
const current = options.pageCurrent !== undefined ? options.pageCurrent : this.page.current
const size = options.pageSize !== undefined ? options.pageSize : this.page.size
const getCount = options.getcount !== undefined ? options.getcount : this.getcount
const getTree = options.gettree !== undefined ? options.gettree : this.gettree
const getOptions = {
getCount,
getTree
}
if (options.getTreePath) {
getOptions.getTreePath = options.getTreePath
}
db = db.skip(size * (current - 1)).limit(size).get(getOptions)
return db
},
getNodeData(callback) {
if (this.loading) {
return
}
this.loading = true
this.getCommand({
field: this.postField,
where: this._pathWhere()
}).then((res) => {
this.loading = false
this.selected = res.result.data
callback && callback()
}).catch((err) => {
this.loading = false
this.errorMessage = err
})
},
getTreePath(callback) {
if (this.loading) {
return
}
this.loading = true
this.getCommand({
field: this.postField,
getTreePath: {
startWith: `${this.selfField}=='${this.dataValue}'`
}
}).then((res) => {
this.loading = false
let treePath = []
this._extractTreePath(res.result.data, treePath)
this.selected = treePath
callback && callback()
}).catch((err) => {
this.loading = false
this.errorMessage = err
})
},
loadData() {
if (this.isLocaldata) {
this._processLocalData()
return
}
if (this.dataValue != null) {
this._loadNodeData((data) => {
this._treeData = data
this._updateBindData()
this._updateSelected()
})
return
}
if (this.stepSearh) {
this._loadNodeData((data) => {
this._treeData = data
this._updateBindData()
})
} else {
this._loadAllData((data) => {
this._treeData = []
this._extractTree(data, this._treeData, null)
this._updateBindData()
})
}
},
_loadAllData(callback) {
if (this.loading) {
return
}
this.loading = true
this.getCommand({
field: this.postField,
gettree: true,
startwith: `${this.selfField}=='${this.dataValue}'`
}).then((res) => {
this.loading = false
callback(res.result.data)
this.onDataChange()
}).catch((err) => {
this.loading = false
this.errorMessage = err
})
},
_loadNodeData(callback, pw) {
if (this.loading) {
return
}
this.loading = true
this.getCommand({
field: this.postField,
where: pw || this._postWhere(),
pageSize: 500
}).then((res) => {
this.loading = false
callback(res.result.data)
this.onDataChange()
}).catch((err) => {
this.loading = false
this.errorMessage = err
})
},
_pathWhere() {
let result = []
let where_field = this._getParentNameByField();
if (where_field) {
result.push(`${where_field} == '${this.dataValue}'`)
}
if (this.where) {
return `(${this.where}) && (${result.join(' || ')})`
}
return result.join(' || ')
},
_postWhere() {
let result = []
let selected = this.selected
let parentField = this.parentField
if (parentField) {
result.push(`${parentField} == null || ${parentField} == ""`)
}
if (selected.length) {
for (var i = 0; i < selected.length - 1; i++) {
result.push(`${parentField} == '${selected[i].value}'`)
}
}
let where = []
if (this.where) {
where.push(`(${this.where})`)
}
if (result.length) {
where.push(`(${result.join(' || ')})`)
}
return where.join(' && ')
},
_nodeWhere() {
let result = []
let selected = this.selected
if (selected.length) {
result.push(`${this.parentField} == '${selected[selected.length - 1].value}'`)
}
if (this.where) {
return `(${this.where}) && (${result.join(' || ')})`
}
return result.join(' || ')
},
_getParentNameByField() {
const fields = this.field.split(',');
let where_field = null;
for (let i = 0; i < fields.length; i++) {
const items = fields[i].split('as');
if (items.length < 2) {
continue;
}
if (items[1].trim() === 'value') {
where_field = items[0].trim();
break;
}
}
return where_field
},
_isTreeView() {
return (this.parentField && this.selfField)
},
_updateSelected() {
var dl = this.dataList
var sl = this.selected
let textField = this.map.text
let valueField = this.map.value
for (var i = 0; i < sl.length; i++) {
var value = sl[i].value
var dl2 = dl[i]
for (var j = 0; j < dl2.length; j++) {
var item2 = dl2[j]
if (item2[valueField] === value) {
sl[i].text = item2[textField]
break
}
}
}
},
_updateBindData(node) {
const {
dataList,
hasNodes
} = this._filterData(this._treeData, this.selected)
let isleaf = this._stepSearh === false && !hasNodes
if (node) {
node.isleaf = isleaf
}
this.dataList = dataList
this.selectedIndex = dataList.length - 1
if (!isleaf && this.selected.length < dataList.length) {
this.selected.push({
value: null,
text: "请选择"
})
}
return {
isleaf,
hasNodes
}
},
_filterData(data, paths) {
let dataList = []
let hasNodes = true
dataList.push(data.filter((item) => {
return (item.parent_value === null || item.parent_value === undefined || item.parent_value === '')
}))
for (let i = 0; i < paths.length; i++) {
var value = paths[i].value
var nodes = data.filter((item) => {
return item.parent_value === value
})
if (nodes.length) {
dataList.push(nodes)
} else {
hasNodes = false
}
}
return {
dataList,
hasNodes
}
},
_extractTree(nodes, result, parent_value) {
let list = result || []
let valueField = this.map.value
for (let i = 0; i < nodes.length; i++) {
let node = nodes[i]
let child = {}
for (let key in node) {
if (key !== 'children') {
child[key] = node[key]
}
}
if (parent_value !== null && parent_value !== undefined && parent_value !== '') {
child.parent_value = parent_value
}
result.push(child)
let children = node.children
if (children) {
this._extractTree(children, result, node[valueField])
}
}
},
_extractTreePath(nodes, result) {
let list = result || []
for (let i = 0; i < nodes.length; i++) {
let node = nodes[i]
let child = {}
for (let key in node) {
if (key !== 'children') {
child[key] = node[key]
}
}
result.push(child)
let children = node.children
if (children) {
this._extractTreePath(children, result)
}
}
},
_findNodePath(key, nodes, path = []) {
let textField = this.map.text
let valueField = this.map.value
for (let i = 0; i < nodes.length; i++) {
let node = nodes[i]
let children = node.children
let text = node[textField]
let value = node[valueField]
path.push({
value,
text
})
if (value === key) {
return path
}
if (children) {
const p = this._findNodePath(key, children, path)
if (p.length) {
return p
}
}
path.pop()
}
return []
},
_processLocalData() {
this._treeData = []
this._extractTree(this.localdata, this._treeData)
var inputValue = this.dataValue
if (inputValue === undefined) {
return
}
if (Array.isArray(inputValue)) {
inputValue = inputValue[inputValue.length - 1]
if (typeof inputValue === 'object' && inputValue[this.map.value]) {
inputValue = inputValue[this.map.value]
}
}
this.selected = this._findNodePath(inputValue, this.localdata)
}
}
}

@ -1,364 +0,0 @@
<template>
<view class="uni-data-pickerview">
<scroll-view
class="selected-area"
scroll-x="true"
scroll-y="false"
:show-scrollbar="false"
>
<view class="selected-list">
<template v-for="(item, index) in selected">
<view
class="selected-item"
:class="{
'selected-item-active': index == selectedIndex,
'selected-item-text-overflow': ellipsis,
}"
:key="index"
v-if="item.text"
@click="handleSelect(index)"
>
<text class="">{{ item.text }}</text>
</view>
</template>
</view>
</scroll-view>
<view class="tab-c">
<template v-for="(child, i) in dataList">
<scroll-view
class="list"
:key="i"
v-if="i == selectedIndex"
:scroll-y="true"
>
<view
class="item"
:class="{ 'is-disabled': !!item.disable }"
v-for="(item, j) in child"
:key="j"
@click="handleNodeClick(item, i, j)"
>
<text class="item-text item-text-overflow">{{
item[map.text]
}}</text>
<view
class="check"
v-if="selected.length > i && item[map.value] == selected[i].value"
></view>
</view>
</scroll-view>
</template>
<view class="loading-cover" v-if="loading">
<uni-load-more
class="load-more"
:contentText="loadMore"
status="loading"
></uni-load-more>
</view>
<view class="error-message" v-if="errorMessage">
<text class="error-text">{{ errorMessage }}</text>
</view>
</view>
</view>
</template>
<script>
import dataPicker from "./uni-data-picker.js";
/**
* DataPickerview
* @description uni-data-pickerview
* @tutorial https://ext.dcloud.net.cn/plugin?id=3796
* @property {Array} localdata 本地数据参考
* @property {Boolean} step-searh = [true|false] 是否分布查询
* @value true 启用分布查询仅查询当前选中节点
* @value false 关闭分布查询一次查询出所有数据
* @property {String|DBFieldString} self-field 分布查询当前字段名称
* @property {String|DBFieldString} parent-field 分布查询父字段名称
* @property {String|DBCollectionString} collection 表名
* @property {String|DBFieldString} field 查询字段多个字段用 `,` 分割
* @property {String} orderby 排序字段及正序倒叙设置
* @property {String|JQLString} where 查询条件
*/
export default {
name: "UniDataPickerView",
emits: ["nodeclick", "change", "datachange", "update:modelValue"],
mixins: [dataPicker],
props: {
managedMode: {
type: Boolean,
default: false,
},
ellipsis: {
type: Boolean,
default: true,
},
},
data() {
return {};
},
created() {
if (this.managedMode) {
return;
}
this.$nextTick(() => {
this.load();
});
},
methods: {
onPropsChange() {
this._treeData = [];
this.selectedIndex = 0;
this.load();
},
load() {
if (this.isLocaldata) {
this.loadData();
} else if (this.dataValue.length) {
this.getTreePath((res) => {
this.loadData();
});
}
},
handleSelect(index) {
this.selectedIndex = index;
},
handleNodeClick(item, i, j) {
if (item.disable) {
return;
}
const node = this.dataList[i][j];
const text = node[this.map.text];
const value = node[this.map.value];
if (i < this.selected.length - 1) {
this.selected.splice(i, this.selected.length - i);
this.selected.push({
text,
value,
});
} else if (i === this.selected.length - 1) {
this.selected.splice(i, 1, {
text,
value,
});
}
if (node.isleaf) {
this.onSelectedChange(node, node.isleaf);
return;
}
const { isleaf, hasNodes } = this._updateBindData();
if (!this._isTreeView() && !hasNodes) {
this.onSelectedChange(node, true);
return;
}
if (this.isLocaldata && (!hasNodes || isleaf)) {
this.onSelectedChange(node, true);
return;
}
if (!isleaf && !hasNodes) {
this._loadNodeData((data) => {
if (!data.length) {
node.isleaf = true;
} else {
this._treeData.push(...data);
this._updateBindData(node);
}
this.onSelectedChange(node, node.isleaf);
}, this._nodeWhere());
return;
}
this.onSelectedChange(node, false);
},
updateData(data) {
this._treeData = data.treeData;
this.selected = data.selected;
if (!this._treeData.length) {
this.loadData();
} else {
//this.selected = data.selected
this._updateBindData();
}
},
onDataChange() {
this.$emit("datachange");
},
onSelectedChange(node, isleaf) {
if (isleaf) {
this._dispatchEvent();
}
if (node) {
this.$emit("nodeclick", node);
}
},
_dispatchEvent() {
this.$emit("change", this.selected.slice(0));
},
},
};
</script>
<style>
.uni-data-pickerview {
flex: 1;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
overflow: hidden;
height: 100%;
}
.error-text {
color: #dd524d;
}
.loading-cover {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
background-color: rgba(255, 255, 255, 0.5);
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
align-items: center;
z-index: 1001;
}
.load-more {
/* #ifndef APP-NVUE */
margin: auto;
/* #endif */
}
.error-message {
background-color: #fff;
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
padding: 15px;
opacity: 0.9;
z-index: 102;
}
/* #ifdef APP-NVUE */
.selected-area {
width: 750rpx;
}
/* #endif */
.selected-list {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
flex-wrap: nowrap;
padding: 0 5px;
border-bottom: 1px solid #f8f8f8;
}
.selected-item {
margin-left: 10rpx;
margin-right: 10rpx;
padding: 12rpx 0;
text-align: center;
/* #ifndef APP-NVUE */
white-space: nowrap;
/* #endif */
}
.selected-item-text-overflow {
width: 168px;
line-height: 50rpx;
/* fix nvue */
overflow: hidden;
/* #ifndef APP-NVUE */
width: 6em;
white-space: nowrap;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
/* #endif */
}
.selected-item-active {
border-bottom: 2px solid #007aff;
}
.selected-item-text {
color: #007aff;
}
.tab-c {
position: relative;
flex: 1;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
overflow: hidden;
}
.list {
flex: 1;
}
.item {
padding: 12px 15px;
line-height: 50rpx;
/* border-bottom: 1px solid #f0f0f0; */
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
justify-content: space-between;
text-align: left;
}
.is-disabled {
opacity: 0.5;
}
.item-text {
/* flex: 1; */
color: #333333;
}
.item-text-overflow {
width: 280px;
/* fix nvue */
overflow: hidden;
/* #ifndef APP-NVUE */
width: 20em;
white-space: nowrap;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
/* #endif */
}
.check {
margin-right: 5px;
border: 2px solid #007aff;
border-left: 0;
border-top: 0;
height: 12px;
width: 6px;
transform-origin: center;
/* #ifndef APP-NVUE */
transition: all 0.3s;
/* #endif */
transform: rotate(45deg);
}
</style>

@ -1,92 +0,0 @@
{
"id": "uni-data-picker",
"displayName": "uni-data-picker 数据驱动的picker选择器",
"version": "1.0.3",
"description": "单列、多列级联选择器,常用于省市区城市选择、公司部门选择、多级分类等场景",
"keywords": [
"uni-ui",
"uniui",
"picker",
"级联",
"省市区",
""
],
"repository": "https://github.com/dcloudio/uni-ui",
"engines": {
"HBuilderX": ""
},
"directories": {
"example": "../../temps/example_temps"
},
"dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
},
"uni_modules": {
"dependencies": [
"uni-load-more",
"uni-icons",
"uni-scss"
],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"App": {
"app-vue": "y",
"app-nvue": "y"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "y",
"百度": "y",
"字节跳动": "y",
"QQ": "y"
},
"快应用": {
"华为": "u",
"联盟": "u"
},
"Vue": {
"vue2": "y",
"vue3": "y"
}
}
}
}
}

@ -1,22 +0,0 @@
## DataPicker 级联选择
> **组件名uni-data-picker**
> 代码块: `uDataPicker`
> 关联组件:`uni-data-pickerview`、`uni-load-more`。
`<uni-data-picker>` 是一个选择类[datacom组件](https://uniapp.dcloud.net.cn/component/datacom)。
支持单列、和多列级联选择。列数没有限制如果屏幕显示不全顶部tab区域会左右滚动。
候选数据支持一次性加载完毕,也支持懒加载,比如示例图中,选择了“北京”后,动态加载北京的区县数据。
`<uni-data-picker>` 组件尤其适用于地址选择、分类选择等选择类。
`<uni-data-picker>` 支持本地数据、云端静态数据(json)uniCloud云数据库数据。
`<uni-data-picker>` 可以通过JQL直连uniCloud云数据库配套[DB Schema](https://uniapp.dcloud.net.cn/uniCloud/schema)可在schema2code中自动生成前端页面还支持服务器端校验。
在uniCloud数据表中新建表“uni-id-address”和“opendb-city-china”这2个表的schema自带foreignKey关联。在“uni-id-address”表的表结构页面使用schema2code生成前端页面会自动生成地址管理的维护页面自动从“opendb-city-china”表包含的中国所有省市区信息里选择地址。
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-data-picker)
#### 如使用过程中有任何问题或者您对uni-ui有一些好的建议欢迎加入 uni-ui 交流群871950839

@ -1,439 +0,0 @@
<template>
<view v-if="load" class="content p-2 bg-gray-100">
<wd-toast />
<wd-form ref="form" :model="model">
<wd-cell-group border>
<div class="rounded-md overflow-hidden">
<div class="bg-gray-100 ">
<div class="bg-gray-100 rounded mb-2">
<div class="bg-white flex flex-col pt-3 pl-3">
<div class="name mb-2 text-xs">缩略图</div>
<yUpload v-model="model.pic_url"></yUpload>
</div>
</div>
</div>
<div class="bg-gray-100">
<div class="bg-gray-100 rounded mb-2">
<div class="bg-white flex flex-col pt-3 pl-3">
<div class="name mb-2 text-xs">商品主图</div>
<yUpload v-model="model.pic_list" :size="4"></yUpload>
</div>
</div>
</div>
</div>
<view class="h-2 bg-gray-100"></view>
<view class=" p-3 rounded mb-2">
<div class="name mb-2 text-xs">商品名称</div>
<view class="bg-white px-3 py-1 rounded">
<wd-textarea v-model="model.name" auto-height />
</view>
</view>
<view class="h-2 bg-gray-100"></view>
<view class=" p-3 rounded mb-2">
<div class="name mb-2 text-xs">商品积分</div>
<view class="bg-white px-3 py-1 rounded">
<wd-textarea v-model="model.point" auto-height />
</view>
</view>
<view class="h-2 bg-gray-100"></view>
<view class=" p-3 rounded mb-2">
<div class="name mb-2 text-xs">商品分类</div>
<view class="bg-white px-3 py-1 rounded">
<wd-radio-group v-model="model.classify_id">
<view class="flex overflow-auto flex-wrap">
<div class="grid grid-cols-3">
<wd-radio style="width: 100%;" shape="button" v-for="cat of classifyList" :value="cat.id">
{{ cat.name }}
</wd-radio>
</div>
</view>
</wd-radio-group>
</view>
</view>
<!-- <view class="h-2 bg-gray-100"></view>
<view class="bg-gray-100 rounded mb-2">
<div class="p-2 bg-white">
<div class="name mb-2 text-xs">服务内容</div>
<view class="bg-white px-3 py-1 rounded">
<wd-input type="text" v-model="model.server_project" placeholder="例子: 正品保障,极速发货,7天退换货。多个请使用英文逗号“,”分隔" />
</view>
</div>
</view> -->
<view class="h-2 bg-gray-100"></view>
<view class=" p-3 rounded mb-2">
<div class="name mb-2 text-xs">商品重量</div>
<view class="bg-white px-3 py-2 rounded flex items-center mb-4">
<wd-input-number v-model="model.weight" />
<view class="text-xs from-neutral-300 ml-4">千克</view>
</view>
<wd-picker v-if="freightRules.length" class="w-full" :columns="freightRules" label="运费模板"
v-model="model.freight_id" />
</view>
<view class="h-2 bg-gray-100"></view>
<view class="p-3 rounded mb-2">
<div class="name mb-2 text-xs">商品状态</div>
<view class="bg-white px-3 py-2 rounded flex items-center">
<wd-switch v-model="model.status" :active-value="1" :inactive-value="0" />
</view>
</view>
<view class="h-2 bg-gray-100"></view>
<view class="p-3 rounded mb-2">
<div class="name mb-2 text-xs">规格</div>
<view class="bg-white px-3 py-2 rounded flex items-center">
<wd-radio-group shape="button" v-model="model.use_sku">
<wd-radio :value="0">单规格</wd-radio>
<wd-radio :value="1">多规格</wd-radio>
</wd-radio-group>
</view>
</view>
<view class="h-2 bg-gray-100"></view>
<skuEdit ref="skuEditRef" :skuGroup="skuGroup"
:Pdata="{ skuDefault, skuLibrary, skuGroup, use_sku: model.use_sku }">
</skuEdit>
</wd-cell-group>
<view class="footer mt-4">
<wd-button @click="saveGoods" type="primary" size="large" block>保存</wd-button>
</view>
</wd-form>
</view>
</template>
<script setup>
import { ref } from 'vue';
import { useToast, useMessage } from '@/uni_modules/wot-design-uni';
import pointsGoodsApi from '@/api/store/pointsGoods.js';
import goods from '@/api/store/goods.js';
import system from '@/api/modules/system.js';
import skuEdit from "./components/skuEdit.vue";
import yUpload from "@/components/yUpload/index.vue";
import { onLoad, onShow } from "@dcloudio/uni-app";
/**
* @typedef {import('@/api/store/goods').GoodsItem} GoodsItem
*/
/**
* @typedef {import('@/api/store/goods').FreightRule} FreightRule
*/
/**
* @typedef {Object} Sku
* @property {string} price - 商品价格
* @property {string} stock - 商品库存
* @property {string} original_price - 商品原价
*/
/**
* @typedef {Object} Model
* @property {number} id - 商品ID
* @property {Array<string>} classify_id - 商品分类组
* @property {string} name - 商品名称
* @property {string} keywords - 商品关键词
* @property {number} sort - 商品排序
* @property {number} status - 商品状态
* @property {number} freight_id - 运费规则ID
* @property {number} weight - 商品重量
* @property {string} pic_url - 商品缩略图
* @property {Array<string>} pic_list - 商品图组
* @property {string} video - 商品视频
* @property {string} detail - 图文详情
* @property {number} use_sku - 是否使用规格
* @property {Array<Sku>} sku_list - 规格信息
* @property {number} is_discount - 是否有折扣
* @property {number} discount - 折扣比例小数
* @property {number} dist_price - 分销价格
* @property {number} limit - 限购
* @property {number} is_check - 自定义核销佣金
* @property {number} check_type - 佣金类型
* @property {number} check_price - 佣金
*/
/**
* @typedef {Object} FileItem
* @property {string} pic_url - 图片URL
*/
/**
* @typedef {Object} SkuGroup
* @property {Array<Sku>} skuDefault - 默认规格
* @property {Array<Sku>} skuLibrary - 规格库
* @property {Array<Sku>} skuGroup - 规格组
*/
/**
* @typedef {Object} SkuEditRef
* @property {SkuGroup} skuGroup - 规格组
* @property {number} skuDefault - 默认规格
* @property {number} skuLibrary - 规格库
*/
/** @type {Ref<Array<FileItem>>} */
const fileList = ref([]);
/**
* @param {Object} param0
* @param {FileItem} param0.file - 要删除的文件
* @param {Function} param0.resolve - 删除文件的回调函数
* @param {number} param0.index - 文件索引
* @returns {void}
*/
const beforeRemove = ({ file, resolve, index }) => {
fileList.value.splice(index, 1);
resolve(true);
};
/** @type {Ref<Model>} */
const model = ref({
classify_id: [], //
name: "", //
keywords: "", //
sort: 1000,
status: 0, //
freight_id: 99999999, //
weight: 0, //
pic_url: "", //
pic_list: [], //
video: "", //
detail: "默认", //
use_sku: 0, // 使
sku_list: [], //
is_discount: 0, //
discount: 50, //
dist_price: 0, //
limit: 0, //
is_check: 0, //
check_type: 0, //
check_price: 0, //
});
/** @type {Ref<boolean>} */
const load = ref(false);
/** @type {Ref<SkuGroup>} */
const skuGroup = ref([]);
/** @type {Ref<Array<GoodsItem>>} */
const skuDefault = ref([]);
/** @type {Ref<Array<GoodsItem>>} */
const skuLibrary = ref([]);
/** @type {Ref<SkuEditRef>} */
const skuEditRef = ref(null);
/** @type {Ref<Array<FreightRule>>} */
const freightRules = ref([{
label: "默认",
value: "99999999"
}]);
onLoad(async (e) => {
model.value.id = e.id;
/**
* 获取运费规则
* @returns {void}
*/
const GetfreightRules = () => {
goods.freightRules().then(res => {
freightRules.value = [
...freightRules.value,
...res.data.rows.map(item => {
return {
label: item.name,
value: item.id
};
})
];
});
};
GetfreightRules();
if (e.id > 0) {
const res = await pointsGoodsApi.goodsItem({
id: e.id
});
model.value = res.data;
model.value.pic_list = res.data.pic_list.map(({ pic_url }) => pic_url);
if (!model.value.freight_id) {
model.value.freight_id = 99999999;
}
model.value.classify_id = res.data.classify_id;
if (res.data.use_sku == 0) {
skuDefault.value = res.data.goods_sku;
} else {
skuLibrary.value = res.data.goods_sku;
}
skuGroup.value = res.data.sku_group ? res.data.sku_group : [];
load.value = true;
} else {
load.value = true;
}
});
/**
* 保存商品信息
* @returns {Promise<void>}
*/
const saveGoods = async () => {
//
if (model.value.classify_id.length === 0) {
return uni.showToast({
title: '请选择商品分类!',
icon: 'none'
});
}
//
if (model.value.name.trim() === "") {
return uni.showToast({
title: '请输入商品名称!',
icon: 'none'
});
}
//
if (model.value.weight < 0) {
return uni.showToast({
title: '请输入合法的商品重量!',
icon: 'none'
});
}
//
if (String(model.value.pic_url).trim() === "") {
return uni.showToast({
title: '请上传商品缩略图!',
icon: 'none'
});
}
//
if (model.value.pic_list.length === 0) {
return uni.showToast({
title: '请上传商品图片组!',
icon: 'none'
});
}
model.value.sku_group = [];
model.value.sku_list = [];
model.value.dist_price = Number.parseInt(model.value.dist_price);
if (model.value.use_sku == 1) {
model.value.sku_group = skuEditRef.value.skuGroup;
model.value.sku_list = skuEditRef.value.skuLibrary;
} else {
model.value.sku_list = skuEditRef.value.skuDefault;
}
if (!model.value.sku_list.length) {
uni.showToast({
title: '规格不完整,请调整!',
icon: 'none'
});
}
if (!model.value.sku_list.every(item => Boolean(item.price !== "" && item.stock !== "" && item.original_price !== ""))) {
uni.showToast({
title: '规格不完整,请调整!',
icon: 'none'
});
return;
}
let freight_id = model.value.freight_id;
if (freight_id = 99999999) {
freight_id = 0;
}
const pic_list = model.value.pic_list.map(item => ({
pic_url: item
}));
const classify_id = model.value.classify_id
const res = await pointsGoodsApi.goodsEdit({ ...model.value, pic_list, freight_id, classify_id });
if (res.code == 0) {
uni.showToast({
title: '商品信息保存成功!',
icon: 'success'
});
uni.navigateBack();
}
};
/** @type {Ref<Array<Object>>} */
const classifyList = ref([]);
/**
* 获取商品分类
* @returns {void}
*/
const getClassify = () => {
/**
* 递归展平商品分类
* @param {Array<GoodsItem>} categories - 商品分类数组
* @param {Array<number>} [parentIds=[]] - 父级分类ID数组
* @returns {Array<Object>} - 展平后的商品分类数组
*/
function flattenCategories(categories, parentIds = []) {
let flatCategories = [];
for (const category of categories) {
const categoryWithParents = {
...category,
parentIds: [...parentIds, category.id],
};
flatCategories.push(categoryWithParents);
if (category.children && category.children.length > 0) {
flatCategories = flatCategories.concat(flattenCategories(category.children, [...parentIds, category.id]));
}
}
return flatCategories;
}
pointsGoodsApi.classifyList().then(res => {
classifyList.value = flattenCategories(res.data);
});
};
getClassify();
</script>
<style lang="scss"></style>

@ -1,254 +0,0 @@
<template>
<view class="content">
<view class=" bg-white sticky top-0 z-50">
<wd-search @search="search" @clear="search({ value: '' })" v-model="params.keywords" hide-cancel>
<template #prefix>
<wd-popover v-model="popover" mode="menu" :content="menu" @menuclick="changeSearchType">
<view class="search-type">
<text>{{ searchType }}</text>
<wd-icon custom-class="icon-arrow" name="fill-arrow-down"></wd-icon>
</view>
</wd-popover>
</template>
</wd-search>
<wd-drop-menu custom-class="flex w-full bg-white" v-show="classifyList.length">
<wd-drop-menu-item @change="search({ value: params.keywords })" custom-class="flex-1" v-model="classify_id"
:options="classifyList" label-key="name" value-key="id" />
</wd-drop-menu>
</view>
<div class="goodsBox p-2">
<yList height="78vh" ref="yListRef" :apiObj="pointsGoodsApi.list" :params="{ ...params, classify_id }">
<template #default="{ list }">
<div>
<div v-for="item of list" class="goods">
<wd-card type="rectangle">
<template #title>
<view class="title">
<view>库存<span class="font-bold">{{ item.stock_num || 0 }}</span></view>
<view v-if="!(item.stock_num > 0)" class="title-tip">
<wd-icon name="warning" size="14px" custom-style="vertical-align: bottom" />
商品库存不足
</view>
</view>
</template>
<view style="height: 60px;" class="content">
<image :src="item.pic_url" width="40" height="40" alt="joy"
style="border-radius: 4px; margin-right: 12px;width: 60px;height: 60px;min-width: 60px;" />
<view>
<view class="line2" style="color: rgba(0,0,0,0.85); font-size: 16px;">{{ item.name }}</view>
<view class="font-bold" style="color: rgb(255, 0, 0); font-size: 16px;">{{ item.price_min }}</view>
</view>
</view>
<template #footer>
<view>
<!-- <wd-button @click="changeS(item)" v-if="item.status == 1" size="small" plain
style="margin-right: 8px;">下架</wd-button>
<wd-button @click="changeS(item)" v-if="item.status !== 1" size="small"
style="margin-right: 8px;">上架</wd-button> -->
<wd-button style="margin-right: 8px;" @click="utils.toUrl('/store/points/goods/edit?id=' + item.id)"
size="small">编辑</wd-button>
<wd-button type="error" @click="delGoods(item)" size="small">删除</wd-button>
</view>
</template>
</wd-card>
</div>
</div>
</template>
</yList>
<view class="flex mt-2 fixed left-2 right-2 bottom-3 px-10">
<wd-button @click="utils.toUrl('/store/points/cat')" class="flex-3">分类</wd-button>
<wd-button @click="utils.toUrl('/store/points/goods/edit?id=' + 0)" class="flex-1 ml-4">发布商品</wd-button>
</view>
</div>
<wd-toast />
<wd-message-box></wd-message-box>
</view>
</template>
<script setup>
import { ref } from 'vue'
import { useToast } from '@/uni_modules/wot-design-uni'
import yList from "/components/yList/index.vue"
import pointsGoodsApi from '@/api/store/pointsGoods.js';
import utils from '@/utils/utils.js'
import { useMessage } from '@/uni_modules/wot-design-uni';
import { useApi } from "@/hooks/useApi.js"
const message = useMessage();
import {
onLoad,
onShow
} from "@dcloudio/uni-app";
const toast = useToast()
const classify_id = ref(0)
const params = ref({
keywords: "",
status: "",
})
const yListRef = ref(null)
const search = ({ value }) => {
yListRef?.value?.upData({
keywords: value,
classify_id: classify_id.value,
status: params.value.status
})
}
const searchType = ref('全部')
const popover = ref(false)
const menu = ref([
{
content: '全部'
},
{
content: '已上架'
},
{
content: '已下架'
}
])
function changeSearchType({ item, index }) {
searchType.value = item.content
if (item.content == '全部') {
params.value.status = ""
}
if (item.content == '已上架') {
params.value.status = 1
}
if (item.content == '已下架') {
params.value.status = 0
}
console.log(params.value.status);
search({
value: ""
})
}
const changeS = async (row) => {
const { fetchData } = await useApi(pointsGoodsApi.goodsEditAttribute)
fetchData({
id: row.id,
value: [1, 0][row.status],
type: "status"
}).then(res => {
if (res.code == 0) {
toast.success('操作成功')
row.status = [1, 0][row.status]
} else {
toast.error('出错了')
}
})
}
const delGoods = (row) => {
message
.confirm({
title: '删除商品',
})
.then(async (resp) => {
const { fetchData } = await useApi(pointsGoodsApi.goodsDel)
fetchData({
id: row.id,
}).then(res => {
if (res.code == 0) {
toast.success('操作成功')
search({ value: params.value.keywords })
} else {
toast.error('出错了')
}
})
})
.catch((error) => {
console.log(error);
});
}
const classifyList = ref([])
const getClassify = () => {
pointsGoodsApi.classifyList().then(res => {
classifyList.value = res.data
classifyList.value.unshift({
id: 0,
name: "全部商品"
})
})
}
getClassify()
onShow(() => {
search({ value: '' })
})
</script>
<style lang="scss" scoped>
.search-type {
position: relative;
height: 30px;
line-height: 30px;
padding: 0 8px 0 16px;
font-size: 24rpx;
color: rgba(0, 0, 0, .45);
}
.search-type::after {
position: absolute;
content: '';
width: 1px;
right: 0;
top: 5px;
bottom: 5px;
background: rgba(0, 0, 0, 0.25);
}
.search-type {
:deep(.icon-arrow) {
display: inline-block;
font-size: 20px;
vertical-align: middle;
}
}
.goodsBox {
.content,
.title {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
}
.content {
justify-content: flex-start;
}
.title {
justify-content: space-between;
}
.title-tip {
color: rgba(0, 0, 0, 0.25);
font-size: 12px;
}
}
</style>

@ -1,515 +0,0 @@
<template>
<view class="content">
<wd-message-box></wd-message-box>
<wd-message-box selector="wd-message-box-slot" use-slot>
<view>
<wd-form :model="shipmentsModel">
<wd-cell-group border>
<view class="mb-4">
<wd-radio-group v-model="shipmentsModel.send_type" shape="button" @change="change">
<wd-radio :value="1">快递发货</wd-radio>
<wd-radio :value="2">无需物流</wd-radio>
</wd-radio-group>
</view>
<view class="mb-4 overflow-hidden bg-white border-gray-100 border-solid border-[8px] p-3 rounded"
v-if="shipmentsModel.send_type == 1">
<view class="mb-2">
<wd-radio-group shape="button" v-model="shipmentsModel.delivery_company">
<view class="flex overflow-auto">
<wd-radio v-for="item of expressList" :value="item.value">{{ item.label }}</wd-radio>
</view>
</wd-radio-group>
</view>
<wd-input label-width="100px" clearable v-model="shipmentsModel.delivery_no" placeholder="快递单号">
</wd-input>
</view>
</wd-cell-group>
</wd-form>
</view>
</wd-message-box>
<view class=" bg-white sticky top-0 z-50">
<div class="flex items-center">
<view class="flex-1">
<wd-search @search="search" @clear="search({ value: '' })" v-model="params.keywords" hide-cancel>
<template #prefix>
<wd-popover v-model="popover" mode="menu" :content="menu" @menuclick="changeSearchType">
<view class="search-type">
<text>{{ searchType }}</text>
<wd-icon custom-class="icon-arrow" name="fill-arrow-down"></wd-icon>
</view>
</wd-popover>
</template>
</wd-search>
</view>
<div class="mr-2">
<wd-button @click="utils.toUrl('/store/afterSale/index')" size="small">售后订单</wd-button>
</div>
</div>
<wd-tabs @change="(e) => {
params.status = e.index;
search({ value: params.keywords })
}" v-model="params.status">
<wd-tab v-for="item in status" :key="item" :title="`${item.content}`"></wd-tab>
</wd-tabs>
</view>
<view class="goodsBox p-2">
<yList ref="yListRef" :apiObj="order.orderList" :params="{ ...params, status: params.status - 1 }">
<template #default="{ list }">
<view>
<view v-for="item of list" class="goods">
<wd-card type="rectangle">
<template #title>
<view class="title">
<view>
<span class="mr-2" v-if="item.shop">{{ item.shop.name }}</span>
<span class="mr-2" v-else></span>
<span class="font-bold">({{ status[item.status + 1].content }})</span>
</view>
<view @click="utils.copy(item.order_no, '已复制单号')" class="title-tip">
<span style="font-size: 24rpx;margin-left: 8px;">单号{{ item.order_no }}</span>
</view>
</view>
</template>
<view v-for="subItem of item.details" class="content mb-4">
<image :src="subItem.goods_pic" width="40" height="40" alt="joy"
style="border-radius: 4px; margin-right: 12px;width: 60px;height: 60px;min-width: 60px;" />
<view>
<view class="line2" style="color: rgba(0,0,0,0.85); font-size: 16px;">{{ subItem.goods_name }}</view>
<!-- <view class="font-bold" style="color: rgb(255, 0, 0); font-size: 16px;">{{ subItem.price }}
</view> -->
<view class="font-bold" style="font-size: 22rpx;">小计: {{ subItem.price }}
<text style="color: rgb(255, 0, 0); font-size: 24rpx;">({{
subItem.num }}) </text> -
<text style="color: rgb(255, 0, 0); font-size: 24rpx;">({{
subItem.points }}) 积分</text>
</view>
<div class="goods_sky" style="font-size: 22rpx;">
<span v-for="(sku, _index) of subItem.goods_sku_json" :key="_index">
{{ sku.group_name }}{{ sku.name }}</span>
</div>
</view>
</view>
<view class="bg-gray-50 p-2">
<view class="text-[12px]" v-if="item.user">
<view class="mb-1">
下单用户{{ item.user.nickname }}
<text class="font-bold">
( 会员ID{{ item.user.id }} )
</text>
<view class="bg-gray-100 my-2 p-2 relative">
<view>收货人{{ item.receiver_name }} &nbsp; 电话{{ item.receiver_phone }}</view>
<view v-if="item.delivery_address">{{ item.delivery_address }} {{
item.delivery_address_detail }}</view>
<view
@click="utils.copy(`收货人:${item.receiver_name} 电话:${item.receiver_phone} 收货地址:${item.delivery_address}`, '已复制快递信息')"
class="absolute right-2 top-2">
<wd-icon name="file-copy" size="14px"></wd-icon>
</view>
</view>
</view>
<view class="flex items-center" v-if='[0, 1, 2][item.delivery_type]'>配送方式:
<wd-tag class="ml-2" :type="['', 'success', 'primary'][item.delivery_type]">
{{ ["", "快递配送", "到店自提"][item.delivery_type] }}
</wd-tag>
<view class="ml-2" v-if="item.delivery_type == 1">
<wd-tag type="warning">
运费: {{ item.delivery_money }}
</wd-tag>
</view>
</view>
</view>
</view>
<template #footer>
<view class="bg-gray-50 p-2 flex justify-between" style="font-size: 22rpx;">
<view>应付: {{ (Number(item.total_price) + Number(item.delivery_money)).toFixed(2) }} </view>
<view>余额支付: {{ item.pay_balance }} </view>
<view v-if="((Number(item.total_price) + Number(item.delivery_money)) -
item.pay_price) > 0">优惠: {{ ((Number(item.total_price) + Number(item.delivery_money)) -
item.pay_price).toFixed(2) }} </view>
</view>
<view class="h-2 opacity-0 text-white">占位</view>
<view class="flex justify-between items-center">
<view class="font-bold">实付: {{ item.pay_price }} </view>
<view class="flex-1 flex justify-end">
<view v-if="item.apply_cancel === 1" class="mr-2">
<wd-button type="error" @click="orderApproval(item)" size="small">退款</wd-button>
</view>
<!-- <view class="mr-2">
<wd-button @click="printing(item)" size="small">小票打印</wd-button>
</view> -->
<view class="mr-2">
<wd-button @click="orderNotes(item)" size="small">备注</wd-button>
</view>
<view v-if="item.status == 1" class="">
<wd-button @click="shipments(item)" size="small">发货</wd-button>
</view>
</view>
</view>
</template>
</wd-card>
</view>
</view>
</template>
</yList>
</view>
<wd-toast />
</view>
</template>
<script setup>
import utils from '@/utils/utils.js';
import order from '@/api/store/pointsGoods.js';
import yList from "/components/yList/index.vue";
import { useMessage } from '@/uni_modules/wot-design-uni';
import { useToast } from '@/uni_modules/wot-design-uni';
import { ref, nextTick } from 'vue';
import { onLoad } from "@dcloudio/uni-app";
const message = useMessage('wd-message-box-slot');
const message1 = useMessage();
const toast = useToast();
const classify_id = ref(0);
const params = ref({
keywords: "",
status: 0,
type: 'order_no'
});
const yListRef = ref(null);
const search = ({ value }) => {
yListRef.value.upData({
keywords: value,
classify_id: classify_id.value,
status: params.value.status - 1
});
};
onLoad(({ s } = {}) => {
if (s) {
params.value.status = Number(s)
}
})
const searchType = ref('订单编号');
const popover = ref(false);
const status = ref([
{ content: '全部' },
{ content: '未付款' },
{ content: '待发货' },
{ content: '已发货' },
{ content: '已完成' },
{ content: '已取消' },
{ content: '待处理' },
{ content: '回收站' }
]);
const menu = ref([
{ content: '订单编号' },
{ content: '商品名称' },
{ content: '手机号' },
{ content: '会员昵称' },
{ content: '收货人' },
]);
/**
* 切换搜索类型
* @param {Object} item - 切换的项
*/
function changeSearchType({ item, index }) {
searchType.value = item.content;
if (item.content == '订单编号') {
params.value.type = "order_no";
}
if (item.content == '商品名称') {
params.value.type = "goods_name";
}
if (item.content == '手机号') {
params.value.type = "receiver_phone";
}
if (item.content == '会员昵称') {
params.value.type = "nickname";
}
if (item.content == '收货人') {
params.value.type = "receiver_name";
}
}
/**
* 更改状态
* @param {Object} row - 行数据
*/
const changeS = (row) => {
//
// goods.goodsEditAttribute({
// id: item.id,
// value: [1, 0][item.status],
// type: "status"
// }).then(res => {
// if (res.code == 0) {
// toast.success('')
// item.status = [1, 0][item.status]
// } else {
// showNotify({ type: 'error', message: '' })
// }
// })
};
const expressList = ref([]);
/**
* 获取物流公司列表
*/
const getExpressList = () => {
order.GetExpressList().then(res => {
expressList.value = Object.entries(res.data).reduce((express, item) => {
express.push({ label: item[1], value: item[0] });
return express;
}, []);
});
};
//
getExpressList();
const shipmentsModel = ref({
send_type: 2,
delivery_company: ""
});
/**
* 处理发货操作
* @param {Object} row - 行数据
*/
const shipments = (row) => {
message
.confirm({
title: '订单发货',
})
.then((resp) => {
if (shipmentsModel.value.send_type == 2) {
order.orderSend({
id: row.id,
send_type: "2"
});
row.status = 2;
toast.success('操作成功');
setTimeout(() => {
shipmentsModel.value = {
send_type: 2,
delivery_company: ""
};
}, 300);
}
if (shipmentsModel.value.send_type == 1) {
if (shipmentsModel.value.delivery_company && shipmentsModel.value.delivery_no) {
order.orderSend({
id: row.id,
send_type: "1",
delivery_company: shipmentsModel.value.delivery_company,
delivery_no: shipmentsModel.value.delivery_no,
});
row.status = 2;
row.success('操作成功');
setTimeout(() => {
shipmentsModel.value = {
send_type: 2,
delivery_company: ""
};
}, 300);
} else {
toast.error('发货失败,请完善选择填写');
shipments(row);
}
}
})
.catch((error) => {
console.log(error);
setTimeout(() => {
shipmentsModel.value = {
send_type: 2,
delivery_company: ""
};
}, 300);
});
};
/**
* 处理打印小票操作
* @param {Object} row - 行数据
*/
const printing = (row) => {
message1
.confirm({
title: '打印小票',
})
.then((resp) => {
order.printOrder({
id: row.id,
send_type: "2"
}).then(res => {
if (res.code == 0) {
toast.success('调用成功');
} else {
toast.error('调用失败');
}
});
})
.catch((error) => {
console.log(error);
});
};
/**
* 处理订单备注操作
* @param {Object} row - 行数据
*/
const orderNotes = (row) => {
message1
.prompt({
title: '订单备注',
})
.then((resp) => {
order.updateNotes({
id: row.id,
notes: resp.value
}).then(res => {
if (res.code == 0) {
toast.success('操作成功');
} else {
toast.error('操作失败');
}
});
})
.catch((error) => {
console.log(error);
});
};
/**
* 处理退款审批操作
* @param {Object} row - 行数据
*/
const orderApproval = (row) => {
message1
.confirm({
title: '退款审批',
confirmButtonText: "同意",
cancelButtonText: "拒绝",
})
.then((resp) => {
order.confirmCancel({
id: row.id,
apply_cancel_notes: "同意",
handle_status: 1
}).then(res => {
if (res.code == 0) {
toast.success('操作成功');
row.apply_cancel = 0;
} else {
toast.error('操作失败');
}
});
})
.catch((error) => {
if (error.action == 'cancel') {
order.confirmCancel({
id: row.id,
apply_cancel_notes: "拒绝",
handle_status: 0
}).then(res => {
if (res.code == 0) {
toast.success('操作成功');
row.apply_cancel = 0;
} else {
toast.error('操作失败');
}
});
}
});
};
</script>
<style lang="scss" scoped>
.search-type {
position: relative;
height: 30px;
line-height: 30px;
padding: 0 8px 0 16px;
font-size: 24rpx;
color: rgba(0, 0, 0, .45);
}
.search-type::after {
position: absolute;
content: '';
width: 1px;
right: 0;
top: 5px;
bottom: 5px;
background: rgba(0, 0, 0, 0.25);
}
.search-type {
:deep(.icon-arrow) {
display: inline-block;
font-size: 20px;
vertical-align: middle;
}
}
.goodsBox {
.content,
.title {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
}
.content {
justify-content: flex-start;
}
.title {
justify-content: space-between;
}
.title-tip {
color: rgba(0, 0, 0, 0.25);
font-size: 12px;
}
}
</style>

@ -1,117 +0,0 @@
<template>
<view>
<kevyloading v-if="loading" type="bsm-loader" color="#618af8" transparent></kevyloading>
<wd-form ref="formEl" :model="dataForm" label-width="100px" class="demo-dataForm" :size="formSize" status-icon>
<div class="form">
<wd-form-item :prop="dataForm.pic_url" label="背景图像">
<yUpload v-model="dataForm.pic_url" :size="1"></yUpload>
</wd-form-item>
<wd-form-item :prop="dataForm.rule" label="签到规则">
<wd-input placeholder="请输入" v-model.number="dataForm.rule"></wd-input>
<div style="color: #666;font-size: 12px;">
多条内容请使用中文逗号隔开
</div>
</wd-form-item>
<wd-form-item :prop="dataForm.integra" label="每日签到获得分数">
<wd-input placeholder="请输入" v-model.number="dataForm.integra"></wd-input>
</wd-form-item>
<wd-form-item :prop="dataForm.continuatio" label="连续签到天数">
<wd-input placeholder="请输入" v-model.number="dataForm.continuatio"></wd-input>
<div style="color: #666;font-size: 12px;">
只要满足连续签到天数中间没有断签就一直赠送奖励积分
</div>
</wd-form-item>
<wd-form-item :prop="dataForm.reward" label="连续签到奖励积分">
<wd-input placeholder="请输入" v-model.number="dataForm.reward"></wd-input>
</wd-form-item>
<wd-form-item :prop="dataForm.balance_exchange" label="开启积分兑换余额:">
<wd-switch :active-value="1" :inactive-value="0" v-model="dataForm.balance_exchange" />
<div style="color: #666;font-size: 12px;">
已废弃
</div>
</wd-form-item>
</div>
<!-- 提交按钮 -->
<view class="mt-2 px-12 py-3 bg-slate-50">
<wd-button type="primary" size="large" @click="handleSubmit" block>
保存
</wd-button>
</view>
</wd-form>
</view>
</template>
<script>
import yUpload from "@/components/yUpload/index.vue";
import uniDataPicker from "@/components/uni-data-picker/components/uni-data-picker/uni-data-picker.vue";
import kevyloading from "@/components/kevy-loading/kevy-loading";
import utils from '@/utils/utils.js'
import pointsGoodsApi from '@/api/store/pointsGoods.js';
export default {
components: {
yUpload, uniDataPicker, kevyloading
},
data() {
return {
utils,
//
dataForm: {
pic_url: '',
show_member: 0,
show_sign: 0,
show_task: 0,
show_integral: 0,
},
loading: false
};
},
onLoad(e) {
this.getStoreSetting()
},
methods: {
async getStoreSetting() {
this.loading = true;
const res = await pointsGoodsApi.PointsList();
if (res.data) {
this.dataForm = res.data
}
this.loading = false;
},
/**
* 处理表单提交
*/
async handleSubmit() {
//
const res = await pointsGoodsApi.PointsSave({
...this.dataForm
});
if (res.code == 0) {
setTimeout(() => {
uni.showToast({
title: '保存成功!',
icon: 'success'
});
}, 100);
}
this.getStoreSetting()
},
},
};
</script>
<style>
/* 在这里添加样式,根据需要自定义表单样式 */
</style>

@ -2,43 +2,41 @@
<view class="content"> <view class="content">
<kevyloading v-if="loading" type="bsm-loader" color="#618af8" transparent></kevyloading> <kevyloading v-if="loading" type="bsm-loader" color="#618af8" transparent></kevyloading>
<view class="px-2 mt-2"> <view class="justify-center sticky top-0 z-50 grid items-center py-3 w-full gap-3 grid-cols-3">
<view class="relative flex flex-col rounded-xl bg-white p-4 shadow-sm">
<view class="mb-2 pointer-events-auto relative inline-flex bg-white font-medium ">
<view class="flex items-baseline text-xs px-2">
<span class="mr-2 warn-state warn-status-processing bg-violet-700"></span>
充值管理
</view>
</view>
<view class="grid grid-cols-3 gap-3">
<view @click="utils.toUrl('/store/recharge/edit')" <view @click="utils.toUrl('/store/recharge/edit')"
class="item border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between" class="text-white rounded-r-3xl p-4 px-3 shadow-lg overflow-hidden"
style="font-size: 0.75rem;"> style="background-image: linear-gradient(to left, #b5b5b5 0%, rgb(110, 114, 125) 100%);">
添加充值方案 <view class="font-bold"> 添加充值方案 </view>
</view> </view>
<view @click="utils.toUrl('/store/recharge/userRecharge')" <view @click="utils.toUrl('/store/recharge/userRecharge')"
class="item border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between" class="text-white rounded-3xl p-4 shadow-lg overflow-hidden text-center"
style="font-size: 0.75rem;"> style="background-image: linear-gradient(to top, #b5b5b5 0%, rgb(110, 114, 125) 100%);">
充值记录 <view class="font-bold"> 充值记录 </view>
</view> </view>
<view @click="utils.toUrl('/store/recharge/setUp')" <view @click="utils.toUrl('/store/recharge/setUp')"
class="item border-2 border-solid border-gray-100 rounded bg-slate-50 p-2 flex justify-between" class="text-center text-white rounded-l-3xl p-4 shadow-lg overflow-hidden"
style="font-size: 0.75rem;"> style="background-image: linear-gradient(to top, #b5b5b5 0%, rgb(110, 114, 125) 100%);">
设置 <view class="font-bold"> 设置 </view>
</view> </view>
</view> </view>
</view> <!-- <view class="flex-1 bg-white pb-2">
</view> <div class="rounded-md overflow-hidden">
<wd-tabs @change="search">
<wd-tab :title="`全部`" :name="null"></wd-tab>
<wd-tab :title="`领取后过期`" :name="0"></wd-tab>
<wd-tab :title="`定时过期`" :name="1"></wd-tab>
</wd-tabs>
</div>
</view> -->
<view class="grid p-2"> <view class="grid p-2">
<yList height="84vh" ref="yListRef" noPageSize :apiObj="recharge.List" :params="{ ...params }"> <yList height="91vh" ref="yListRef" noPageSize :apiObj="recharge.List" :params="{ ...params }">
<template #default="{ list: rechargeList }"> <template #default="{ list: rechargeList }">
<view class="flex flex-col"> <view class="flex flex-col">
<view v-for="recharge of rechargeList" class="overflow-hidden relative"> <view v-for="recharge of rechargeList" class="overflow-hidden relative">
@ -95,7 +93,7 @@
<view class="px-4 text-nowrap h-full bg-stone-800 text-white flex items-center justify-center"> <view class="px-4 text-nowrap h-full bg-stone-800 text-white flex items-center justify-center">
<view @click="delRecharge(recharge)" style="writing-mode: vertical-rl; <view @click="utils.toUrl('/store/recharge/edit?id=' + recharge.id)" style="writing-mode: vertical-rl;
text-orientation: upright;"> text-orientation: upright;">
删除 删除
</view> </view>
@ -124,13 +122,10 @@
import { ref, nextTick } from 'vue'; import { ref, nextTick } from 'vue';
import utils from '@/utils/utils.js'; import utils from '@/utils/utils.js';
import recharge from '@/api/store/recharge.js'; import recharge from '@/api/store/recharge.js';
import yList from "/components/yList/index.vue";
import kevyloading from "@/components/kevy-loading/kevy-loading"; import kevyloading from "@/components/kevy-loading/kevy-loading";
import { useMessage } from '@/uni_modules/wot-design-uni'; import { useMessage } from '@/uni_modules/wot-design-uni';
import { useToast } from '@/uni_modules/wot-design-uni' import { useToast } from '@/uni_modules/wot-design-uni'
import { useApi } from "@/hooks/useApi.js" import yList from "/components/yList/index.vue";
const message = useMessage();
const toast = useToast()
import { import {
onShow, onShow,
@ -141,11 +136,41 @@ const yListRef = ref(null);
const searchType = ref('券名'); const searchType = ref('券名');
const popover = ref(false); const popover = ref(false);
const search = () => { const search = ({ value } = {}) => {
if (searchType.value == '券名') {
yListRef.value.upData({
name: params.value.keywords,
});
} else if (searchType.value == '券金额') {
yListRef.value.upData({
price: params.value.keywords
});
} else {
yListRef.value.upData({}); yListRef.value.upData({});
}
}; };
const params = ref({}); const menu = ref([
{ content: '券名' },
{ content: '券金额' },
]);
const params = ref({
name: null,
price: null,
send_type: null
});
/**
* 切换搜索类型
* @param {Object} item - 切换的项
*/
function changeSearchType({ item, index }) {
searchType.value = item.content;
search(params.value.keywords)
}
/** /**
* @type {Ref<boolean>} * @type {Ref<boolean>}
@ -153,29 +178,15 @@ const params = ref({});
*/ */
const loading = ref(false); const loading = ref(false);
const delRecharge = (row) => { const formatOfTime = (theTimeStamp) => {
message const date = new Date(theTimeStamp * 1000); //
.confirm({ const year = date.getFullYear();
title: '删除充值方案', const month = String(date.getMonth() + 1).padStart(2, '0');
}) const day = String(date.getDate()).padStart(2, '0');
.then(async (resp) => { const hours = String(date.getHours()).padStart(2, '0');
const { fetchData } = await useApi(recharge.del) const minutes = String(date.getMinutes()).padStart(2, '0');
fetchData({
id: row.id,
}).then(res => {
if (res.code == 0) {
toast.success('操作成功')
search()
} else {
toast.error('出错了')
}
}) return `${year}-${month}-${day} ${hours}`;
})
.catch((error) => {
console.log(error);
});
} }
// //

@ -1,3 +1,46 @@
// const tabbar = [
// "pages/index/index",
// "pages/cat/cat",
// "pages/shoppingCart/index",
// "pages/my/my",
// ];
/**
* @des 小程序版本更新管理器
*/
export function getUpdateManager() {
// #ifdef MP-WEIXIN || MP-ALIPAY
const updateManager = uni.getUpdateManager();
updateManager.onCheckForUpdate((res) => {
// 检测新版本后的回调
if (res.hasUpdate) {
uni.showModal({
content: "新版本已经准备好,是否重启应用?",
showCancel: false,
confirmText: "确定",
success: (res) => {
if (res.confirm) {
updateManager.onUpdateReady(() => {
// 新版本下载完成的回调
updateManager.applyUpdate(); // 强制当前小程序应用上新版本并重启
});
updateManager.onUpdateFailed(() => {
// 新版本下载失败的回调
// 新版本下载失败,提示用户删除后通过冷启动重新打开
uni.showModal({
content: "下载失败,请删除当前小程序后重新打开",
showCancel: false,
confirmText: "知道了",
});
});
}
},
});
}
});
// #endif
}
/** /**
* @des 获取头部高度 * @des 获取头部高度

@ -1,24 +0,0 @@
const pageList = [
{ url: '/store/cat/index', name: '商品分类', icon: 'setting1 opacity-80' },
{ url: '/store/goods/index', name: '商品管理', icon: 'goods opacity-80' },
{ url: '/store/user/list', name: '会员管理', icon: 'user opacity-80' },
{ url: '/store/user/memberList', name: '会员等级', icon: 'lenovo opacity-80' },
{ url: '/store/order/index', name: '普通订单', icon: 'cart opacity-80' },
{ url: '/store/afterSale/index', name: '售后订单', icon: 'cart opacity-80' },
{ url: '/store/inpersonPay/index', name: '当面付订单', icon: 'cart opacity-80' },
{ url: '/store/discount/discount/index', name: '限时折扣', icon: 'chart-bubble opacity-80' },
{ url: '/store/discount/full_discount/index', name: '梯度折扣', icon: 'chart-bubble opacity-80' },
{ url: '/store/discount/full_set_redution/index', name: '满额立减', icon: 'chart-bubble opacity-80' },
{ url: '/store/points/setUp', name: '积分设置', icon: 'detection opacity-80' },
{ url: '/store/points/cat', name: '商品分类', icon: 'setting1 opacity-80' },
{ url: '/store/points/goods/index', name: '商品管理', icon: 'goods opacity-80' },
{ url: '/store/points/order', name: '订单管理', icon: 'lenovo opacity-80' },
{ url: '', name: '提现设置', icon: 'chart-bubble opacity-80' },
{ url: '', name: '分销提现', icon: 'chart-bubble opacity-80' },
{ url: '/store/recharge/index', name: '充值管理', icon: 'chart-bubble opacity-80' },
{ url: '/store/coupon/index', name: '优惠券', icon: 'chart-bubble opacity-80' },
{ url: '/store/check/list', name: '核销记录', icon: 'chart-bubble opacity-80' }
// Add more entries if needed
];
export default pageList

@ -0,0 +1,48 @@
/**
* @des 支付方法
*/
export function paymentMethod(type) {
switch (type) {
case "1":
console.log("支付宝");
break;
case "2":
console.log("微信");
break;
case "3":
console.log("余额");
break;
case "4":
console.log("货到付款");
break;
}
}
/**
* @des 订单类型
*/
export function getOrderType(type) {
const obj = {
1: "商城订单",
2: "秒杀订单",
3: "拼团订单",
};
return obj[type];
}
/**
* @des 支付类型
*/
export function getPayType(type) {
const obj = {
1: "支付宝",
2: "微信",
3: "余额",
3: "货到付款",
};
return obj[type];
}

@ -0,0 +1,8 @@
export function regMobile(mobile) {
let re = /^1[2,3,4,5,6,7,8,9][0-9]{9}$/,
result = re.test(mobile);
if (!result) {
return false;
}
return true;
}

@ -1,19 +1,28 @@
import { isGetLocation } from "./location.js"; import { isGetLocation } from "./location.js";
import pageList from "./pageList.js";
const tabBarList = [
"/pages/index/index",
"/pages/cat/cat",
"/pages/shoppingCart/index",
"/pages/my/my",
];
export default { export default {
// 跳转页面 // 跳转页面
toUrl(url, type) { toUrl(url, type) {
console.log(url); console.log(url);
if (!url) { if (
uni.showToast({ tabBarList.some((item) => url.indexOf(item) !== -1) &&
title: `开发中 ···`, type != "reLaunch"
icon: 'none' ) {
}) uni.switchTab({
url: url,
});
return;
} }
try {
if (type == "redirectTo") { if (type == "redirectTo") {
uni.redirectTo({ uni.redirectTo({
url, url,
@ -27,49 +36,6 @@ export default {
url, url,
}); });
} }
} catch (error) {
console.log(error);
}
const isPage = pageList.find(item => item.url === url);
if (isPage) {
const countUrl = uni.getStorageSync("countUrl") || {};
// 增加当前页面的触发次数
countUrl[url] = (countUrl[url] || 0) + 1;
// 将更新后的 countUrl 对象保存到存储中
uni.setStorageSync("countUrl", countUrl);
// 现在你可以通过 countUrl[url] 访问每个页面的触发次数
}
},
recommendPage() {
try {
const countUrl = uni.getStorageSync("countUrl") || {};
const sortedPages = Object.keys(countUrl).sort((a, b) => countUrl[b] - countUrl[a]);
// 取出前 6 条数据
const topPages = sortedPages.slice(0, 6);
// 从 pageList 中找到对应的页面信息
const topPageInfo = topPages.map(url => {
const page = pageList.find(item => item.url === url);
return {
url: page.url,
name: page.name,
icon: page.icon,
triggerCount: countUrl[url]
};
});
return topPageInfo || []
} catch (error) {
return []
}
}, },
// 后退页面 // 后退页面

Loading…
Cancel
Save