feat(产品类别)
This commit is contained in:
parent
8f339a1ecc
commit
b577f0730c
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"prompt": "template"
|
||||
}
|
Binary file not shown.
118
manifest.json
118
manifest.json
|
@ -1,31 +1,34 @@
|
|||
{
|
||||
"name": "mall-app-t",
|
||||
"appid": "__UNI__B201544",
|
||||
"description": "",
|
||||
"versionName": "1.0.0",
|
||||
"versionCode": "100",
|
||||
"transformPx": false,
|
||||
"name" : "豫京牛商家端",
|
||||
"appid" : "__UNI__B201544",
|
||||
"description" : "",
|
||||
"versionName" : "1.0.0",
|
||||
"versionCode" : "100",
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus": {
|
||||
"usingComponents": true,
|
||||
"nvueStyleCompiler": "uni-app",
|
||||
"compilerVersion": 3,
|
||||
"splashscreen": {
|
||||
"alwaysShowBeforeRender": true,
|
||||
"waiting": true,
|
||||
"autoclose": true,
|
||||
"delay": 0
|
||||
"app-plus" : {
|
||||
"usingComponents" : true,
|
||||
"nvueStyleCompiler" : "uni-app",
|
||||
"compilerVersion" : 3,
|
||||
"splashscreen" : {
|
||||
"alwaysShowBeforeRender" : true,
|
||||
"waiting" : true,
|
||||
"autoclose" : true,
|
||||
"delay" : 0
|
||||
},
|
||||
"compatible": {
|
||||
"ignoreVersion": true
|
||||
"compatible" : {
|
||||
"ignoreVersion" : true
|
||||
},
|
||||
/* 模块配置 */
|
||||
"modules": {},
|
||||
"modules" : {
|
||||
"Barcode" : {},
|
||||
"Camera" : {}
|
||||
},
|
||||
/* 应用发布信息 */
|
||||
"distribute": {
|
||||
"distribute" : {
|
||||
/* android打包配置 */
|
||||
"android": {
|
||||
"permissions": [
|
||||
"android" : {
|
||||
"permissions" : [
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||
|
@ -44,32 +47,71 @@
|
|||
]
|
||||
},
|
||||
/* ios打包配置 */
|
||||
"ios": {},
|
||||
"ios" : {
|
||||
"dSYMs" : false
|
||||
},
|
||||
/* SDK配置 */
|
||||
"sdkConfigs": {}
|
||||
"sdkConfigs" : {
|
||||
"ad" : {}
|
||||
},
|
||||
"icons" : {
|
||||
"android" : {
|
||||
"hdpi" : "unpackage/res/icons/72x72.png",
|
||||
"xhdpi" : "unpackage/res/icons/96x96.png",
|
||||
"xxhdpi" : "unpackage/res/icons/144x144.png",
|
||||
"xxxhdpi" : "unpackage/res/icons/192x192.png"
|
||||
},
|
||||
"ios" : {
|
||||
"appstore" : "unpackage/res/icons/1024x1024.png",
|
||||
"ipad" : {
|
||||
"app" : "unpackage/res/icons/76x76.png",
|
||||
"app@2x" : "unpackage/res/icons/152x152.png",
|
||||
"notification" : "unpackage/res/icons/20x20.png",
|
||||
"notification@2x" : "unpackage/res/icons/40x40.png",
|
||||
"proapp@2x" : "unpackage/res/icons/167x167.png",
|
||||
"settings" : "unpackage/res/icons/29x29.png",
|
||||
"settings@2x" : "unpackage/res/icons/58x58.png",
|
||||
"spotlight" : "unpackage/res/icons/40x40.png",
|
||||
"spotlight@2x" : "unpackage/res/icons/80x80.png"
|
||||
},
|
||||
"iphone" : {
|
||||
"app@2x" : "unpackage/res/icons/120x120.png",
|
||||
"app@3x" : "unpackage/res/icons/180x180.png",
|
||||
"notification@2x" : "unpackage/res/icons/40x40.png",
|
||||
"notification@3x" : "unpackage/res/icons/60x60.png",
|
||||
"settings@2x" : "unpackage/res/icons/58x58.png",
|
||||
"settings@3x" : "unpackage/res/icons/87x87.png",
|
||||
"spotlight@2x" : "unpackage/res/icons/80x80.png",
|
||||
"spotlight@3x" : "unpackage/res/icons/120x120.png"
|
||||
}
|
||||
}
|
||||
},
|
||||
"splashscreen" : {
|
||||
"useOriginalMsgbox" : true
|
||||
}
|
||||
}
|
||||
},
|
||||
/* 快应用特有相关 */
|
||||
"quickapp": {},
|
||||
"quickapp" : {},
|
||||
/* 小程序特有相关 */
|
||||
"mp-weixin": {
|
||||
"appid": "wx64387dc8bba916ec",
|
||||
"setting": {
|
||||
"urlCheck": false
|
||||
"mp-weixin" : {
|
||||
"appid" : "wx64387dc8bba916ec",
|
||||
"setting" : {
|
||||
"urlCheck" : false
|
||||
},
|
||||
"usingComponents": true
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-alipay": {
|
||||
"usingComponents": true
|
||||
"mp-alipay" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-baidu": {
|
||||
"usingComponents": true
|
||||
"mp-baidu" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-toutiao": {
|
||||
"usingComponents": true
|
||||
"mp-toutiao" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"uniStatistics": {
|
||||
"enable": false
|
||||
"uniStatistics" : {
|
||||
"enable" : false
|
||||
},
|
||||
"vueVersion": "3"
|
||||
"vueVersion" : "3"
|
||||
}
|
||||
|
|
435
pages.json
435
pages.json
|
@ -1,225 +1,222 @@
|
|||
{
|
||||
"easycom": {
|
||||
"autoscan": true,
|
||||
"custom": {
|
||||
"^p-(.*)": "@/peach/components/p-$1/p-$1.vue",
|
||||
"^pb-(.*)": "@/peach/ui/pb-$1/pb-$1.vue"
|
||||
}
|
||||
"easycom": {
|
||||
"autoscan": true,
|
||||
"custom": {
|
||||
"^p-(.*)": "@/peach/components/p-$1/p-$1.vue",
|
||||
"^pb-(.*)": "@/peach/ui/pb-$1/pb-$1.vue"
|
||||
}
|
||||
},
|
||||
"pages": [
|
||||
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
||||
{
|
||||
"path": "pages/index/redirect"
|
||||
},
|
||||
"pages": [
|
||||
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
||||
{
|
||||
"path": "pages/index/redirect"
|
||||
},
|
||||
{
|
||||
"path": "pages/index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "首页"
|
||||
},
|
||||
"meta": {
|
||||
"auth": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/order",
|
||||
"style": {
|
||||
"navigationBarTitleText": "订单",
|
||||
"enablePullDownRefresh": true
|
||||
},
|
||||
"meta": {
|
||||
"auth": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/product",
|
||||
"style": {
|
||||
"navigationBarTitleText": "产品",
|
||||
"enablePullDownRefresh": true
|
||||
},
|
||||
{
|
||||
"path": "pages/index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "首页"
|
||||
},
|
||||
"meta": {
|
||||
"auth": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/order",
|
||||
"style": {
|
||||
"navigationBarTitleText": "订单",
|
||||
"enablePullDownRefresh": true
|
||||
},
|
||||
"meta": {
|
||||
"auth": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/product",
|
||||
"style": {
|
||||
"navigationBarTitleText": "产品",
|
||||
"enablePullDownRefresh": true
|
||||
},
|
||||
|
||||
"meta": {
|
||||
"auth": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/my",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的"
|
||||
},
|
||||
"meta": {
|
||||
"auth": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/icons",
|
||||
"style": {
|
||||
"navigationBarTitleText": "ICONS"
|
||||
},
|
||||
"meta": {
|
||||
"auth": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/login",
|
||||
"style": {
|
||||
"navigationBarTitleText": "登录"
|
||||
},
|
||||
"meta": {
|
||||
"auth": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"subPackages": [
|
||||
{
|
||||
"root": "pages/public",
|
||||
"pages": [
|
||||
{
|
||||
"path": "error",
|
||||
"style": {
|
||||
"navigationBarTitleText": "错误页面"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "setting",
|
||||
"style": {
|
||||
"navigationBarTitleText": "系统设置"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "richtext",
|
||||
"style": {
|
||||
"navigationBarTitleText": "富文本"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "faq",
|
||||
"style": {
|
||||
"navigationBarTitleText": "常见问题"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "webview",
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pages/user",
|
||||
"pages": [
|
||||
{
|
||||
"path": "wallet/money",
|
||||
"style": {
|
||||
"navigationBarTitleText": "余额"
|
||||
},
|
||||
"meta": {
|
||||
"auth": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "wallet/withdraw",
|
||||
"style": {
|
||||
"navigationBarTitleText": "提现"
|
||||
},
|
||||
"meta": {
|
||||
"auth": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "point/buy",
|
||||
"style": {
|
||||
"navigationBarTitleText": "购买积分"
|
||||
},
|
||||
"meta": {
|
||||
"auth": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "point/share",
|
||||
"style": {
|
||||
"navigationBarTitleText": "分发积分"
|
||||
},
|
||||
"meta": {
|
||||
"auth": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "point/loglist",
|
||||
"style": {
|
||||
"navigationBarTitleText": "历史积分",
|
||||
"enablePullDownRefresh": true
|
||||
},
|
||||
"meta": {
|
||||
"auth": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pages/product",
|
||||
"pages": [
|
||||
{
|
||||
"path": "manageGoods",
|
||||
"style": {
|
||||
"navigationBarTitleText": "商品管理"
|
||||
},
|
||||
"meta": {
|
||||
"auth": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "sku",
|
||||
"style": {
|
||||
"navigationBarTitleText": "商品属性"
|
||||
},
|
||||
"meta": {
|
||||
"auth": false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pages/order",
|
||||
"pages": [
|
||||
{
|
||||
"path": "detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "订单详情"
|
||||
},
|
||||
"meta": {
|
||||
"auth": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"tabBar": {
|
||||
"list": [
|
||||
{
|
||||
"pagePath": "pages/index/index"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/index/product"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/index/order"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/index/my"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/index/icons"
|
||||
}
|
||||
]
|
||||
"meta": {
|
||||
"auth": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/my",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的"
|
||||
},
|
||||
"meta": {
|
||||
"auth": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/icons",
|
||||
"style": {
|
||||
"navigationBarTitleText": "ICONS"
|
||||
},
|
||||
"meta": {
|
||||
"auth": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/login",
|
||||
"style": {
|
||||
"navigationBarTitleText": "登录"
|
||||
},
|
||||
"meta": {
|
||||
"auth": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"subPackages": [
|
||||
{
|
||||
"root": "pages/public",
|
||||
"pages": [
|
||||
{
|
||||
"path": "error",
|
||||
"style": {
|
||||
"navigationBarTitleText": "错误页面"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "setting",
|
||||
"style": {
|
||||
"navigationBarTitleText": "系统设置"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "richtext",
|
||||
"style": {
|
||||
"navigationBarTitleText": "富文本"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "faq",
|
||||
"style": {
|
||||
"navigationBarTitleText": "常见问题"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "webview",
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pages/user",
|
||||
"pages": [
|
||||
{
|
||||
"path": "wallet/money",
|
||||
"style": {
|
||||
"navigationBarTitleText": "余额"
|
||||
},
|
||||
"meta": {
|
||||
"auth": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "wallet/withdraw",
|
||||
"style": {
|
||||
"navigationBarTitleText": "提现"
|
||||
},
|
||||
"meta": {
|
||||
"auth": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "point/buy",
|
||||
"style": {
|
||||
"navigationBarTitleText": "购买积分"
|
||||
},
|
||||
"meta": {
|
||||
"auth": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "point/share",
|
||||
"style": {
|
||||
"navigationBarTitleText": "分发积分"
|
||||
},
|
||||
"meta": {
|
||||
"auth": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "point/loglist",
|
||||
"style": {
|
||||
"navigationBarTitleText": "历史积分",
|
||||
"enablePullDownRefresh": true
|
||||
},
|
||||
"meta": {
|
||||
"auth": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pages/product",
|
||||
"pages": [
|
||||
{
|
||||
"path": "manageGoods",
|
||||
"style": {
|
||||
"navigationBarTitleText": "商品管理"
|
||||
},
|
||||
"meta": {
|
||||
"auth": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "sku",
|
||||
"style": {
|
||||
"navigationBarTitleText": "商品属性"
|
||||
},
|
||||
"meta": {
|
||||
"auth": false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pages/order",
|
||||
"pages": [
|
||||
{
|
||||
"path": "detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "订单详情"
|
||||
},
|
||||
"meta": {
|
||||
"auth": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"tabBar": {
|
||||
"list": [
|
||||
{
|
||||
"pagePath": "pages/index/index"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/index/product"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/index/order"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/index/my"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "uni-app",
|
||||
"navigationBarBackgroundColor": "#F8F8F8",
|
||||
"backgroundColor": "#F8F8F8",
|
||||
"navigationStyle": "custom"
|
||||
},
|
||||
"uniIdRouter": {}
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "uni-app",
|
||||
"navigationBarBackgroundColor": "#F8F8F8",
|
||||
"backgroundColor": "#F8F8F8",
|
||||
"navigationStyle": "custom"
|
||||
},
|
||||
"uniIdRouter": {}
|
||||
}
|
||||
|
|
|
@ -1,49 +1,49 @@
|
|||
<template>
|
||||
<pb-layout navbar="inner" tabbar="/pages/index/index" :bgStyle="bgStyle">
|
||||
<view class="dashboard-module ss-p-x-30">
|
||||
<view class="merchant-info flex align-center justify-between">
|
||||
<view class="flex align-center ss-gap-10">
|
||||
<image class="logo" :src="merchantInfo?.logo" mode="aspectFill"></image>
|
||||
<pb-layout navbar="inner" tabbar="/pages/index/index" :bgStyle="bgStyle" :leftIcon="''">
|
||||
<view class="dashboard-module ss-p-x-30">
|
||||
<view class="merchant-info flex align-center justify-between">
|
||||
<view class="flex align-center ss-gap-10">
|
||||
<image class="logo" :src="merchantInfo?.logo" mode="aspectFill"></image>
|
||||
|
||||
<view class="detail flex flex-column justify-center gap-10">
|
||||
<view class="name ss-font-26">{{ merchantInfo.name }}</view>
|
||||
<view class="description ss-font-26">{{ merchantInfo?.contactPhone }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view @tap="checkVerifi">
|
||||
<text style="color: #fff; font-size: 32px" class="cicon-scan"></text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="statistic ss-m-t-24">
|
||||
<view class="title ss-font-24 ss-m-b-20">
|
||||
{{ `今日收款金额(成功收款${state.statistic.todayPaymentCount}笔)` }}
|
||||
</view>
|
||||
<view class="income flex justify-between align-center">
|
||||
<view class="left flex align-center">
|
||||
<view class="unit self-start">¥</view>
|
||||
<view class="sincome ss-font-60">{{ fen2yuan(state.statistic.todayPaymentAmount || 0) }}</view>
|
||||
</view>
|
||||
<!-- <button class="right-btn ss-reset-button">查看详情</button> -->
|
||||
</view>
|
||||
<view class="des ss-m-t-20">
|
||||
总销售额 {{ fen2yuan(state.statistic.totalSalesAmount) }} 元 | 成功退款
|
||||
{{ state.statistic.refundCount }} 笔 | 退款金额 {{ fen2yuan(state.statistic.refundAmount) }} 元
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="more ss-m-t-70">
|
||||
<view class="title ss-m-b-30">基础数据</view>
|
||||
<view class="items">
|
||||
<view class="item" v-for="(item, index) in state.more" :key="item.name">
|
||||
<view class="label">{{ item.name }}</view>
|
||||
<view class="value">{{ index !== 0 ? item.value : fen2yuan(item.value) }}</view>
|
||||
<view class="last"> 昨日 {{ index === 0 ? fen2yuan(item.last) : item.last }} </view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="detail flex flex-column justify-center gap-10">
|
||||
<view class="name ss-font-26">{{ merchantInfo.name }}</view>
|
||||
<view class="description ss-font-26">{{ merchantInfo?.contactPhone }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</pb-layout>
|
||||
<view @tap="checkVerifi">
|
||||
<text style="color: #fff; font-size: 32px" class="cicon-scan"></text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="statistic ss-m-t-24">
|
||||
<view class="title ss-font-24 ss-m-b-20">
|
||||
{{ `今日收款金额(成功收款${state.statistic?.todayPaymentCount || 0}笔)` }}
|
||||
</view>
|
||||
<view class="income flex justify-between align-center">
|
||||
<view class="left flex align-center">
|
||||
<view class="unit self-start">¥</view>
|
||||
<view class="sincome ss-font-60">{{ fen2yuan(state.statistic.todayPaymentAmount || 0) }}</view>
|
||||
</view>
|
||||
<!-- <button class="right-btn ss-reset-button">查看详情</button> -->
|
||||
</view>
|
||||
<view class="des ss-m-t-20">
|
||||
总销售额 {{ fen2yuan(state.statistic.totalSalesAmount) }} 元 | 成功退款 {{ state.statistic.refundCount }} 笔 |
|
||||
退款金额 {{ fen2yuan(state.statistic.refundAmount) }} 元
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="more ss-m-t-70">
|
||||
<view class="title ss-m-b-30">基础数据</view>
|
||||
<view class="items">
|
||||
<view class="item" v-for="(item, index) in state.more" :key="item.name">
|
||||
<view class="label">{{ item.name }}</view>
|
||||
<view class="value">{{ index !== 0 ? item.value : fen2yuan(item.value) }}</view>
|
||||
<view class="last"> 昨日 {{ index === 0 ? fen2yuan(item.last) : item.last ? item.last : 0 }} </view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</pb-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
@ -57,64 +57,64 @@ import OrderUtil from '@/peach/api/trade/order'
|
|||
import bg from '@/static/bg-page.png'
|
||||
|
||||
const bgStyle = {
|
||||
backgroundImage: bg,
|
||||
imageType: 'local',
|
||||
backgroundColor: '#fff',
|
||||
description: '',
|
||||
backgroundImage: bg,
|
||||
imageType: 'local',
|
||||
backgroundColor: '#fff',
|
||||
description: '',
|
||||
}
|
||||
|
||||
const state = ref({
|
||||
statistic: {
|
||||
todayPaymentCount: 0,
|
||||
todayPaymentAmount: 0,
|
||||
totalSalesAmount: 0,
|
||||
refundCount: 0,
|
||||
refundAmount: 0,
|
||||
statistic: {
|
||||
todayPaymentCount: 0,
|
||||
todayPaymentAmount: 0,
|
||||
totalSalesAmount: 0,
|
||||
refundCount: 0,
|
||||
refundAmount: 0,
|
||||
},
|
||||
more: [
|
||||
{
|
||||
name: '销售金额',
|
||||
key: 'Amount',
|
||||
value: 0,
|
||||
last: 0,
|
||||
},
|
||||
more: [
|
||||
{
|
||||
name: '销售金额',
|
||||
key: 'Amount',
|
||||
value: 0,
|
||||
last: 0,
|
||||
},
|
||||
{
|
||||
name: '订单数',
|
||||
key: 'orderCount',
|
||||
value: 0,
|
||||
last: 0,
|
||||
},
|
||||
{
|
||||
name: '待核销',
|
||||
key: 'verificationOrderCount',
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
name: '待配送',
|
||||
key: 'deliveryOrderCount',
|
||||
value: 0,
|
||||
},
|
||||
],
|
||||
{
|
||||
name: '订单数',
|
||||
key: 'orderCount',
|
||||
value: 0,
|
||||
last: 0,
|
||||
},
|
||||
{
|
||||
name: '待核销',
|
||||
key: 'verificationOrderCount',
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
name: '待配送',
|
||||
key: 'deliveryOrderCount',
|
||||
value: 0,
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
const userStore = $store('user')
|
||||
|
||||
const merchantInfo = computed(() => {
|
||||
return userStore.userInfo?.particulars
|
||||
return userStore.userInfo?.particulars
|
||||
})
|
||||
|
||||
async function getStatistic() {
|
||||
let res = await UserUtil.getHomeStatistics()
|
||||
for (let key of Object.keys(state.value.statistic)) {
|
||||
state.value.statistic[key] = res.data[key]
|
||||
}
|
||||
let res = await UserUtil.getHomeStatistics()
|
||||
for (let key of Object.keys(state.value.statistic)) {
|
||||
state.value.statistic[key] = res.data[key]
|
||||
}
|
||||
|
||||
state.value.more[0].value = res.data.todayPaymentAmount ?? 0
|
||||
state.value.more[0].last = res.data.yesterdaySalesAmount ?? 0
|
||||
state.value.more[1].value = res.data.orderCount
|
||||
state.value.more[1].last = res.data.yesterdayOrderCount
|
||||
state.value.more[2].value = res.data.verificationOrderCount
|
||||
state.value.more[3].value = res.data.deliveryOrderCount
|
||||
state.value.more[0].value = res.data.todayPaymentAmount ?? 0
|
||||
state.value.more[0].last = res.data.yesterdaySalesAmount ?? 0
|
||||
state.value.more[1].value = res.data.orderCount
|
||||
state.value.more[1].last = res.data.yesterdayOrderCount
|
||||
state.value.more[2].value = res.data.verificationOrderCount
|
||||
state.value.more[3].value = res.data.deliveryOrderCount
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -124,126 +124,126 @@ async function getStatistic() {
|
|||
* @returns {Type}
|
||||
*/
|
||||
function checkVerifi() {
|
||||
// 扫描二维码
|
||||
uni.scanCode({
|
||||
success: (res) => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '是否核销该订单',
|
||||
success: function (sres) {
|
||||
if (sres.confirm) {
|
||||
OrderUtil.orderVerification({
|
||||
verifyCode: res.result,
|
||||
}).then((res) => {
|
||||
uni.showToast({
|
||||
title: '订单核销成功',
|
||||
icon: 'success',
|
||||
})
|
||||
setTimeout(() => {
|
||||
peach.$router.go('/pages/order/detail', {
|
||||
id: res.data,
|
||||
})
|
||||
}, 500)
|
||||
})
|
||||
}
|
||||
},
|
||||
// 扫描二维码
|
||||
uni.scanCode({
|
||||
success: (res) => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '是否核销该订单',
|
||||
success: function (sres) {
|
||||
if (sres.confirm) {
|
||||
OrderUtil.orderVerification({
|
||||
verifyCode: res.result,
|
||||
}).then((res) => {
|
||||
uni.showToast({
|
||||
title: '订单核销成功',
|
||||
icon: 'success',
|
||||
})
|
||||
setTimeout(() => {
|
||||
peach.$router.go('/pages/order/detail', {
|
||||
id: res.data,
|
||||
})
|
||||
}, 500)
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log(err)
|
||||
},
|
||||
})
|
||||
})
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log(err)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
getStatistic()
|
||||
getStatistic()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.dashboard-module {
|
||||
.merchant-info {
|
||||
.logo {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.detail {
|
||||
.name {
|
||||
color: #fff;
|
||||
}
|
||||
.description {
|
||||
color: #fff;
|
||||
opacity: 0.4;
|
||||
}
|
||||
.merchant-info {
|
||||
.logo {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.detail {
|
||||
.name {
|
||||
color: #fff;
|
||||
}
|
||||
.description {
|
||||
color: #fff;
|
||||
opacity: 0.4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.statistic {
|
||||
height: 200rpx;
|
||||
background-color: #fffefe;
|
||||
opacity: 0.9;
|
||||
border-radius: 26rpx;
|
||||
padding: 31rpx 40rpx;
|
||||
.title {
|
||||
font-weight: 500;
|
||||
color: var(--ui-TC);
|
||||
}
|
||||
.income {
|
||||
.left {
|
||||
font-weight: 600;
|
||||
flex: 1;
|
||||
color: var(--ui-BG-Main);
|
||||
.unit {
|
||||
position: relative;
|
||||
top: 4px;
|
||||
}
|
||||
}
|
||||
.right-btn {
|
||||
width: 161rpx;
|
||||
height: 63rpx;
|
||||
background-color: var(--ui-BG-Main);
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.statistic {
|
||||
height: 200rpx;
|
||||
background-color: #fffefe;
|
||||
opacity: 0.9;
|
||||
border-radius: 26rpx;
|
||||
padding: 31rpx 40rpx;
|
||||
.title {
|
||||
font-weight: 500;
|
||||
color: var(--ui-TC);
|
||||
}
|
||||
.income {
|
||||
.left {
|
||||
font-weight: 600;
|
||||
flex: 1;
|
||||
color: var(--ui-BG-Main);
|
||||
.unit {
|
||||
position: relative;
|
||||
top: 4px;
|
||||
}
|
||||
}
|
||||
.right-btn {
|
||||
width: 161rpx;
|
||||
height: 63rpx;
|
||||
background-color: var(--ui-BG-Main);
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.des {
|
||||
color: var(--ui-TC-2);
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.des {
|
||||
color: var(--ui-TC-2);
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.more {
|
||||
.title {
|
||||
font-weight: 600;
|
||||
}
|
||||
.items {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 30rpx 30rpx;
|
||||
.item {
|
||||
background: linear-gradient(90deg, #ffebeb 0%, #ffffff 100%);
|
||||
border-radius: 18rpx;
|
||||
padding: 19rpx 32rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
height: 170rpx;
|
||||
.name {
|
||||
font-weight: 600;
|
||||
color: var(--ui-TC);
|
||||
}
|
||||
.value {
|
||||
font-weight: 600;
|
||||
font-size: 31rpx;
|
||||
color: var(--ui-TC);
|
||||
}
|
||||
.last {
|
||||
font-weight: 400;
|
||||
color: var(--ui-TC-2);
|
||||
}
|
||||
}
|
||||
}
|
||||
.more {
|
||||
.title {
|
||||
font-weight: 600;
|
||||
}
|
||||
.items {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 30rpx 30rpx;
|
||||
.item {
|
||||
background: linear-gradient(90deg, #ffebeb 0%, #ffffff 100%);
|
||||
border-radius: 18rpx;
|
||||
padding: 19rpx 32rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
height: 170rpx;
|
||||
.name {
|
||||
font-weight: 600;
|
||||
color: var(--ui-TC);
|
||||
}
|
||||
.value {
|
||||
font-weight: 600;
|
||||
font-size: 31rpx;
|
||||
color: var(--ui-TC);
|
||||
}
|
||||
.last {
|
||||
font-weight: 400;
|
||||
color: var(--ui-TC-2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -6,15 +6,32 @@
|
|||
</view>
|
||||
<uni-forms ref="smsLoginRef" v-model="state.model" :rules="state.rules" validateTrigger="bind">
|
||||
<uni-forms-item name="mobile">
|
||||
<uni-easyinput :styles="state.inputStyle" trim="all" placeholder="请输入手机号" v-model="state.model.mobile"
|
||||
:inputBorder="false" type="number" />
|
||||
<uni-easyinput
|
||||
:styles="state.inputStyle"
|
||||
trim="all"
|
||||
placeholder="请输入手机号"
|
||||
v-model="state.model.mobile"
|
||||
:inputBorder="false"
|
||||
type="number"
|
||||
/>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item name="code">
|
||||
<uni-easyinput :styles="state.inputStyle" trim="all" placeholder="验证码" v-model="state.model.code"
|
||||
:inputBorder="false" type="number" maxlength="4">
|
||||
<uni-easyinput
|
||||
:styles="state.inputStyle"
|
||||
trim="all"
|
||||
placeholder="验证码"
|
||||
v-model="state.model.code"
|
||||
:inputBorder="false"
|
||||
type="number"
|
||||
maxlength="4"
|
||||
>
|
||||
<template #right>
|
||||
<button :disabled="state.isMobileEnd" :class="{ 'code-btn-end': state.isMobileEnd }"
|
||||
class="ss-reset-button code-btn code-btn-start" @tap="getSmsCode('smsLogin', state.model.mobile)">
|
||||
<button
|
||||
:disabled="state.isMobileEnd"
|
||||
:class="{ 'code-btn-end': state.isMobileEnd }"
|
||||
class="ss-reset-button code-btn code-btn-start"
|
||||
@tap="getSmsCode('smsLogin', state.model.mobile)"
|
||||
>
|
||||
{{ getSmsTimer('smsLogin') }}
|
||||
</button>
|
||||
</template>
|
||||
|
@ -24,8 +41,12 @@
|
|||
<button class="ss-reset-button login-btn-start" @tap="smsLoginSubmit">登录</button>
|
||||
<view class="agreement-box ss-flex ss-row-center" :class="{ shake: state.isShaking }">
|
||||
<label class="radio ss-flex" @tap="onChange">
|
||||
<radio :checked="state.agreeStatus" color="var(--ui-BG-Main)" style="transform: scale(0.8)"
|
||||
@tap.stop="onChange" />
|
||||
<radio
|
||||
:checked="state.agreeStatus"
|
||||
color="var(--ui-BG-Main)"
|
||||
style="transform: scale(0.8)"
|
||||
@tap.stop="onChange"
|
||||
/>
|
||||
<view class="agreement-text ss-flex ss-m-l-8">
|
||||
我已阅读并遵守
|
||||
<view class="tcp-text" @tap.stop="onProtocol('商家入驻协议')"> 《商家入驻协议》 </view>
|
||||
|
@ -51,8 +72,8 @@ const state = ref({
|
|||
agreeStatus: false,
|
||||
isShaking: false,
|
||||
model: {
|
||||
mobile: '15036370128',
|
||||
code: '9999',
|
||||
mobile: '',
|
||||
code: '',
|
||||
},
|
||||
rules: {
|
||||
mobile,
|
||||
|
|
|
@ -1,52 +1,48 @@
|
|||
<template>
|
||||
<pb-layout navbar="inner" tabbar="/pages/index/my" :bgStyle="bgStyle">
|
||||
<view class="my-module ss-p-x-30">
|
||||
<view class="user-info flex align-center justify-between">
|
||||
<view class="flex align-center ss-gap-10">
|
||||
<image
|
||||
class="avatar"
|
||||
:src="userInfo.avatar || '/static/default_avatar.png'"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
<pb-layout navbar="inner" tabbar="/pages/index/my" :bgStyle="bgStyle" :leftIcon="''">
|
||||
<view class="my-module ss-p-x-30">
|
||||
<view class="user-info flex align-center justify-between">
|
||||
<view class="flex align-center ss-gap-10">
|
||||
<image class="avatar" :src="userInfo.avatar || '/static/default_avatar.png'" mode="aspectFill"></image>
|
||||
|
||||
<view class="detail flex flex-column justify-center gap-10">
|
||||
<view class="name ss-font-26">{{ userInfo.nickname }}</view>
|
||||
<view class="description ss-font-26">{{ userInfo.mobile }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view>
|
||||
<view class="detail flex flex-column justify-center gap-10">
|
||||
<view class="name ss-font-26">{{ userInfo.nickname }}</view>
|
||||
<view class="description ss-font-26">{{ userInfo.mobile }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view>
|
||||
<text style="color: #fff; font-size: 20px" class="cicon-settings-o"></text>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="statistic ss-m-t-24">
|
||||
<view class="title ss-font-24 ss-m-b-20"> 账户余额 </view>
|
||||
<view class="remain flex justify-between align-center">
|
||||
<view class="left flex align-center">
|
||||
<view class="unit self-start">¥</view>
|
||||
<view class="sremain ss-font-60">{{ remain }}</view>
|
||||
</view>
|
||||
<button @click="peach.$router.go('/pages/user/wallet/money')" class="right-btn ss-reset-button">
|
||||
查看详情
|
||||
</button>
|
||||
</view>
|
||||
<view class="cent ss-m-t-20"> 总获取积分 {{ userInfo.point }} </view>
|
||||
</view>
|
||||
<view class="statistic ss-m-t-24">
|
||||
<view class="title ss-font-24 ss-m-b-20"> 账户余额 </view>
|
||||
<view class="remain flex justify-between align-center">
|
||||
<view class="left flex align-center">
|
||||
<view class="unit self-start">¥</view>
|
||||
<view class="sremain ss-font-60">{{ remain }}</view>
|
||||
</view>
|
||||
<button @click="peach.$router.go('/pages/user/wallet/money')" class="right-btn ss-reset-button">
|
||||
查看详情
|
||||
</button>
|
||||
</view>
|
||||
<view class="cent ss-m-t-20"> 总获取积分 {{ userInfo.point }} </view>
|
||||
</view>
|
||||
|
||||
<view class="menu ss-m-t-70">
|
||||
<view class="title ss-m-b-30">我的服务</view>
|
||||
<view class="items">
|
||||
<view class="item" v-for="item in state.menus" :key="item.name" @click="navService(item)">
|
||||
<image class="icon" :src="item.icon" mode="aspectFill"></image>
|
||||
<view class="label">{{ item.name }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="menu ss-m-t-70">
|
||||
<view class="title ss-m-b-30">我的服务</view>
|
||||
<view class="items">
|
||||
<view class="item" v-for="item in state.menus" :key="item.name" @click="navService(item)">
|
||||
<image class="icon" :src="item.icon" mode="aspectFill"></image>
|
||||
<view class="label">{{ item.name }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="ss-p-x-30 bottom">
|
||||
<button class="ss-reset-button login-btn-start" @tap="logOut">退出登录</button>
|
||||
</view>
|
||||
</pb-layout>
|
||||
</view>
|
||||
</view>
|
||||
<view class="ss-p-x-30 bottom">
|
||||
<button class="ss-reset-button login-btn-start" @tap="logOut">退出登录</button>
|
||||
</view>
|
||||
</pb-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
@ -56,173 +52,173 @@ import AuthUtil from '@/peach/api/member/auth'
|
|||
import peach from '@/peach'
|
||||
|
||||
const bgStyle = {
|
||||
backgroundImage: '/static/bg-page.png',
|
||||
imageType: 'local',
|
||||
backgroundColor: '#fff',
|
||||
backgroundImage: '/static/bg-page.png',
|
||||
imageType: 'local',
|
||||
backgroundColor: '#fff',
|
||||
}
|
||||
|
||||
const state = ref({
|
||||
menus: [
|
||||
{
|
||||
name: '余额提现',
|
||||
icon: '/static/withdraw.png',
|
||||
path: '/pages/user/wallet/withdraw',
|
||||
},
|
||||
{
|
||||
name: '购买积分',
|
||||
icon: '/static/buycent.png',
|
||||
path: '/pages/user/point/buy',
|
||||
},
|
||||
{
|
||||
name: '分发积分',
|
||||
icon: '/static/dispensecent.png',
|
||||
path: '/pages/user/point/share',
|
||||
},
|
||||
{
|
||||
name: '提现规则',
|
||||
icon: '/static/rule.png',
|
||||
path: '',
|
||||
},
|
||||
],
|
||||
menus: [
|
||||
{
|
||||
name: '余额提现',
|
||||
icon: '/static/withdraw.png',
|
||||
path: '/pages/user/wallet/withdraw',
|
||||
},
|
||||
{
|
||||
name: '购买积分',
|
||||
icon: '/static/buycent.png',
|
||||
path: '/pages/user/point/buy',
|
||||
},
|
||||
{
|
||||
name: '分发积分',
|
||||
icon: '/static/dispensecent.png',
|
||||
path: '/pages/user/point/share',
|
||||
},
|
||||
{
|
||||
name: '提现规则',
|
||||
icon: '/static/rule.png',
|
||||
path: '/pages/public/richtext?title=提现规则',
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
const userStore = peach.$store('user')
|
||||
|
||||
const remain = computed(() => {
|
||||
return userStore.userWallet?.balance
|
||||
return userStore.userWallet?.balance
|
||||
})
|
||||
|
||||
const userInfo = computed(() => {
|
||||
return userStore.userInfo
|
||||
return userStore.userInfo
|
||||
})
|
||||
|
||||
function navService(item) {
|
||||
peach.$router.go(item.path)
|
||||
peach.$router.go(item.path)
|
||||
}
|
||||
|
||||
function logOut() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认退出账号?',
|
||||
success: async function (res) {
|
||||
if (!res.confirm) {
|
||||
return
|
||||
}
|
||||
await AuthUtil.logout()
|
||||
userStore.logOut()
|
||||
peach.$router.go('/pages/index/login')
|
||||
},
|
||||
})
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认退出账号?',
|
||||
success: async function (res) {
|
||||
if (!res.confirm) {
|
||||
return
|
||||
}
|
||||
await AuthUtil.logout()
|
||||
userStore.logOut()
|
||||
peach.$router.go('/pages/index/login')
|
||||
},
|
||||
})
|
||||
}
|
||||
onShow(() => {
|
||||
peach.$store('user').updateUserData()
|
||||
peach.$store('user').updateUserData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.my-module {
|
||||
.user-info {
|
||||
.avatar {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.detail {
|
||||
.name {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.description {
|
||||
color: #fff;
|
||||
opacity: 0.4;
|
||||
}
|
||||
}
|
||||
.user-info {
|
||||
.avatar {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.statistic {
|
||||
height: 200rpx;
|
||||
background-color: #fffefe;
|
||||
opacity: 0.9;
|
||||
border-radius: 26rpx;
|
||||
padding: 31rpx 40rpx;
|
||||
.detail {
|
||||
.name {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-weight: 500;
|
||||
color: var(--ui-TC);
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.description {
|
||||
color: #fff;
|
||||
opacity: 0.4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.remain {
|
||||
.left {
|
||||
font-weight: 600;
|
||||
flex: 1;
|
||||
color: var(--ui-BG-Main);
|
||||
.statistic {
|
||||
height: 200rpx;
|
||||
background-color: #fffefe;
|
||||
opacity: 0.9;
|
||||
border-radius: 26rpx;
|
||||
padding: 31rpx 40rpx;
|
||||
|
||||
.unit {
|
||||
position: relative;
|
||||
top: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.right-btn {
|
||||
width: 161rpx;
|
||||
height: 63rpx;
|
||||
background-color: var(--ui-BG-Main);
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.cent {
|
||||
color: var(--ui-TC-2);
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.title {
|
||||
font-weight: 500;
|
||||
color: var(--ui-TC);
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.menu {
|
||||
.title {
|
||||
font-weight: 600;
|
||||
.remain {
|
||||
.left {
|
||||
font-weight: 600;
|
||||
flex: 1;
|
||||
color: var(--ui-BG-Main);
|
||||
|
||||
.unit {
|
||||
position: relative;
|
||||
top: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.items {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 30rpx 30rpx;
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 23rpx;
|
||||
|
||||
.icon {
|
||||
width: 94rpx;
|
||||
height: 94rpx;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-size: 22rpx;
|
||||
color: #0c0c0cff;
|
||||
}
|
||||
}
|
||||
}
|
||||
.right-btn {
|
||||
width: 161rpx;
|
||||
height: 63rpx;
|
||||
background-color: var(--ui-BG-Main);
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.cent {
|
||||
color: var(--ui-TC-2);
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.menu {
|
||||
.title {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.items {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 30rpx 30rpx;
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 23rpx;
|
||||
|
||||
.icon {
|
||||
width: 94rpx;
|
||||
height: 94rpx;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-size: 22rpx;
|
||||
color: #0c0c0cff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bottom {
|
||||
position: absolute;
|
||||
bottom: 70px;
|
||||
width: calc(100% - 60rpx);
|
||||
position: absolute;
|
||||
bottom: 70px;
|
||||
width: calc(100% - 60rpx);
|
||||
|
||||
.login-btn-start {
|
||||
height: 82rpx;
|
||||
line-height: normal;
|
||||
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
|
||||
border-radius: 28rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #fff;
|
||||
}
|
||||
.login-btn-start {
|
||||
height: 82rpx;
|
||||
line-height: normal;
|
||||
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
|
||||
border-radius: 28rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,124 +1,118 @@
|
|||
<template>
|
||||
<pb-layout
|
||||
title="订单"
|
||||
navbar="normal"
|
||||
tabbar="/pages/index/order"
|
||||
:bgStyle="bgStyle"
|
||||
opacityBgUi="bg-white"
|
||||
color="black"
|
||||
>
|
||||
<pb-sticky bgColor="#fff">
|
||||
<pb-tabs :list="tabMaps" :scrollable="false" @change="onTabsChange" :current="state.currentTab" />
|
||||
</pb-sticky>
|
||||
<p-empty
|
||||
v-if="state.pagination.total === 0"
|
||||
icon="/static/order-empty.png"
|
||||
text="暂无订单"
|
||||
bgColor="transparent"
|
||||
/>
|
||||
<view v-if="state.pagination.total > 0">
|
||||
<view
|
||||
class="bg-white order-list-card-box ss-r-10 ss-m-t-14 ss-m-20"
|
||||
v-for="order in state.pagination.list"
|
||||
:key="order.id"
|
||||
>
|
||||
<view @tap="onOrderDetail(order.id, state.currentTab)">
|
||||
<view class="order-card-header ss-flex ss-col-center ss-row-between ss-p-x-20">
|
||||
<view class="order-no">订单号:{{ order.no }}</view>
|
||||
<view class="order-state ss-font-26" :class="formatOrderColor(order)">
|
||||
{{ formatOrderStatus(order) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="border-bottom" v-for="item in order.items" :key="item.id">
|
||||
<p-goods-item
|
||||
:img="item.picUrl"
|
||||
:title="item.spuName"
|
||||
:skuText="item.properties.map((property) => property.valueName).join(' ')"
|
||||
:price="item.price"
|
||||
:num="item.count"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="order-card-footer ss-flex ss-col-center ss-p-x-20"
|
||||
:class="order.buttons.length > 3 ? 'ss-row-between' : 'ss-row-right'"
|
||||
>
|
||||
<view class="ss-flex ss-col-center">
|
||||
<button
|
||||
v-if="order.buttons.length === 0"
|
||||
class="tool-btn ss-reset-button"
|
||||
@tap.stop="onOrderDetail(order.id)"
|
||||
>
|
||||
查看详情
|
||||
</button>
|
||||
<button
|
||||
v-if="order.buttons.includes('confirm')"
|
||||
class="tool-btn ss-reset-button"
|
||||
@tap.stop="onConfirm(order)"
|
||||
>
|
||||
确认收货
|
||||
</button>
|
||||
<button
|
||||
v-if="order.buttons.includes('express')"
|
||||
class="tool-btn ss-reset-button"
|
||||
@tap.stop="onExpress(order.id)"
|
||||
>
|
||||
查看物流
|
||||
</button>
|
||||
<button
|
||||
v-if="order.buttons.includes('cancel')"
|
||||
class="tool-btn ss-reset-button"
|
||||
@tap.stop="onCancel(order.id, sindex)"
|
||||
>
|
||||
取消订单
|
||||
</button>
|
||||
<button
|
||||
v-if="order.buttons.includes('comment')"
|
||||
class="tool-btn ss-reset-button"
|
||||
@tap.stop="onComment(order.id)"
|
||||
>
|
||||
评价
|
||||
</button>
|
||||
<button
|
||||
v-if="order.buttons.includes('delete')"
|
||||
class="delete-btn ss-reset-button"
|
||||
@tap.stop="onDelete(order.id)"
|
||||
>
|
||||
删除订单
|
||||
</button>
|
||||
<button
|
||||
v-if="order.buttons.includes('verification')"
|
||||
class="tool-btn ss-reset-button ui-BG-Main-Gradient"
|
||||
@tap.stop="onVerification(order.id)"
|
||||
>
|
||||
核销订单
|
||||
</button>
|
||||
<button
|
||||
v-if="order.buttons.includes('delivery')"
|
||||
class="tool-btn ss-reset-button ui-BG-Main-Gradient"
|
||||
@tap.stop="onDelivery(order.id)"
|
||||
>
|
||||
配送完成
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pay-box ss-m-t-30 ss-flex ss-gap-40 ss-p-b-40 ss-row-right ss-p-r-20">
|
||||
<view class="ss-flex ss-col-center">
|
||||
<view class="discounts-title pay-color"
|
||||
>共 {{ totalNumsPerOrder(order) }} 件商品,总金额:</view
|
||||
>
|
||||
<view class="discounts-money pay-color"> ¥{{ fen2yuan(totalPricePerOrder(order)) }} </view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<pb-layout
|
||||
title="订单"
|
||||
navbar="normal"
|
||||
tabbar="/pages/index/order"
|
||||
:bgStyle="bgStyle"
|
||||
opacityBgUi="bg-white"
|
||||
color="black"
|
||||
:leftIcon="''"
|
||||
>
|
||||
<pb-sticky bgColor="#fff">
|
||||
<pb-tabs :list="tabMaps" :scrollable="false" @change="onTabsChange" :current="state.currentTab" />
|
||||
</pb-sticky>
|
||||
<p-empty v-if="state.pagination.total === 0" icon="/static/order-empty.png" text="暂无订单" bgColor="transparent" />
|
||||
<view v-if="state.pagination.total > 0">
|
||||
<view
|
||||
class="bg-white order-list-card-box ss-r-10 ss-m-t-14 ss-m-20"
|
||||
v-for="order in state.pagination.list"
|
||||
:key="order.id"
|
||||
>
|
||||
<view @tap="onOrderDetail(order.id, state.currentTab)">
|
||||
<view class="order-card-header ss-flex ss-col-center ss-row-between ss-p-x-20">
|
||||
<view class="order-no">订单号:{{ order.no }}</view>
|
||||
<view class="order-state ss-font-26" :class="formatOrderColor(order)">
|
||||
{{ formatOrderStatus(order) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="border-bottom" v-for="item in order.items" :key="item.id">
|
||||
<p-goods-item
|
||||
:img="item.picUrl"
|
||||
:title="item.spuName"
|
||||
:skuText="item.properties.map((property) => property.valueName).join(' ')"
|
||||
:price="item.price"
|
||||
:num="item.count"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="order-card-footer ss-flex ss-col-center ss-p-x-20"
|
||||
:class="order.buttons.length > 3 ? 'ss-row-between' : 'ss-row-right'"
|
||||
>
|
||||
<view class="ss-flex ss-col-center">
|
||||
<button
|
||||
v-if="order.buttons.length === 0"
|
||||
class="tool-btn ss-reset-button"
|
||||
@tap.stop="onOrderDetail(order.id)"
|
||||
>
|
||||
查看详情
|
||||
</button>
|
||||
<button
|
||||
v-if="order.buttons.includes('confirm')"
|
||||
class="tool-btn ss-reset-button"
|
||||
@tap.stop="onConfirm(order)"
|
||||
>
|
||||
确认收货
|
||||
</button>
|
||||
<button
|
||||
v-if="order.buttons.includes('express')"
|
||||
class="tool-btn ss-reset-button"
|
||||
@tap.stop="onExpress(order.id)"
|
||||
>
|
||||
查看物流
|
||||
</button>
|
||||
<button
|
||||
v-if="order.buttons.includes('cancel')"
|
||||
class="tool-btn ss-reset-button"
|
||||
@tap.stop="onCancel(order.id, sindex)"
|
||||
>
|
||||
取消订单
|
||||
</button>
|
||||
<button
|
||||
v-if="order.buttons.includes('comment')"
|
||||
class="tool-btn ss-reset-button"
|
||||
@tap.stop="onComment(order.id)"
|
||||
>
|
||||
评价
|
||||
</button>
|
||||
<button
|
||||
v-if="order.buttons.includes('delete')"
|
||||
class="delete-btn ss-reset-button"
|
||||
@tap.stop="onDelete(order.id)"
|
||||
>
|
||||
删除订单
|
||||
</button>
|
||||
<button
|
||||
v-if="order.buttons.includes('verification')"
|
||||
class="tool-btn ss-reset-button ui-BG-Main-Gradient"
|
||||
@tap.stop="onVerification(order.id)"
|
||||
>
|
||||
核销订单
|
||||
</button>
|
||||
<button
|
||||
v-if="order.buttons.includes('delivery')"
|
||||
class="tool-btn ss-reset-button ui-BG-Main-Gradient"
|
||||
@tap.stop="onDelivery(order.id)"
|
||||
>
|
||||
配送完成
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pay-box ss-m-t-30 ss-flex ss-gap-40 ss-p-b-40 ss-row-right ss-p-r-20">
|
||||
<view class="ss-flex ss-col-center">
|
||||
<view class="discounts-title pay-color">共 {{ totalNumsPerOrder(order) }} 件商品,总金额:</view>
|
||||
<view class="discounts-money pay-color"> ¥{{ fen2yuan(totalPricePerOrder(order)) }} </view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<uni-load-more
|
||||
v-if="state.pagination.total > 0"
|
||||
:status="state.loadStatus"
|
||||
:content-text="{ contentdown: '上拉加载更多' }"
|
||||
/>
|
||||
</pb-layout>
|
||||
</view>
|
||||
</view>
|
||||
<uni-load-more
|
||||
v-if="state.pagination.total > 0"
|
||||
:status="state.loadStatus"
|
||||
:content-text="{ contentdown: '上拉加载更多' }"
|
||||
/>
|
||||
</pb-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
@ -131,268 +125,268 @@ import _, { isEmpty } from 'lodash'
|
|||
import { resetPagination } from '@/peach/utils'
|
||||
|
||||
const bgStyle = {
|
||||
backgroundColor: 'var(--ui-BG-1)',
|
||||
description: '',
|
||||
backgroundColor: 'var(--ui-BG-1)',
|
||||
description: '',
|
||||
}
|
||||
|
||||
const state = ref({
|
||||
currentTab: 0,
|
||||
pagination: {
|
||||
list: [],
|
||||
total: 0,
|
||||
pageNo: 1,
|
||||
pageSize: 6,
|
||||
},
|
||||
loadStatus: '',
|
||||
currentTab: 0,
|
||||
pagination: {
|
||||
list: [],
|
||||
total: 0,
|
||||
pageNo: 1,
|
||||
pageSize: 6,
|
||||
},
|
||||
loadStatus: '',
|
||||
})
|
||||
|
||||
const tabMaps = [
|
||||
{
|
||||
name: '全部',
|
||||
},
|
||||
{
|
||||
name: '已付款',
|
||||
value: '50,60',
|
||||
commentStatus: 2,
|
||||
},
|
||||
{
|
||||
name: '已评价',
|
||||
value: '30',
|
||||
commentStatus: 1,
|
||||
},
|
||||
{
|
||||
name: '已退款',
|
||||
value: '10,20',
|
||||
},
|
||||
{
|
||||
name: '全部',
|
||||
},
|
||||
{
|
||||
name: '已付款',
|
||||
value: '50,60',
|
||||
commentStatus: 2,
|
||||
},
|
||||
{
|
||||
name: '已评价',
|
||||
value: '30',
|
||||
commentStatus: 1,
|
||||
},
|
||||
{
|
||||
name: '已退款',
|
||||
value: '10,20',
|
||||
},
|
||||
]
|
||||
|
||||
function onDelivery(id) {
|
||||
OrderApi.orderComplete({ orderId: id }).then(() => {
|
||||
uni.showToast({
|
||||
title: '配送成功',
|
||||
icon: 'success',
|
||||
})
|
||||
setTimeout(() => {
|
||||
peach.$router.go('/pages/order/detail', {
|
||||
id: id,
|
||||
})
|
||||
}, 500)
|
||||
OrderApi.orderComplete({ orderId: id }).then(() => {
|
||||
uni.showToast({
|
||||
title: '配送成功',
|
||||
icon: 'success',
|
||||
})
|
||||
setTimeout(() => {
|
||||
peach.$router.go('/pages/order/detail', {
|
||||
id: id,
|
||||
})
|
||||
}, 500)
|
||||
})
|
||||
}
|
||||
|
||||
// 单个订单总商品数
|
||||
function totalNumsPerOrder(order) {
|
||||
if (order.items.length) {
|
||||
return order.items.reduce((per, cur) => {
|
||||
return per + cur.count
|
||||
}, 0)
|
||||
}
|
||||
if (order.items.length) {
|
||||
return order.items.reduce((per, cur) => {
|
||||
return per + cur.count
|
||||
}, 0)
|
||||
}
|
||||
}
|
||||
|
||||
// 单个订单总金额
|
||||
function totalPricePerOrder(order) {
|
||||
if (order.items.length) {
|
||||
return order.items.reduce((per, cur) => {
|
||||
return per + cur.payPrice
|
||||
}, 0)
|
||||
}
|
||||
if (order.items.length) {
|
||||
return order.items.reduce((per, cur) => {
|
||||
return per + cur.payPrice
|
||||
}, 0)
|
||||
}
|
||||
}
|
||||
|
||||
// 切换选项卡
|
||||
function onTabsChange(e) {
|
||||
if (state.value.currentTab === e.index) {
|
||||
return
|
||||
}
|
||||
// 重头加载代码
|
||||
resetPagination(state.value.pagination)
|
||||
state.value.currentTab = e.index
|
||||
getOrderList()
|
||||
if (state.value.currentTab === e.index) {
|
||||
return
|
||||
}
|
||||
// 重头加载代码
|
||||
resetPagination(state.value.pagination)
|
||||
state.value.currentTab = e.index
|
||||
getOrderList()
|
||||
}
|
||||
|
||||
// 订单详情
|
||||
function onOrderDetail(id) {
|
||||
peach.$router.go('/pages/order/detail', {
|
||||
id,
|
||||
currentTabIndex: state.value.currentTab,
|
||||
})
|
||||
peach.$router.go('/pages/order/detail', {
|
||||
id,
|
||||
currentTabIndex: state.value.currentTab,
|
||||
})
|
||||
}
|
||||
|
||||
// 获取订单列表
|
||||
async function getOrderList() {
|
||||
state.value.loadStatus = 'loading'
|
||||
let { data } = await OrderApi.getOrderPage({
|
||||
pageNo: state.value.pagination.pageNo,
|
||||
pageSize: state.value.pagination.pageSize,
|
||||
status: state.value.currentTab !== 3 ? tabMaps[state.value.currentTab].value : undefined,
|
||||
refundStatus: state.value.currentTab === 3 ? tabMaps[state.value.currentTab].value : undefined,
|
||||
commentStatus: tabMaps[state.value.currentTab].commentStatus
|
||||
? state.value.currentTab === 1
|
||||
? false
|
||||
: true
|
||||
: undefined,
|
||||
})
|
||||
state.value.loadStatus = 'loading'
|
||||
let { data } = await OrderApi.getOrderPage({
|
||||
pageNo: state.value.pagination.pageNo,
|
||||
pageSize: state.value.pagination.pageSize,
|
||||
status: state.value.currentTab !== 3 ? tabMaps[state.value.currentTab].value : undefined,
|
||||
refundStatus: state.value.currentTab === 3 ? tabMaps[state.value.currentTab].value : undefined,
|
||||
commentStatus: tabMaps[state.value.currentTab].commentStatus
|
||||
? state.value.currentTab === 1
|
||||
? false
|
||||
: true
|
||||
: undefined,
|
||||
})
|
||||
|
||||
data.list.forEach((item) => {
|
||||
handleOrderButtons(item)
|
||||
})
|
||||
state.value.pagination.list = _.concat(state.value.pagination.list, data.list)
|
||||
state.value.pagination.total = data.total
|
||||
let currentPageTotal = state.value.pagination.length
|
||||
state.value.loadStatus = currentPageTotal < state.value.pagination.total ? 'more' : 'noMore'
|
||||
data.list.forEach((item) => {
|
||||
handleOrderButtons(item)
|
||||
})
|
||||
state.value.pagination.list = _.concat(state.value.pagination.list, data.list)
|
||||
state.value.pagination.total = data.total
|
||||
let currentPageTotal = state.value.pagination.length
|
||||
state.value.loadStatus = currentPageTotal < state.value.pagination.total ? 'more' : 'noMore'
|
||||
}
|
||||
|
||||
onLoad(async (options) => {
|
||||
if (options.type) {
|
||||
state.value.currentTab = options.type
|
||||
}
|
||||
if (options.type) {
|
||||
state.value.currentTab = options.type
|
||||
}
|
||||
})
|
||||
|
||||
onShow(async () => {
|
||||
resetPagination(state.value.pagination)
|
||||
await getOrderList()
|
||||
resetPagination(state.value.pagination)
|
||||
await getOrderList()
|
||||
})
|
||||
|
||||
// 加载更多
|
||||
function loadMore() {
|
||||
if (state.value.loadStatus === 'noMore') {
|
||||
return
|
||||
}
|
||||
state.value.pagination.pageNo++
|
||||
getOrderList()
|
||||
if (state.value.loadStatus === 'noMore') {
|
||||
return
|
||||
}
|
||||
state.value.pagination.pageNo++
|
||||
getOrderList()
|
||||
}
|
||||
|
||||
// 上拉加载更多
|
||||
onReachBottom(() => {
|
||||
loadMore()
|
||||
loadMore()
|
||||
})
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh(() => {
|
||||
resetPagination(state.value.pagination)
|
||||
getOrderList()
|
||||
setTimeout(function () {
|
||||
uni.stopPullDownRefresh()
|
||||
}, 800)
|
||||
resetPagination(state.value.pagination)
|
||||
getOrderList()
|
||||
setTimeout(function () {
|
||||
uni.stopPullDownRefresh()
|
||||
}, 800)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tool-btn {
|
||||
width: 160rpx;
|
||||
height: 60rpx;
|
||||
background: #f6f6f6;
|
||||
font-size: 26rpx;
|
||||
border-radius: 30rpx;
|
||||
margin-right: 10rpx;
|
||||
width: 160rpx;
|
||||
height: 60rpx;
|
||||
background: #f6f6f6;
|
||||
font-size: 26rpx;
|
||||
border-radius: 30rpx;
|
||||
margin-right: 10rpx;
|
||||
|
||||
&:last-of-type {
|
||||
margin-right: 0;
|
||||
}
|
||||
&:last-of-type {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.delete-btn {
|
||||
width: 160rpx;
|
||||
height: 56rpx;
|
||||
color: #ff3000;
|
||||
background: #fee;
|
||||
border-radius: 28rpx;
|
||||
font-size: 26rpx;
|
||||
margin-right: 10rpx;
|
||||
line-height: normal;
|
||||
width: 160rpx;
|
||||
height: 56rpx;
|
||||
color: #ff3000;
|
||||
background: #fee;
|
||||
border-radius: 28rpx;
|
||||
font-size: 26rpx;
|
||||
margin-right: 10rpx;
|
||||
line-height: normal;
|
||||
|
||||
&:last-of-type {
|
||||
margin-right: 0;
|
||||
}
|
||||
&:last-of-type {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.apply-btn {
|
||||
width: 140rpx;
|
||||
height: 50rpx;
|
||||
border-radius: 25rpx;
|
||||
font-size: 24rpx;
|
||||
border: 2rpx solid #dcdcdc;
|
||||
line-height: normal;
|
||||
margin-left: 16rpx;
|
||||
width: 140rpx;
|
||||
height: 50rpx;
|
||||
border-radius: 25rpx;
|
||||
font-size: 24rpx;
|
||||
border: 2rpx solid #dcdcdc;
|
||||
line-height: normal;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.order-list-card-box {
|
||||
.order-card-header {
|
||||
height: 80rpx;
|
||||
.order-card-header {
|
||||
height: 80rpx;
|
||||
|
||||
.order-no {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.order-state {
|
||||
}
|
||||
.order-no {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.pay-box {
|
||||
.discounts-title {
|
||||
font-size: 24rpx;
|
||||
line-height: normal;
|
||||
color: #999999;
|
||||
}
|
||||
.order-state {
|
||||
}
|
||||
}
|
||||
|
||||
.discounts-money {
|
||||
font-size: 24rpx;
|
||||
line-height: normal;
|
||||
color: #999;
|
||||
font-family: OPPOSANS;
|
||||
}
|
||||
|
||||
.pay-color {
|
||||
color: #333;
|
||||
}
|
||||
.pay-box {
|
||||
.discounts-title {
|
||||
font-size: 24rpx;
|
||||
line-height: normal;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.order-card-footer {
|
||||
height: 100rpx;
|
||||
|
||||
.more-item-box {
|
||||
padding: 20rpx;
|
||||
|
||||
.more-item {
|
||||
height: 60rpx;
|
||||
|
||||
.title {
|
||||
font-size: 26rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.more-btn {
|
||||
color: $dark-9;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 154rpx;
|
||||
color: #333333;
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
.discounts-money {
|
||||
font-size: 24rpx;
|
||||
line-height: normal;
|
||||
color: #999;
|
||||
font-family: OPPOSANS;
|
||||
}
|
||||
|
||||
.pay-color {
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
|
||||
.order-card-footer {
|
||||
height: 100rpx;
|
||||
|
||||
.more-item-box {
|
||||
padding: 20rpx;
|
||||
|
||||
.more-item {
|
||||
height: 60rpx;
|
||||
|
||||
.title {
|
||||
font-size: 26rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.more-btn {
|
||||
color: $dark-9;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 154rpx;
|
||||
color: #333333;
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.uni-tooltip-popup) {
|
||||
background: var(--ui-BG);
|
||||
background: var(--ui-BG);
|
||||
}
|
||||
|
||||
.warning-color {
|
||||
color: #faad14;
|
||||
color: #faad14;
|
||||
}
|
||||
|
||||
.danger-color {
|
||||
color: #ff3000;
|
||||
color: #ff3000;
|
||||
}
|
||||
|
||||
.success-color {
|
||||
color: #52c41a;
|
||||
color: #52c41a;
|
||||
}
|
||||
|
||||
.info-color {
|
||||
color: #999999;
|
||||
color: #999999;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,44 +1,45 @@
|
|||
<template>
|
||||
<pb-layout
|
||||
class="product-list"
|
||||
title="产品"
|
||||
navbar="normal"
|
||||
tabbar="/pages/index/product"
|
||||
:bgStyle="bgStyle"
|
||||
opacityBgUi="bg-white"
|
||||
color="black"
|
||||
>
|
||||
<view v-if="state.pagination.total > 0" class="goods-list ss-m-t-20">
|
||||
<view class="ss-p-l-20 ss-p-r-20 ss-m-b-20" v-for="item in state.pagination.list" :key="item.id">
|
||||
<p-goods-column
|
||||
size="lg"
|
||||
:data="item"
|
||||
:topRadius="10"
|
||||
:bottomRadius="10"
|
||||
@refresh="refresh"
|
||||
@click="peach.$router.go('/pages/product/manageGoods', { id: item.id, mark: 'detail' })"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<uni-load-more
|
||||
v-if="state.pagination.total > 0"
|
||||
:status="state.loadStatus"
|
||||
:content-text="{
|
||||
contentdown: '上拉加载更多',
|
||||
}"
|
||||
@click="loadMore"
|
||||
<pb-layout
|
||||
class="product-list"
|
||||
title="产品"
|
||||
navbar="normal"
|
||||
tabbar="/pages/index/product"
|
||||
:bgStyle="bgStyle"
|
||||
opacityBgUi="bg-white"
|
||||
color="black"
|
||||
:leftIcon="''"
|
||||
>
|
||||
<view v-if="state.pagination.total > 0" class="goods-list ss-m-t-20">
|
||||
<view class="ss-p-l-20 ss-p-r-20 ss-m-b-20" v-for="item in state.pagination.list" :key="item.id">
|
||||
<p-goods-column
|
||||
size="lg"
|
||||
:data="item"
|
||||
:topRadius="10"
|
||||
:bottomRadius="10"
|
||||
@refresh="refresh"
|
||||
@click="peach.$router.go('/pages/product/manageGoods', { id: item.id, mark: 'detail' })"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="_icon-add-round add-product" @click="addGoods"></view>
|
||||
<uni-load-more
|
||||
v-if="state.pagination.total > 0"
|
||||
:status="state.loadStatus"
|
||||
:content-text="{
|
||||
contentdown: '上拉加载更多',
|
||||
}"
|
||||
@click="loadMore"
|
||||
/>
|
||||
|
||||
<p-empty
|
||||
v-if="state.pagination.total === 0"
|
||||
icon="/static/soldout-empty.png"
|
||||
text="暂无产品"
|
||||
bgColor="transparent"
|
||||
/>
|
||||
</pb-layout>
|
||||
<view class="_icon-add-round add-product" @click="addGoods"></view>
|
||||
|
||||
<p-empty
|
||||
v-if="state.pagination.total === 0"
|
||||
icon="/static/soldout-empty.png"
|
||||
text="暂无产品"
|
||||
bgColor="transparent"
|
||||
/>
|
||||
</pb-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
@ -50,189 +51,189 @@ import _ from 'lodash'
|
|||
import { resetPagination } from '@/peach/utils'
|
||||
|
||||
const bgStyle = {
|
||||
backgroundImage: '',
|
||||
backgroundColor: 'var(--ui-BG-1)',
|
||||
description: '',
|
||||
backgroundImage: '',
|
||||
backgroundColor: 'var(--ui-BG-1)',
|
||||
description: '',
|
||||
}
|
||||
|
||||
const state = ref({
|
||||
pagination: {
|
||||
list: [],
|
||||
total: 0,
|
||||
pageNo: 1,
|
||||
pageSize: 6,
|
||||
name: '',
|
||||
createTime: [],
|
||||
},
|
||||
loadStatus: '',
|
||||
pagination: {
|
||||
list: [],
|
||||
total: 0,
|
||||
pageNo: 1,
|
||||
pageSize: 6,
|
||||
name: '',
|
||||
createTime: [],
|
||||
},
|
||||
loadStatus: '',
|
||||
})
|
||||
|
||||
function emptyList() {
|
||||
resetPagination(state.value.pagination)
|
||||
resetPagination(state.value.pagination)
|
||||
}
|
||||
|
||||
function onSearch() {
|
||||
emptyList()
|
||||
getList()
|
||||
emptyList()
|
||||
getList()
|
||||
}
|
||||
|
||||
async function getList() {
|
||||
let { data } = await GoodApi.getProductList({
|
||||
pageNo: state.value.pagination.pageNo,
|
||||
pageSize: state.value.pagination.pageSize,
|
||||
})
|
||||
let { data } = await GoodApi.getProductList({
|
||||
pageNo: state.value.pagination.pageNo,
|
||||
pageSize: state.value.pagination.pageSize,
|
||||
})
|
||||
|
||||
state.value.pagination.list = _.concat(state.value.pagination.list, data.list)
|
||||
state.value.pagination.total = data.total
|
||||
let currentPageTotal = state.value.pagination.length
|
||||
state.value.pagination.list = _.concat(state.value.pagination.list, data.list)
|
||||
state.value.pagination.total = data.total
|
||||
let currentPageTotal = state.value.pagination.length
|
||||
|
||||
state.value.loadStatus = currentPageTotal < state.value.pagination.total ? 'more' : 'noMore'
|
||||
state.value.loadStatus = currentPageTotal < state.value.pagination.total ? 'more' : 'noMore'
|
||||
}
|
||||
|
||||
function addGoods() {
|
||||
peach.$store('trade').$patch({
|
||||
selectedProperty: null,
|
||||
goodsInfo: null,
|
||||
skus: null,
|
||||
specType: false,
|
||||
})
|
||||
peach.$router.go('/pages/product/manageGoods', {
|
||||
title: '添加商品',
|
||||
})
|
||||
peach.$store('trade').$patch({
|
||||
selectedProperty: null,
|
||||
goodsInfo: null,
|
||||
skus: null,
|
||||
specType: false,
|
||||
})
|
||||
peach.$router.go('/pages/product/manageGoods', {
|
||||
title: '添加商品',
|
||||
})
|
||||
}
|
||||
|
||||
function loadMore() {
|
||||
if (state.value.loadStatus === 'noMore') {
|
||||
return
|
||||
}
|
||||
state.value.pagination.pageNo++
|
||||
getList()
|
||||
if (state.value.loadStatus === 'noMore') {
|
||||
return
|
||||
}
|
||||
state.value.pagination.pageNo++
|
||||
getList()
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
resetPagination(state.value.pagination)
|
||||
getList()
|
||||
resetPagination(state.value.pagination)
|
||||
getList()
|
||||
}
|
||||
|
||||
onShow(async () => {
|
||||
resetPagination(state.value.pagination)
|
||||
await getList()
|
||||
resetPagination(state.value.pagination)
|
||||
await getList()
|
||||
})
|
||||
|
||||
onReachBottom(() => {
|
||||
loadMore()
|
||||
loadMore()
|
||||
})
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh(() => {
|
||||
resetPagination(state.value.pagination)
|
||||
getList()
|
||||
setTimeout(function () {
|
||||
uni.stopPullDownRefresh()
|
||||
}, 800)
|
||||
resetPagination(state.value.pagination)
|
||||
getList()
|
||||
setTimeout(function () {
|
||||
uni.stopPullDownRefresh()
|
||||
}, 800)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.product-list {
|
||||
.add-product {
|
||||
position: fixed;
|
||||
color: var(--ui-BG-Main);
|
||||
bottom: 70px;
|
||||
right: 20px;
|
||||
font-size: 80rpx;
|
||||
z-index: 999;
|
||||
.add-product {
|
||||
position: fixed;
|
||||
color: var(--ui-BG-Main);
|
||||
bottom: 70px;
|
||||
right: 20px;
|
||||
font-size: 80rpx;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
.goods-list-box {
|
||||
width: 50%;
|
||||
box-sizing: border-box;
|
||||
|
||||
.left-list {
|
||||
margin-right: 10rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.goods-list-box {
|
||||
width: 50%;
|
||||
box-sizing: border-box;
|
||||
.right-list {
|
||||
margin-left: 10rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.left-list {
|
||||
margin-right: 10rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.right-list {
|
||||
margin-left: 10rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.goods-box {
|
||||
&:nth-last-of-type(1) {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
.goods-box {
|
||||
&:nth-last-of-type(1) {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
&:nth-child(2n) {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&:nth-child(2n) {
|
||||
margin-right: 0;
|
||||
}
|
||||
.list-icon {
|
||||
width: 80rpx;
|
||||
|
||||
.sicon-goods-card {
|
||||
font-size: 40rpx;
|
||||
}
|
||||
|
||||
.list-icon {
|
||||
width: 80rpx;
|
||||
.sicon-goods-list {
|
||||
font-size: 40rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.sicon-goods-card {
|
||||
font-size: 40rpx;
|
||||
}
|
||||
.goods-card {
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
.sicon-goods-list {
|
||||
font-size: 40rpx;
|
||||
}
|
||||
.list-filter-tabs {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.filter-list-box {
|
||||
padding: 28rpx 52rpx;
|
||||
|
||||
.filter-item {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
line-height: normal;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
&:nth-last-child(1) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.goods-card {
|
||||
margin-left: 20rpx;
|
||||
.filter-item-active {
|
||||
color: var(--ui-BG-Main);
|
||||
}
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
height: 50px;
|
||||
position: relative;
|
||||
z-index: 11;
|
||||
|
||||
.tab-title {
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.list-filter-tabs {
|
||||
background-color: #fff;
|
||||
.cur-tab-title {
|
||||
font-weight: $font-weight-bold;
|
||||
}
|
||||
|
||||
.filter-list-box {
|
||||
padding: 28rpx 52rpx;
|
||||
|
||||
.filter-item {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
line-height: normal;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
&:nth-last-child(1) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.filter-item-active {
|
||||
color: var(--ui-BG-Main);
|
||||
}
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
height: 50px;
|
||||
position: relative;
|
||||
z-index: 11;
|
||||
|
||||
.tab-title {
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.cur-tab-title {
|
||||
font-weight: $font-weight-bold;
|
||||
}
|
||||
|
||||
.tab-line {
|
||||
width: 60rpx;
|
||||
height: 6rpx;
|
||||
border-radius: 6rpx;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
bottom: 10rpx;
|
||||
background-color: var(--ui-BG-Main);
|
||||
z-index: 12;
|
||||
}
|
||||
.tab-line {
|
||||
width: 60rpx;
|
||||
height: 6rpx;
|
||||
border-radius: 6rpx;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
bottom: 10rpx;
|
||||
background-color: var(--ui-BG-Main);
|
||||
z-index: 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -9,18 +9,46 @@
|
|||
<view class="property-value ss-flex ss-gap-40">
|
||||
<view class="property-value-text">规格值</view>
|
||||
<view class="property-value-value ss-flex ss-gap-10">
|
||||
<view v-for="sitem in item.propertyValues" @tap="chooseProperty(sitem)"
|
||||
:class="['item', sitem.checked ? 'active' : '']">{{ sitem.name }}</view>
|
||||
<view
|
||||
v-for="sitem in item.propertyValues"
|
||||
@tap="chooseProperty(sitem)"
|
||||
@longpress="longPropertyValuePress(sitem)"
|
||||
:class="['item', sitem.checked ? 'active' : '']"
|
||||
>{{ sitem.name }}</view
|
||||
>
|
||||
</view>
|
||||
<view v-if="canEdit" style="height: 60rpx" @click="addPropertyValueClick(item)">
|
||||
<text style="color: #ff3300; font-size: 30px" class="cicon-add-round-o"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<uni-popup ref="inputPropertyValueDialogRef" type="dialog">
|
||||
<uni-popup-dialog
|
||||
mode="input"
|
||||
:title="propertyValueTitle"
|
||||
v-model="inputPropertyValueFormdata.name"
|
||||
placeholder="请输入商品规格"
|
||||
:before-close="true"
|
||||
@confirm="dialogInputPropertyValueConfirm"
|
||||
@close="inputPropertyValueDialogRef.close()"
|
||||
></uni-popup-dialog>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { defineProps, defineEmits, ref, computed } from 'vue'
|
||||
import { goodsPropertyList, canEdit } from '../js/sku'
|
||||
import {
|
||||
goodsPropertyList,
|
||||
canEdit,
|
||||
addPropertyValueClick,
|
||||
inputPropertyValueDialogRef,
|
||||
inputPropertyValueFormdata,
|
||||
propertyValueTitle,
|
||||
dialogInputPropertyValueConfirm,
|
||||
longPropertyValuePress,
|
||||
} from '../js/sku'
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
|
|
|
@ -3,22 +3,44 @@
|
|||
<uni-popup type="bottom" ref="propertyListPopupRef" background-color="#fff">
|
||||
<view class="popup-header">
|
||||
<view class="button-cancel" @click="onClosePopup">取消</view>
|
||||
<view style="color: #c0c0c0; font-size: 12px">长按规格修改/删除</view>
|
||||
<view class="button-link" @click="onConfirmPopup">确定</view>
|
||||
</view>
|
||||
<view class="popup-content">
|
||||
<view v-for="item in nowGoodsPropertyList" :key="item.id"
|
||||
:class="['property-item', item.checked ? 'active' : '']" @tap="chooseProperty(item)">
|
||||
<view
|
||||
v-for="item in nowGoodsPropertyList"
|
||||
:key="item.id"
|
||||
:class="['property-item', item.checked ? 'active' : '']"
|
||||
@tap="chooseProperty(item)"
|
||||
@longpress="longPress(item)"
|
||||
>
|
||||
{{ item.name }}
|
||||
</view>
|
||||
<view v-if="canEdit" style="height: 60rpx" @click="addPropertyClick">
|
||||
<text style="color: #ff3300; font-size: 30px" class="cicon-add-round-o"></text>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
<uni-popup ref="inputDialogRef" type="dialog">
|
||||
<uni-popup-dialog
|
||||
mode="input"
|
||||
:title="propertyTitle"
|
||||
v-model="inputFormdata.name"
|
||||
placeholder="请输入商品规格"
|
||||
:before-close="true"
|
||||
@confirm="dialogInputConfirm"
|
||||
@close="inputDialogRef.close()"
|
||||
></uni-popup-dialog>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, defineEmits, defineProps, defineExpose } from 'vue'
|
||||
import peach from '@/peach'
|
||||
import { cloneDeep } from 'lodash';
|
||||
import GoodsApi from '@/peach/api/trade/goods'
|
||||
import { getGoodsProperty, canEdit } from '../js/sku'
|
||||
import { cloneDeep } from 'lodash'
|
||||
|
||||
/**
|
||||
* todo 底部高度配置
|
||||
|
@ -51,8 +73,30 @@ function chooseProperty(item) {
|
|||
item.checked = !item.checked
|
||||
}
|
||||
|
||||
function onConfirmPopup() {
|
||||
function longPress(item) {
|
||||
if (canEdit) {
|
||||
// 震动提示
|
||||
uni.vibrateShort()
|
||||
uni.showActionSheet({
|
||||
itemList: ['编辑', '删除'],
|
||||
success: async (res) => {
|
||||
if (res.tapIndex === 0) {
|
||||
propertyTitle.value = '编辑'
|
||||
inputFormdata.value.id = item.id
|
||||
inputFormdata.value.name = item.name
|
||||
inputDialogRef.value.open()
|
||||
}
|
||||
if (res.tapIndex === 1) {
|
||||
await GoodsApi.delProperty({ id: item.id })
|
||||
await getGoodsProperty()
|
||||
nowGoodsPropertyList.value = cloneDeep(props.goodsPropertyList)
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function onConfirmPopup() {
|
||||
let result = nowGoodsPropertyList.value
|
||||
.filter((item) => {
|
||||
if (item.checked) {
|
||||
|
@ -67,13 +111,40 @@ function onConfirmPopup() {
|
|||
}
|
||||
})
|
||||
|
||||
|
||||
peach.$store('trade').selectedProperty = result
|
||||
emit('confirm')
|
||||
emit('update:modelValue', result)
|
||||
onClosePopup()
|
||||
}
|
||||
|
||||
const propertyTitle = ref('新增')
|
||||
const inputDialogRef = ref()
|
||||
const inputFormdata = ref({
|
||||
id: '',
|
||||
name: '',
|
||||
remark: '',
|
||||
})
|
||||
function addPropertyClick() {
|
||||
propertyTitle.value = '新增'
|
||||
inputFormdata.value.name = ''
|
||||
inputDialogRef.value.open()
|
||||
}
|
||||
|
||||
async function dialogInputConfirm(value) {
|
||||
if (!value) {
|
||||
peach.$helper.toast('请输入商品属性')
|
||||
return
|
||||
}
|
||||
if (inputFormdata.value.id) {
|
||||
await GoodsApi.editProperty(inputFormdata.value)
|
||||
} else {
|
||||
await GoodsApi.createProperty(inputFormdata.value)
|
||||
}
|
||||
await getGoodsProperty()
|
||||
inputDialogRef.value.close()
|
||||
nowGoodsPropertyList.value = cloneDeep(props.goodsPropertyList)
|
||||
}
|
||||
|
||||
function onOpen() {
|
||||
nowGoodsPropertyList.value = cloneDeep(props.goodsPropertyList)
|
||||
propertyListPopupRef.value.open('bottom')
|
||||
|
|
|
@ -19,104 +19,103 @@ const propertyListRef = ref(null)
|
|||
const canEdit = computed(() => peach.$store('trade').canEdit)
|
||||
|
||||
const formData = ref({
|
||||
specType: true,
|
||||
specText: SPEC_TYPE[0].label,
|
||||
specType: true,
|
||||
specText: SPEC_TYPE[0].label,
|
||||
})
|
||||
|
||||
async function showPropertyList() {
|
||||
await getGoodsProperty()
|
||||
propertyListRef.value.onOpen()
|
||||
await getGoodsProperty()
|
||||
propertyListRef.value.onOpen()
|
||||
}
|
||||
|
||||
function onRDPickerConfirm(e) {
|
||||
formData.value.specType = SPEC_TYPE[e.value[0]].value
|
||||
formData.value.specText = SPEC_TYPE[e.value[0]].label
|
||||
formData.value.specType = SPEC_TYPE[e.value[0]].value
|
||||
formData.value.specText = SPEC_TYPE[e.value[0]].label
|
||||
|
||||
// 如果商品规格不一致,则需要重新初始化 sku 列表
|
||||
initSku()
|
||||
// 如果商品规格不一致,则需要重新初始化 sku 列表
|
||||
initSku()
|
||||
}
|
||||
|
||||
function pickerProperty() {
|
||||
if (canEdit.value) {
|
||||
let index = formData.value.specType ? 1 : 0
|
||||
if (canEdit.value) {
|
||||
let index = formData.value.specType ? 1 : 0
|
||||
|
||||
pickerRef.value.onOpen([index])
|
||||
}
|
||||
pickerRef.value.onOpen([index])
|
||||
}
|
||||
}
|
||||
|
||||
async function onPropertyConfirm(e) {
|
||||
await getGoodsProperty()
|
||||
console.log(e)
|
||||
await getGoodsProperty()
|
||||
}
|
||||
|
||||
function onConfirm() {
|
||||
console.log(skus.value)
|
||||
console.log(skus.value)
|
||||
}
|
||||
|
||||
async function getGoodsProperty() {
|
||||
let { data } = await GoodsApi.getHistoryProperty()
|
||||
let { data } = await GoodsApi.getHistoryProperty()
|
||||
|
||||
// 此处处理商品详情情况下,多规格属性
|
||||
// 把 propertyList 中 id 相同的属性合并,并去重
|
||||
propertyList.value = peach.$store('trade').selectedProperty || []
|
||||
// 此处处理商品详情情况下,多规格属性
|
||||
// 把 propertyList 中 id 相同的属性合并,并去重
|
||||
propertyList.value = peach.$store('trade').selectedProperty || []
|
||||
|
||||
// 根据已经选择数据,设置默认选中
|
||||
data.forEach((item) => {
|
||||
// 判断属性是否已经选中
|
||||
let propertyParent = propertyList.value.find((sitem) => sitem?.id === item.id)
|
||||
// 根据已经选择数据,设置默认选中
|
||||
data.forEach((item) => {
|
||||
// 判断属性是否已经选中
|
||||
let propertyParent = propertyList.value.find((sitem) => sitem?.id === item.id)
|
||||
|
||||
item.checked = propertyParent ? true : false
|
||||
item.checked = propertyParent ? true : false
|
||||
|
||||
// 如果属性已经选中,查询子类中是否有选中
|
||||
if (item.checked) {
|
||||
item.propertyValues.forEach((child) => {
|
||||
let childResult = propertyParent?.children.some((schild) => schild === child.id)
|
||||
child.checked = childResult ? true : false
|
||||
})
|
||||
}
|
||||
})
|
||||
// 如果属性已经选中,查询子类中是否有选中
|
||||
if (item.checked) {
|
||||
item.propertyValues.forEach((child) => {
|
||||
let childResult = propertyParent?.children.some((schild) => schild === child.id)
|
||||
child.checked = childResult ? true : false
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
goodsPropertyList.value = data
|
||||
goodsPropertyList.value = data
|
||||
|
||||
console.log(goodsPropertyList.value)
|
||||
console.log(goodsPropertyList.value)
|
||||
}
|
||||
|
||||
function changeSubProperty() {
|
||||
// 修改子属性状态,需要同步更新 skus 的显示
|
||||
console.log(goodsPropertyList.value)
|
||||
// 过滤父属性 checked 选项,深拷贝避免后面循环改变元数据内容
|
||||
let temp = JSON.parse(JSON.stringify(goodsPropertyList.value.filter((item) => item.checked)))
|
||||
temp.forEach((item) => {
|
||||
item.propertyValues = item.propertyValues.filter((child) => child.checked)
|
||||
})
|
||||
// 修改子属性状态,需要同步更新 skus 的显示
|
||||
console.log(goodsPropertyList.value)
|
||||
// 过滤父属性 checked 选项,深拷贝避免后面循环改变元数据内容
|
||||
let temp = JSON.parse(JSON.stringify(goodsPropertyList.value.filter((item) => item.checked)))
|
||||
temp.forEach((item) => {
|
||||
item.propertyValues = item.propertyValues.filter((child) => child.checked)
|
||||
})
|
||||
|
||||
let result = temp.map((item) => {
|
||||
return item.propertyValues.map((child) => ({
|
||||
propertyId: item.id,
|
||||
propertyName: item.name,
|
||||
valueId: child.id,
|
||||
valueName: child.name,
|
||||
}))
|
||||
})
|
||||
let result = temp.map((item) => {
|
||||
return item.propertyValues.map((child) => ({
|
||||
propertyId: item.id,
|
||||
propertyName: item.name,
|
||||
valueId: child.id,
|
||||
valueName: child.name,
|
||||
}))
|
||||
})
|
||||
|
||||
let tempSkus = []
|
||||
let tempSkus = []
|
||||
|
||||
for (let item of reduceArr(result)) {
|
||||
let obj = {
|
||||
picUrl: '',
|
||||
barCode: '',
|
||||
price: 0,
|
||||
marketPrice: 0,
|
||||
costPrice: 0,
|
||||
stock: 0,
|
||||
weight: 0,
|
||||
volume: 0,
|
||||
properties: item,
|
||||
}
|
||||
tempSkus.push(obj)
|
||||
for (let item of reduceArr(result)) {
|
||||
let obj = {
|
||||
picUrl: '',
|
||||
barCode: '',
|
||||
price: 0,
|
||||
marketPrice: 0,
|
||||
costPrice: 0,
|
||||
stock: 0,
|
||||
weight: 0,
|
||||
volume: 0,
|
||||
properties: item,
|
||||
}
|
||||
tempSkus.push(obj)
|
||||
}
|
||||
|
||||
skus.value = tempSkus
|
||||
skus.value = tempSkus
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -126,35 +125,35 @@ function changeSubProperty() {
|
|||
* @returns {Type}
|
||||
*/
|
||||
function initSku() {
|
||||
// 单规格
|
||||
if (!formData.value.specType) {
|
||||
let obj = {
|
||||
picUrl: '',
|
||||
barCode: '',
|
||||
price: 0,
|
||||
marketPrice: 0,
|
||||
costPrice: 0,
|
||||
stock: 0,
|
||||
weight: null,
|
||||
volume: null,
|
||||
properties: [
|
||||
{
|
||||
propertyId: 0,
|
||||
propertyName: '默认',
|
||||
valueId: 0,
|
||||
valueName: '默认',
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
skus.value = [obj]
|
||||
} else {
|
||||
// 初始化已选中规格,属性和格式化后的结果
|
||||
propertyList.value = []
|
||||
goodsPropertyList.value = []
|
||||
// 多规格
|
||||
skus.value = []
|
||||
// 单规格
|
||||
if (!formData.value.specType) {
|
||||
let obj = {
|
||||
picUrl: '',
|
||||
barCode: '',
|
||||
price: 0,
|
||||
marketPrice: 0,
|
||||
costPrice: 0,
|
||||
stock: 0,
|
||||
weight: null,
|
||||
volume: null,
|
||||
properties: [
|
||||
{
|
||||
propertyId: 0,
|
||||
propertyName: '默认',
|
||||
valueId: 0,
|
||||
valueName: '默认',
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
skus.value = [obj]
|
||||
} else {
|
||||
// 初始化已选中规格,属性和格式化后的结果
|
||||
propertyList.value = []
|
||||
goodsPropertyList.value = []
|
||||
// 多规格
|
||||
skus.value = []
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -164,127 +163,188 @@ function initSku() {
|
|||
* @returns {Type}
|
||||
*/
|
||||
function submitProperty() {
|
||||
try {
|
||||
validateSku(skus.value)
|
||||
peach.$store('trade').$patch({
|
||||
skus: skus.value,
|
||||
specType: formData.value.specType,
|
||||
})
|
||||
peach.$router.back()
|
||||
} catch (e) {
|
||||
console.log(skus.value)
|
||||
console.log(e, '校验失败')
|
||||
}
|
||||
try {
|
||||
validateSku(skus.value)
|
||||
peach.$store('trade').$patch({
|
||||
skus: skus.value,
|
||||
specType: formData.value.specType,
|
||||
})
|
||||
peach.$router.back()
|
||||
} catch (e) {
|
||||
console.log(skus.value)
|
||||
console.log(e, '校验失败')
|
||||
}
|
||||
}
|
||||
|
||||
function validateSku(skus) {
|
||||
let warningInfo = '请检查商品各行相关属性配置,'
|
||||
let validateStatue = true
|
||||
let skusValue = skus ?? peach.$store('trade').skus
|
||||
let warningInfo = '请检查商品各行相关属性配置,'
|
||||
let validateStatue = true
|
||||
let skusValue = skus ?? peach.$store('trade').skus
|
||||
|
||||
// 判断如果是多规格,并且 skusValue 为空 [],则提示
|
||||
if (formData.value.specType && skusValue.length < 1) {
|
||||
uni.showToast({
|
||||
title: '请选择商品规格',
|
||||
icon: 'none',
|
||||
duration: 4000,
|
||||
})
|
||||
throw new Error('请选择商品规格')
|
||||
// 判断如果是多规格,并且 skusValue 为空 [],则提示
|
||||
if (formData.value.specType && skusValue.length < 1) {
|
||||
uni.showToast({
|
||||
title: '请选择商品规格',
|
||||
icon: 'none',
|
||||
duration: 4000,
|
||||
})
|
||||
throw new Error('请选择商品规格')
|
||||
}
|
||||
for (const sku of skusValue) {
|
||||
for (const rule of SKU_RULE_CONFIG) {
|
||||
const arg = getValue(sku, rule.name)
|
||||
if (!rule.rule(arg)) {
|
||||
validateStatue = false
|
||||
warningInfo += rule.message
|
||||
break
|
||||
}
|
||||
}
|
||||
for (const sku of skusValue) {
|
||||
for (const rule of SKU_RULE_CONFIG) {
|
||||
const arg = getValue(sku, rule.name)
|
||||
if (!rule.rule(arg)) {
|
||||
validateStatue = false
|
||||
warningInfo += rule.message
|
||||
break
|
||||
}
|
||||
}
|
||||
if (!validateStatue) {
|
||||
uni.showToast({
|
||||
title: warningInfo,
|
||||
icon: 'none',
|
||||
duration: 4000,
|
||||
})
|
||||
throw new Error(warningInfo)
|
||||
}
|
||||
if (!validateStatue) {
|
||||
uni.showToast({
|
||||
title: warningInfo,
|
||||
icon: 'none',
|
||||
duration: 4000,
|
||||
})
|
||||
throw new Error(warningInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getValue(obj, arg) {
|
||||
const keys = arg.split('.')
|
||||
let value = obj
|
||||
for (const key of keys) {
|
||||
if (value && typeof value === 'object' && key in value) {
|
||||
value = value[key]
|
||||
} else {
|
||||
value = undefined
|
||||
break
|
||||
}
|
||||
const keys = arg.split('.')
|
||||
let value = obj
|
||||
for (const key of keys) {
|
||||
if (value && typeof value === 'object' && key in value) {
|
||||
value = value[key]
|
||||
} else {
|
||||
value = undefined
|
||||
break
|
||||
}
|
||||
return value
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
function reduceArr(arr) {
|
||||
return arr.reduce((acc, cur) => {
|
||||
let tempAcc = []
|
||||
return arr.reduce((acc, cur) => {
|
||||
let tempAcc = []
|
||||
|
||||
if (acc.length < 1) {
|
||||
cur.forEach((item, index) => {
|
||||
if (tempAcc[index]) {
|
||||
tempAcc[index].push(item)
|
||||
} else {
|
||||
tempAcc[index] = [item]
|
||||
}
|
||||
})
|
||||
if (acc.length < 1) {
|
||||
cur.forEach((item, index) => {
|
||||
if (tempAcc[index]) {
|
||||
tempAcc[index].push(item)
|
||||
} else {
|
||||
acc.forEach((item, index) => {
|
||||
cur.forEach((sitem, sindex) => {
|
||||
tempAcc.push([...item, sitem])
|
||||
})
|
||||
})
|
||||
|
||||
if (cur.length < 1) {
|
||||
tempAcc = acc
|
||||
}
|
||||
tempAcc[index] = [item]
|
||||
}
|
||||
return tempAcc
|
||||
}, [])
|
||||
})
|
||||
} else {
|
||||
acc.forEach((item, index) => {
|
||||
cur.forEach((sitem, sindex) => {
|
||||
tempAcc.push([...item, sitem])
|
||||
})
|
||||
})
|
||||
|
||||
if (cur.length < 1) {
|
||||
tempAcc = acc
|
||||
}
|
||||
}
|
||||
return tempAcc
|
||||
}, [])
|
||||
}
|
||||
|
||||
const specType = computed(() => peach.$store('trade').specType)
|
||||
|
||||
function initial() {
|
||||
onLoad(() => {
|
||||
formData.value.specType = specType.value
|
||||
formData.value.specText = SPEC_TYPE[specType.value ? 1 : 0].label
|
||||
skus.value = JSON.parse(JSON.stringify(peach.$store('trade').skus))
|
||||
// 如果新增商品 sku,并且是单规格,初始化 sku
|
||||
onLoad(() => {
|
||||
formData.value.specType = specType.value
|
||||
formData.value.specText = SPEC_TYPE[specType.value ? 1 : 0].label
|
||||
skus.value = JSON.parse(JSON.stringify(peach.$store('trade').skus))
|
||||
// 如果新增商品 sku,并且是单规格,初始化 sku
|
||||
|
||||
if (!skus.value) {
|
||||
initSku()
|
||||
if (!skus.value) {
|
||||
initSku()
|
||||
}
|
||||
if (specType.value) {
|
||||
getGoodsProperty()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const propertyValueTitle = ref('新增')
|
||||
const inputPropertyValueDialogRef = ref()
|
||||
const inputPropertyValueFormdata = ref({
|
||||
id: '',
|
||||
propertyId: '',
|
||||
name: '',
|
||||
remark: '',
|
||||
})
|
||||
function addPropertyValueClick(item) {
|
||||
console.log(item)
|
||||
propertyValueTitle.value = '新增'
|
||||
inputPropertyValueFormdata.value.name = ''
|
||||
inputPropertyValueFormdata.value.propertyId = item.id
|
||||
inputPropertyValueDialogRef.value.open()
|
||||
}
|
||||
|
||||
async function dialogInputPropertyValueConfirm(value) {
|
||||
if (!value) {
|
||||
peach.$helper.toast('请输入商品属性')
|
||||
return
|
||||
}
|
||||
if (inputPropertyValueFormdata.value.id) {
|
||||
await GoodsApi.editPropertyValue(inputPropertyValueFormdata.value)
|
||||
} else {
|
||||
await GoodsApi.createPropertyValue(inputPropertyValueFormdata.value)
|
||||
}
|
||||
await getGoodsProperty()
|
||||
inputPropertyValueDialogRef.value.close()
|
||||
}
|
||||
|
||||
function longPropertyValuePress(item) {
|
||||
console.log(item)
|
||||
if (canEdit.value) {
|
||||
// 震动提示
|
||||
uni.vibrateShort()
|
||||
uni.showActionSheet({
|
||||
itemList: ['编辑', '删除'],
|
||||
success: async (res) => {
|
||||
if (res.tapIndex === 0) {
|
||||
propertyValueTitle.value = '编辑'
|
||||
inputPropertyValueFormdata.value.id = item.id
|
||||
inputPropertyValueFormdata.value.propertyId = item.propertyId
|
||||
inputPropertyValueFormdata.value.name = item.name
|
||||
inputPropertyValueDialogRef.value.open()
|
||||
}
|
||||
if (specType.value) {
|
||||
getGoodsProperty()
|
||||
if (res.tapIndex === 1) {
|
||||
await GoodsApi.delPropertyValue({ id: item.id })
|
||||
await getGoodsProperty()
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
initial,
|
||||
canEdit,
|
||||
skus,
|
||||
pickerRef,
|
||||
pickerProperty,
|
||||
validateSku,
|
||||
onConfirm,
|
||||
submitProperty,
|
||||
propertyListRef,
|
||||
formData,
|
||||
onRDPickerConfirm,
|
||||
onPropertyConfirm,
|
||||
propertyList,
|
||||
showPropertyList,
|
||||
goodsPropertyList,
|
||||
changeSubProperty,
|
||||
initial,
|
||||
canEdit,
|
||||
skus,
|
||||
pickerRef,
|
||||
pickerProperty,
|
||||
validateSku,
|
||||
onConfirm,
|
||||
submitProperty,
|
||||
propertyListRef,
|
||||
formData,
|
||||
onRDPickerConfirm,
|
||||
onPropertyConfirm,
|
||||
propertyList,
|
||||
showPropertyList,
|
||||
goodsPropertyList,
|
||||
changeSubProperty,
|
||||
getGoodsProperty,
|
||||
addPropertyValueClick,
|
||||
dialogInputPropertyValueConfirm,
|
||||
longPropertyValuePress,
|
||||
inputPropertyValueDialogRef,
|
||||
inputPropertyValueFormdata,
|
||||
propertyValueTitle,
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,68 +1,68 @@
|
|||
<template>
|
||||
<pb-layout
|
||||
class="goods-property"
|
||||
title="商品属性"
|
||||
leftIcon="leftIcon"
|
||||
navbar="normal"
|
||||
:bgStyle="bgStyle"
|
||||
opacityBgUi="bg-white"
|
||||
color="black"
|
||||
>
|
||||
<view class="property">
|
||||
<uni-forms ref="formRef" v-model="formData" :rules="rules" label-position="top" label-width="160">
|
||||
<uni-forms-item label="商品规格" @tap="pickerProperty" name="specType" label-position="left" required>
|
||||
<uni-easyinput
|
||||
type="text"
|
||||
:clearable="false"
|
||||
:styles="selfStyles"
|
||||
placeholderStyle="color:#8a8a8a"
|
||||
:inputBorder="false"
|
||||
v-model="formData.specText"
|
||||
placeholder="请选择商品规格"
|
||||
disabled
|
||||
>
|
||||
<template v-slot:right>
|
||||
<uni-icons type="right" />
|
||||
</template>
|
||||
</uni-easyinput>
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</view>
|
||||
<template v-if="formData.specType">
|
||||
<!-- 添加商品 -->
|
||||
<button v-if="canEdit" class="ss-reset-button add-property" @tap="showPropertyList">+添加规格</button>
|
||||
<!-- 商品属性展示 -->
|
||||
<property-detail
|
||||
v-if="propertyList.length > 0"
|
||||
v-model="propertyList"
|
||||
:goodsPropertyList="goodsPropertyList"
|
||||
@changeSubProperty="changeSubProperty"
|
||||
></property-detail>
|
||||
<!-- 多规格商品 -->
|
||||
<mutiple-sku :skus="skus"></mutiple-sku>
|
||||
</template>
|
||||
<pb-layout
|
||||
class="goods-property"
|
||||
title="商品属性"
|
||||
leftIcon="leftIcon"
|
||||
navbar="normal"
|
||||
:bgStyle="bgStyle"
|
||||
opacityBgUi="bg-white"
|
||||
color="black"
|
||||
>
|
||||
<view class="property">
|
||||
<uni-forms ref="formRef" v-model="formData" :rules="rules" label-position="top" label-width="160">
|
||||
<uni-forms-item label="商品规格" @tap="pickerProperty" name="specType" label-position="left" required>
|
||||
<uni-easyinput
|
||||
type="text"
|
||||
:clearable="false"
|
||||
:styles="selfStyles"
|
||||
placeholderStyle="color:#8a8a8a"
|
||||
:inputBorder="false"
|
||||
v-model="formData.specText"
|
||||
placeholder="请选择商品规格"
|
||||
disabled
|
||||
>
|
||||
<template v-slot:right>
|
||||
<uni-icons type="right" />
|
||||
</template>
|
||||
</uni-easyinput>
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</view>
|
||||
<template v-if="formData.specType">
|
||||
<!-- 添加商品 -->
|
||||
<button v-if="canEdit" class="ss-reset-button add-property" @tap="showPropertyList">选择规格</button>
|
||||
<!-- 商品属性展示 -->
|
||||
<property-detail
|
||||
v-if="propertyList.length > 0"
|
||||
v-model="propertyList"
|
||||
:goodsPropertyList="goodsPropertyList"
|
||||
@changeSubProperty="changeSubProperty"
|
||||
></property-detail>
|
||||
<!-- 多规格商品 -->
|
||||
<mutiple-sku :skus="skus"></mutiple-sku>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<!-- 单规格商品 -->
|
||||
<SkuItem :skus="skus" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<!-- 单规格商品 -->
|
||||
<SkuItem :skus="skus" />
|
||||
</template>
|
||||
|
||||
<!-- 确认选择 -->
|
||||
<view style="padding: 0 40rpx 40rpx" @tap="submitProperty" v-if="canEdit">
|
||||
<button class="ss-reset-button submit-button ui-Shadow-Main">保存</button>
|
||||
</view>
|
||||
<!-- 确认选择 -->
|
||||
<view style="padding: 0 40rpx 40rpx" @tap="submitProperty" v-if="canEdit">
|
||||
<button class="ss-reset-button submit-button ui-Shadow-Main">保存</button>
|
||||
</view>
|
||||
|
||||
<!-- 商品规格 -->
|
||||
<p-picker ref="pickerRef" mode="single" :options-cols="SPEC_TYPE" @confirm="onRDPickerConfirm"></p-picker>
|
||||
<!-- 商品规格 -->
|
||||
<p-picker ref="pickerRef" mode="single" :options-cols="SPEC_TYPE" @confirm="onRDPickerConfirm"></p-picker>
|
||||
|
||||
<!-- 商品属性列表 -->
|
||||
<PropertyList
|
||||
ref="propertyListRef"
|
||||
v-model="propertyList"
|
||||
:goodsPropertyList="goodsPropertyList"
|
||||
@confirm="onPropertyConfirm"
|
||||
/>
|
||||
</pb-layout>
|
||||
<!-- 商品属性列表 -->
|
||||
<PropertyList
|
||||
ref="propertyListRef"
|
||||
v-model="propertyList"
|
||||
:goodsPropertyList="goodsPropertyList"
|
||||
@confirm="onPropertyConfirm"
|
||||
/>
|
||||
</pb-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
@ -72,26 +72,26 @@ import PropertyList from './components/propertyList'
|
|||
import PropertyDetail from './components/propertyDetail'
|
||||
import { SPEC_TYPE } from './js/config'
|
||||
import {
|
||||
initial,
|
||||
canEdit,
|
||||
pickerRef,
|
||||
propertyListRef,
|
||||
onRDPickerConfirm,
|
||||
formData,
|
||||
propertyList,
|
||||
onPropertyConfirm,
|
||||
showPropertyList,
|
||||
goodsPropertyList,
|
||||
pickerProperty,
|
||||
skus,
|
||||
changeSubProperty,
|
||||
submitProperty,
|
||||
initial,
|
||||
canEdit,
|
||||
pickerRef,
|
||||
propertyListRef,
|
||||
onRDPickerConfirm,
|
||||
formData,
|
||||
propertyList,
|
||||
onPropertyConfirm,
|
||||
showPropertyList,
|
||||
goodsPropertyList,
|
||||
pickerProperty,
|
||||
skus,
|
||||
changeSubProperty,
|
||||
submitProperty,
|
||||
} from './js/sku'
|
||||
|
||||
const bgStyle = {
|
||||
backgroundImage: '',
|
||||
backgroundColor: '#fff',
|
||||
description: '',
|
||||
backgroundImage: '',
|
||||
backgroundColor: '#fff',
|
||||
description: '',
|
||||
}
|
||||
|
||||
initial()
|
||||
|
@ -99,57 +99,57 @@ initial()
|
|||
|
||||
<style lang="scss" scoped>
|
||||
.goods-property {
|
||||
.property {
|
||||
margin: 40rpx;
|
||||
.property {
|
||||
margin: 40rpx;
|
||||
|
||||
:deep() {
|
||||
.uni-easyinput__content-input {
|
||||
font-size: 28rpx !important;
|
||||
color: #333333 !important;
|
||||
line-height: normal !important;
|
||||
}
|
||||
:deep() {
|
||||
.uni-easyinput__content-input {
|
||||
font-size: 28rpx !important;
|
||||
color: #333333 !important;
|
||||
line-height: normal !important;
|
||||
}
|
||||
|
||||
.uni-easyinput__placeholder-class {
|
||||
font-size: 14px;
|
||||
}
|
||||
.uni-easyinput__placeholder-class {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.is-direction-left {
|
||||
.uni-forms-item__label {
|
||||
padding-left: 10px;
|
||||
background-color: #f9f9f9;
|
||||
border-radius: 10px 0 0 10px;
|
||||
}
|
||||
|
||||
uni-icons {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.uni-easyinput__content {
|
||||
border-radius: 0 10px 10px 0;
|
||||
}
|
||||
}
|
||||
|
||||
.is-disabled {
|
||||
color: #333333;
|
||||
text-align: right;
|
||||
}
|
||||
.is-direction-left {
|
||||
.uni-forms-item__label {
|
||||
padding-left: 10px;
|
||||
background-color: #f9f9f9;
|
||||
border-radius: 10px 0 0 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.add-property {
|
||||
margin: 40rpx;
|
||||
border: 1px dotted var(--ui-BG-Main);
|
||||
color: var(--ui-BG-Main);
|
||||
border-radius: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
uni-icons {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.submit-button {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
border-radius: 40rpx;
|
||||
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
|
||||
color: $white;
|
||||
.uni-easyinput__content {
|
||||
border-radius: 0 10px 10px 0;
|
||||
}
|
||||
}
|
||||
|
||||
.is-disabled {
|
||||
color: #333333;
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.add-property {
|
||||
margin: 40rpx;
|
||||
border: 1px dotted var(--ui-BG-Main);
|
||||
color: var(--ui-BG-Main);
|
||||
border-radius: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.submit-button {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
border-radius: 40rpx;
|
||||
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
|
||||
color: $white;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,47 +1,51 @@
|
|||
<!-- 文章展示 -->
|
||||
<template>
|
||||
<pb-layout class="set-wrap" :title="state.title" :bgStyle="{ color: '#FFF' }">
|
||||
<view class="ss-p-30">
|
||||
<mp-html class="richtext" :content="state.content" />
|
||||
</view>
|
||||
</pb-layout>
|
||||
<pb-layout class="set-wrap" :title="state.title" :bgStyle="{ color: '#FFF' }">
|
||||
<view class="ss-p-30">
|
||||
<mp-html class="richtext" :content="state.content" />
|
||||
</view>
|
||||
</pb-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import ArticleApi from '@/peach/api/promotion/article'
|
||||
import { reactive } from 'vue'
|
||||
|
||||
const state = reactive({
|
||||
title: '',
|
||||
content: '',
|
||||
title: '',
|
||||
content: '',
|
||||
})
|
||||
|
||||
async function getRichTextContent(id, title) {
|
||||
// 获取文章配置
|
||||
// state.content = data.content;
|
||||
// 标题不一致时,修改标题
|
||||
// if (state.title !== data.title) {
|
||||
// state.title = data.title;
|
||||
// uni.setNavigationBarTitle({
|
||||
// title: state.title,
|
||||
// });
|
||||
// }
|
||||
const { code, data } = await ArticleApi.getArticle(id, title)
|
||||
if (code !== 0) {
|
||||
return
|
||||
}
|
||||
state.content = data.content
|
||||
// 标题不一致时,修改标题
|
||||
if (state.title !== data.title) {
|
||||
state.title = data.title
|
||||
uni.setNavigationBarTitle({
|
||||
title: state.title,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
if (options.title) {
|
||||
state.title = options.title
|
||||
uni.setNavigationBarTitle({
|
||||
title: state.title,
|
||||
})
|
||||
}
|
||||
// getRichTextContent(options.id, options.title);
|
||||
if (options.title) {
|
||||
state.title = options.title
|
||||
uni.setNavigationBarTitle({
|
||||
title: state.title,
|
||||
})
|
||||
}
|
||||
getRichTextContent(options.id, options.title)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.set-title {
|
||||
margin: 0 30rpx;
|
||||
margin: 0 30rpx;
|
||||
}
|
||||
|
||||
.richtext {
|
||||
|
|
|
@ -1,176 +1,224 @@
|
|||
<template>
|
||||
<pb-layout
|
||||
navbar="inner"
|
||||
iconColor="#fff"
|
||||
class="buy-point-wrap"
|
||||
leftIcon="leftIcon"
|
||||
color="#fff"
|
||||
title="购买积分"
|
||||
:bgStyle="bgStyle"
|
||||
>
|
||||
<view class="title ss-m-t-80">
|
||||
<view class="main">购买商城积分</view>
|
||||
<view class="sub ss-flex ss-row-center ss-m-t-55"
|
||||
><text style="color: #f3d3bf" class="cicon-safe"></text>订单多多·出单多多<text
|
||||
style="color: #f3d3bf"
|
||||
class="cicon-safe"
|
||||
></text
|
||||
></view>
|
||||
</view>
|
||||
<pb-layout
|
||||
navbar="inner"
|
||||
iconColor="#fff"
|
||||
class="buy-point-wrap"
|
||||
leftIcon="leftIcon"
|
||||
color="#fff"
|
||||
title="购买积分"
|
||||
:bgStyle="bgStyle"
|
||||
>
|
||||
<view class="title ss-m-t-80">
|
||||
<view class="main">购买商城积分</view>
|
||||
<view class="sub ss-flex ss-row-center ss-m-t-55"
|
||||
><text style="color: #f3d3bf" class="cicon-safe"></text>订单多多·出单多多<text
|
||||
style="color: #f3d3bf"
|
||||
class="cicon-safe"
|
||||
></text
|
||||
></view>
|
||||
</view>
|
||||
|
||||
<view class="middle ss-m-t-150 ss-flex-col ss-row-center ss-col-center ss-gap-40">
|
||||
<view class="title">积分额度选择</view>
|
||||
<view class="sub">专属您的积分</view>
|
||||
</view>
|
||||
<view class="middle ss-m-t-150 ss-flex-col ss-row-center ss-col-center ss-gap-40">
|
||||
<view class="title">积分额度选择</view>
|
||||
<view class="sub">专属您的积分</view>
|
||||
</view>
|
||||
|
||||
<view class="combo ss-m-t-90 ss-m-b-50 ss-p-x-40">
|
||||
<button class="ss-reset-button draw-btn ui-Shadow-Main">购买5000积分/50元</button>
|
||||
<button class="ss-reset-button draw-btn-raw ui-Shadow-Main">购买5000积分/50元</button>
|
||||
</view>
|
||||
<view class="combo ss-m-t-90 ss-m-b-50 ss-p-x-40">
|
||||
<template v-for="(item, index) in state.pointList">
|
||||
<button
|
||||
:class="['ss-reset-button', state.currentIndex === index ? 'draw-btn' : 'draw-btn-raw', 'ui-Shadow-Main']"
|
||||
@click="chooseItemClick(index)"
|
||||
>
|
||||
{{ `购买${item.point}积分/${item.price}元` }}
|
||||
</button>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
<view class="agreement-box ss-flex ss-row-center" :class="{ shake: state.isShaking }">
|
||||
<label class="radio ss-flex" @tap="onChange">
|
||||
<radio
|
||||
:checked="state.agreeStatus"
|
||||
color="rgba(243, 192, 156, 1)"
|
||||
style="transform: scale(0.8)"
|
||||
@tap.stop="onChange"
|
||||
/>
|
||||
<view class="agreement-text ss-flex ss-m-l-8">
|
||||
我已阅读并遵守
|
||||
<view class="tcp-text" @tap.stop="onProtocol('积分须知')"> 《积分须知》 </view>
|
||||
</view>
|
||||
</label>
|
||||
<view class="agreement-box ss-flex ss-row-center" :class="{ shake: state.isShaking }">
|
||||
<label class="radio ss-flex" @tap="onChange">
|
||||
<radio
|
||||
:checked="state.agreeStatus"
|
||||
color="rgba(243, 192, 156, 1)"
|
||||
style="transform: scale(0.8)"
|
||||
@tap.stop="onChange"
|
||||
/>
|
||||
<view class="agreement-text ss-flex ss-m-l-8">
|
||||
我已阅读并遵守
|
||||
<view class="tcp-text" @tap.stop="onProtocol('积分须知')"> 《积分须知》 </view>
|
||||
</view>
|
||||
</pb-layout>
|
||||
</label>
|
||||
</view>
|
||||
</pb-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import PointApi from '@/peach/api/pay/point'
|
||||
import peach from '@/peach'
|
||||
|
||||
const state = ref({
|
||||
isShaking: false,
|
||||
agreeStatus: false,
|
||||
isShaking: false,
|
||||
agreeStatus: false,
|
||||
pointList: [],
|
||||
currentIndex: -1,
|
||||
})
|
||||
|
||||
const bgStyle = {
|
||||
backgroundImage: '/static/point.png',
|
||||
imageType: 'local',
|
||||
backgroundColor: '#fff',
|
||||
description: '',
|
||||
height: '100%',
|
||||
backgroundImage: '/static/point.png',
|
||||
imageType: 'local',
|
||||
backgroundColor: '#fff',
|
||||
description: '',
|
||||
height: '100%',
|
||||
}
|
||||
|
||||
function onProtocol(title) {}
|
||||
function onProtocol() {
|
||||
peach.$router.go('/pages/public/richtext?title=积分须知')
|
||||
}
|
||||
|
||||
function getPointConfig() {
|
||||
PointApi.getPointConfig().then((res) => {
|
||||
if (res.data.packagePoint) state.value.pointList = JSON.parse(res.data.packagePoint)
|
||||
})
|
||||
}
|
||||
|
||||
function onChange() {
|
||||
state.value.agreeStatus = !state.value.agreeStatus
|
||||
}
|
||||
|
||||
function chooseItemClick(index) {
|
||||
if (!state.value.agreeStatus) {
|
||||
state.value.isShaking = true
|
||||
setTimeout(() => {
|
||||
state.value.isShaking = false
|
||||
}, 1000)
|
||||
peach.$helper.toast('请勾选同意积分须知')
|
||||
return
|
||||
}
|
||||
|
||||
state.value.currentIndex = index
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认购买该积分额度?',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
getPointConfig()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.buy-point-wrap {
|
||||
.title {
|
||||
.main {
|
||||
font-size: 80rpx;
|
||||
color: rgba(232, 181, 150, 1);
|
||||
letter-spacing: 20px;
|
||||
position: relative;
|
||||
left: 20px;
|
||||
}
|
||||
|
||||
.sub {
|
||||
font-size: 32rpx;
|
||||
color: #f3d3bf;
|
||||
letter-spacing: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.middle {
|
||||
.title {
|
||||
.main {
|
||||
font-size: 80rpx;
|
||||
color: rgba(232, 181, 150, 1);
|
||||
letter-spacing: 20px;
|
||||
position: relative;
|
||||
left: 20px;
|
||||
}
|
||||
|
||||
.sub {
|
||||
font-size: 32rpx;
|
||||
color: #f3d3bf;
|
||||
letter-spacing: 4px;
|
||||
}
|
||||
font-size: 39rpx;
|
||||
color: #fccdb1;
|
||||
}
|
||||
|
||||
.middle {
|
||||
.title {
|
||||
font-size: 39rpx;
|
||||
color: #fccdb1;
|
||||
}
|
||||
|
||||
.title::before {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 80px;
|
||||
position: relative;
|
||||
left: -100px;
|
||||
top: 14px;
|
||||
border-bottom: 1px dotted #e7b493;
|
||||
}
|
||||
|
||||
.title::after {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 80px;
|
||||
position: relative;
|
||||
left: 130px;
|
||||
top: -12px;
|
||||
border-bottom: 1px dotted #e7b493;
|
||||
}
|
||||
|
||||
.sub {
|
||||
background-color: #e7b493;
|
||||
border-radius: 18rpx;
|
||||
border: 1px solid #979797;
|
||||
letter-spacing: 5px;
|
||||
padding: 0 10rpx 0 18rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.title::before {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 80px;
|
||||
position: relative;
|
||||
left: -100px;
|
||||
top: 14px;
|
||||
border-bottom: 1px dotted #e7b493;
|
||||
}
|
||||
|
||||
.combo {
|
||||
.draw-btn {
|
||||
height: 82rpx;
|
||||
line-height: normal;
|
||||
background: linear-gradient(-90deg, rgba(230, 179, 147, 1), rgba(250, 232, 218, 1));
|
||||
border-radius: 28rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.draw-btn-raw {
|
||||
height: 82rpx;
|
||||
line-height: normal;
|
||||
background: transparent;
|
||||
border-radius: 28rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #e7b493;
|
||||
border: 1px solid #e7b493;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.title::after {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 80px;
|
||||
position: relative;
|
||||
left: 130px;
|
||||
top: -12px;
|
||||
border-bottom: 1px dotted #e7b493;
|
||||
}
|
||||
|
||||
.agreement-box {
|
||||
width: 100%;
|
||||
.sub {
|
||||
background-color: #e7b493;
|
||||
border-radius: 18rpx;
|
||||
border: 1px solid #979797;
|
||||
letter-spacing: 5px;
|
||||
padding: 0 10rpx 0 18rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.protocol-check {
|
||||
transform: scale(0.7);
|
||||
}
|
||||
|
||||
.agreement-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #999999;
|
||||
|
||||
.tcp-text {
|
||||
color: rgba(243, 192, 156, 1);
|
||||
}
|
||||
}
|
||||
.combo {
|
||||
.draw-btn {
|
||||
height: 82rpx;
|
||||
line-height: normal;
|
||||
background: linear-gradient(-90deg, rgba(230, 179, 147, 1), rgba(250, 232, 218, 1));
|
||||
border-radius: 28rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.shake {
|
||||
animation: shake 0.05s linear 4 alternate;
|
||||
.draw-btn-raw {
|
||||
height: 82rpx;
|
||||
line-height: normal;
|
||||
background: transparent;
|
||||
border-radius: 28rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #e7b493;
|
||||
border: 1px solid #e7b493;
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.agreement-box {
|
||||
width: 100%;
|
||||
|
||||
.protocol-check {
|
||||
transform: scale(0.7);
|
||||
}
|
||||
|
||||
@keyframes shake {
|
||||
from {
|
||||
transform: translateX(-5rpx);
|
||||
}
|
||||
.agreement-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #999999;
|
||||
|
||||
to {
|
||||
transform: translateX(5rpx);
|
||||
}
|
||||
.tcp-text {
|
||||
color: rgba(243, 192, 156, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.shake {
|
||||
animation: shake 0.05s linear 4 alternate;
|
||||
}
|
||||
|
||||
@keyframes shake {
|
||||
from {
|
||||
transform: translateX(-5rpx);
|
||||
}
|
||||
|
||||
to {
|
||||
transform: translateX(5rpx);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,68 +1,68 @@
|
|||
<template>
|
||||
<pb-layout
|
||||
navbar="inner"
|
||||
iconColor="#fff"
|
||||
class="share-point-wrap"
|
||||
leftIcon="leftIcon"
|
||||
color="#fff"
|
||||
title="分发积分"
|
||||
right="历史积分"
|
||||
:bgStyle="bgStyle"
|
||||
>
|
||||
<view class="title ss-m-t-80">
|
||||
<view class="main">分发积分</view>
|
||||
<view class="sub ss-flex ss-row-center ss-m-t-55"
|
||||
><text style="color: #f3d3bf" class="cicon-safe"></text>订单多多·出单多多<text
|
||||
style="color: #f3d3bf"
|
||||
class="cicon-safe"
|
||||
></text
|
||||
></view>
|
||||
</view>
|
||||
<pb-layout
|
||||
navbar="inner"
|
||||
iconColor="#fff"
|
||||
class="share-point-wrap"
|
||||
leftIcon="leftIcon"
|
||||
color="#fff"
|
||||
title="分发积分"
|
||||
right="历史积分"
|
||||
:bgStyle="bgStyle"
|
||||
>
|
||||
<view class="title ss-m-t-80">
|
||||
<view class="main">分发积分</view>
|
||||
<view class="sub ss-flex ss-row-center ss-m-t-55"
|
||||
><text style="color: #f3d3bf" class="cicon-safe"></text>订单多多·出单多多<text
|
||||
style="color: #f3d3bf"
|
||||
class="cicon-safe"
|
||||
></text
|
||||
></view>
|
||||
</view>
|
||||
|
||||
<view class="user-search">
|
||||
<view class="search">
|
||||
<uni-easyinput
|
||||
v-model="state.inputData"
|
||||
:styles="{ backgroundColor: 'transparent', color: '#E7B493' }"
|
||||
placeholderStyle="color: #E7B493;"
|
||||
@input="inputUserFunc"
|
||||
:clearable="false"
|
||||
:inputBorder="false"
|
||||
trim="all"
|
||||
suffixIcon="search"
|
||||
placeholder="请输入用户名/手机号"
|
||||
/>
|
||||
</view>
|
||||
<view class="result" :style="{ height: resultHeight, overflow: 'auto' }">
|
||||
<view v-for="item in state.userList" class="user ss-flex ss-row-between ss-col-center">
|
||||
<view class="user-info ss-flex ss-col-center ss-gap-20">
|
||||
<image
|
||||
style="width: 48rpx; height: 48rpx; border-radius: 50%"
|
||||
:src="item.avatar ? item.avatar : '/static/default_avatar.png'"
|
||||
/>
|
||||
<view class="nickname">{{ item.nickname }}</view>
|
||||
</view>
|
||||
<view class="input-point">
|
||||
<uni-easyinput
|
||||
:styles="{ backgroundColor: 'transparent', color: '#E7B493' }"
|
||||
:placeholderStyle="placeholderStyle"
|
||||
v-model="item.point"
|
||||
:clearable="false"
|
||||
:inputBorder="false"
|
||||
@input="inputPointFunc(item)"
|
||||
type="number"
|
||||
trim="all"
|
||||
placeholder="请输入积分额度"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="user-search">
|
||||
<view class="search">
|
||||
<uni-easyinput
|
||||
v-model="state.inputData"
|
||||
:styles="{ backgroundColor: 'transparent', color: '#E7B493' }"
|
||||
placeholderStyle="color: #E7B493;"
|
||||
@input="inputUserFunc"
|
||||
:clearable="false"
|
||||
:inputBorder="false"
|
||||
trim="all"
|
||||
suffixIcon="search"
|
||||
placeholder="请输入用户名/手机号"
|
||||
/>
|
||||
</view>
|
||||
<view class="result" :style="{ height: resultHeight, overflow: 'auto' }">
|
||||
<view v-for="item in state.userList" class="user ss-flex ss-row-between ss-col-center">
|
||||
<view class="user-info ss-flex ss-col-center ss-gap-20">
|
||||
<image
|
||||
style="width: 48rpx; height: 48rpx; border-radius: 50%"
|
||||
:src="item.avatar ? item.avatar : '/static/default_avatar.png'"
|
||||
/>
|
||||
<view class="nickname">{{ item.nickname }}</view>
|
||||
</view>
|
||||
<view class="input-point">
|
||||
<uni-easyinput
|
||||
:styles="{ backgroundColor: 'transparent', color: '#E7B493' }"
|
||||
:placeholderStyle="placeholderStyle"
|
||||
v-model="item.point"
|
||||
:clearable="false"
|
||||
:inputBorder="false"
|
||||
@input="inputPointFunc(item)"
|
||||
type="number"
|
||||
trim="all"
|
||||
placeholder="请输入积分额度"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="ss-p-x-30 bottom">
|
||||
<button class="ss-reset-button share-btn" @tap="confirmShare">确定</button>
|
||||
</view>
|
||||
</pb-layout>
|
||||
<view class="ss-p-x-30 bottom">
|
||||
<button class="ss-reset-button share-btn" @tap="confirmShare">确定</button>
|
||||
</view>
|
||||
</pb-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
@ -74,171 +74,171 @@ import peach from '@/peach'
|
|||
const placeholderStyle = ref('color: #E7B493')
|
||||
|
||||
const resultHeight = computed(() => {
|
||||
return `calc(100vh - 728rpx)`
|
||||
return `calc(100vh - 728rpx)`
|
||||
})
|
||||
|
||||
const state = ref({
|
||||
inputData: '',
|
||||
userList: [],
|
||||
isShaking: false,
|
||||
agreeStatus: false,
|
||||
userParams: {
|
||||
mobile: '',
|
||||
nickname: '',
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
pointParams: {
|
||||
memberId: '',
|
||||
point: '',
|
||||
},
|
||||
inputData: '',
|
||||
userList: [],
|
||||
isShaking: false,
|
||||
agreeStatus: false,
|
||||
userParams: {
|
||||
mobile: '',
|
||||
nickname: '',
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
pointParams: {
|
||||
memberId: '',
|
||||
point: '',
|
||||
},
|
||||
})
|
||||
|
||||
const bgStyle = {
|
||||
backgroundImage: '/static/point.png',
|
||||
imageType: 'local',
|
||||
backgroundColor: '#fff',
|
||||
description: '',
|
||||
height: '100%',
|
||||
backgroundImage: '/static/point.png',
|
||||
imageType: 'local',
|
||||
backgroundColor: '#fff',
|
||||
description: '',
|
||||
height: '100%',
|
||||
}
|
||||
|
||||
let timer
|
||||
function inputUserFunc() {
|
||||
clearTimeout(timer)
|
||||
timer = setTimeout(() => {
|
||||
getUserList()
|
||||
}, 1000)
|
||||
clearTimeout(timer)
|
||||
timer = setTimeout(() => {
|
||||
getUserList()
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
async function confirmShare() {
|
||||
let user = state.value.userList.find((item) => item.point)
|
||||
let user = state.value.userList.find((item) => item.point)
|
||||
|
||||
if (!user) {
|
||||
peach.$helper.toast('请输入要赠送的积分')
|
||||
return
|
||||
}
|
||||
if (!user) {
|
||||
peach.$helper.toast('请选择需要赠送积分的用户')
|
||||
return
|
||||
}
|
||||
|
||||
state.value.pointParams.memberId = user.id
|
||||
state.value.pointParams.point = user.point
|
||||
state.value.pointParams.memberId = user.id
|
||||
state.value.pointParams.point = user.point
|
||||
|
||||
await PointApi.sendPoint(state.value.pointParams)
|
||||
await PointApi.sendPoint(state.value.pointParams)
|
||||
|
||||
state.value.inputData = ''
|
||||
state.value.userList = []
|
||||
state.value.pointParams = {
|
||||
memberId: '',
|
||||
point: '',
|
||||
}
|
||||
state.value.inputData = ''
|
||||
state.value.userList = []
|
||||
state.value.pointParams = {
|
||||
memberId: '',
|
||||
point: '',
|
||||
}
|
||||
}
|
||||
|
||||
function inputPointFunc(data) {
|
||||
state.value.userList.forEach((item) => {
|
||||
console.log(data.id !== item.id)
|
||||
if (data.id !== item.id) {
|
||||
item.point = ''
|
||||
}
|
||||
})
|
||||
state.value.userList.forEach((item) => {
|
||||
console.log(data.id !== item.id)
|
||||
if (data.id !== item.id) {
|
||||
item.point = ''
|
||||
}
|
||||
})
|
||||
|
||||
// state.value.pointParams.memberId = data.id
|
||||
// state.value.pointParams.point = data.point
|
||||
// state.value.pointParams.memberId = data.id
|
||||
// state.value.pointParams.point = data.point
|
||||
}
|
||||
|
||||
async function getUserList() {
|
||||
// 清空 userParams 数据
|
||||
state.value.userParams = {
|
||||
mobile: '',
|
||||
nickname: '',
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
}
|
||||
// 判断 inputData 的输入类型
|
||||
// 如果 string 是纯数字
|
||||
if (/^\d+$/.test(state.value.inputData)) {
|
||||
state.value.userParams.mobile = state.value.inputData
|
||||
} else {
|
||||
state.value.userParams.nickname = state.value.inputData
|
||||
}
|
||||
// 清空 userParams 数据
|
||||
state.value.userParams = {
|
||||
mobile: '',
|
||||
nickname: '',
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
}
|
||||
// 判断 inputData 的输入类型
|
||||
// 如果 string 是纯数字
|
||||
if (/^\d+$/.test(state.value.inputData)) {
|
||||
state.value.userParams.mobile = state.value.inputData
|
||||
} else {
|
||||
state.value.userParams.nickname = state.value.inputData
|
||||
}
|
||||
|
||||
let { data } = await UserUtil.getUserList(state.value.userParams)
|
||||
data.list.forEach((item) => {
|
||||
item.point = ''
|
||||
})
|
||||
state.value.userList = data.list
|
||||
let { data } = await UserUtil.getUserList(state.value.userParams)
|
||||
data.list.forEach((item) => {
|
||||
item.point = ''
|
||||
})
|
||||
state.value.userList = data.list
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.share-point-wrap {
|
||||
.title {
|
||||
.main {
|
||||
font-size: 80rpx;
|
||||
color: rgba(232, 181, 150, 1);
|
||||
letter-spacing: 20px;
|
||||
position: relative;
|
||||
left: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.sub {
|
||||
font-size: 32rpx;
|
||||
color: #f3d3bf;
|
||||
letter-spacing: 4px;
|
||||
}
|
||||
.title {
|
||||
.main {
|
||||
font-size: 80rpx;
|
||||
color: rgba(232, 181, 150, 1);
|
||||
letter-spacing: 20px;
|
||||
position: relative;
|
||||
left: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.user-search {
|
||||
margin: 50rpx 40rpx 0;
|
||||
.sub {
|
||||
font-size: 32rpx;
|
||||
color: #f3d3bf;
|
||||
letter-spacing: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.search {
|
||||
border: 1px solid #e7b493;
|
||||
border-radius: 30px;
|
||||
}
|
||||
.user-search {
|
||||
margin: 50rpx 40rpx 0;
|
||||
|
||||
:deep(.uniui-search) {
|
||||
color: #e7b493 !important;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
:deep(.uni-easyinput__content-input) {
|
||||
padding-left: 15px !important;
|
||||
}
|
||||
|
||||
.result {
|
||||
.user {
|
||||
margin-top: 20px;
|
||||
border: 1px solid #e7b493;
|
||||
border-radius: 30px;
|
||||
padding: 0 40rpx;
|
||||
|
||||
.user-info {
|
||||
.nickname {
|
||||
font-size: 26rpx;
|
||||
color: #e7b493;
|
||||
}
|
||||
}
|
||||
|
||||
.input-point {
|
||||
:deep(.uni-easyinput__content-input) {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.search {
|
||||
border: 1px solid #e7b493;
|
||||
border-radius: 30px;
|
||||
}
|
||||
|
||||
.bottom {
|
||||
position: absolute;
|
||||
bottom: 20px;
|
||||
width: calc(100% - 60rpx);
|
||||
:deep(.uniui-search) {
|
||||
color: #e7b493 !important;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.share-btn {
|
||||
height: 82rpx;
|
||||
line-height: normal;
|
||||
background: linear-gradient(-90deg, rgba(230, 179, 147, 1), rgba(250, 232, 218, 1));
|
||||
border-radius: 28rpx;
|
||||
:deep(.uni-easyinput__content-input) {
|
||||
padding-left: 15px !important;
|
||||
}
|
||||
|
||||
.result {
|
||||
.user {
|
||||
margin-top: 20px;
|
||||
border: 1px solid #e7b493;
|
||||
border-radius: 30px;
|
||||
padding: 0 40rpx;
|
||||
|
||||
.user-info {
|
||||
.nickname {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
color: #e7b493;
|
||||
}
|
||||
}
|
||||
|
||||
.input-point {
|
||||
:deep(.uni-easyinput__content-input) {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bottom {
|
||||
position: absolute;
|
||||
bottom: 20px;
|
||||
width: calc(100% - 60rpx);
|
||||
|
||||
.share-btn {
|
||||
height: 82rpx;
|
||||
line-height: normal;
|
||||
background: linear-gradient(-90deg, rgba(230, 179, 147, 1), rgba(250, 232, 218, 1));
|
||||
border-radius: 28rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
import request from '@/peach/request'
|
||||
|
||||
const PointApi = {
|
||||
/**
|
||||
* @author Ankkaya
|
||||
* @description 分发积分
|
||||
* @param {String} memberId - 用户 id
|
||||
* @param {Number} point - 积分
|
||||
* @returns {Type}
|
||||
*/
|
||||
sendPoint: (data) => {
|
||||
return request({
|
||||
url: '/particulars/point/send-member',
|
||||
method: 'post',
|
||||
data,
|
||||
custom: {
|
||||
showSuccess: true,
|
||||
successMsg: '赠送成功',
|
||||
},
|
||||
})
|
||||
},
|
||||
/**
|
||||
* @author Ankkaya
|
||||
* @description 分发积分
|
||||
* @param {String} memberId - 用户 id
|
||||
* @param {Number} point - 积分
|
||||
* @returns {Type}
|
||||
*/
|
||||
sendPoint: (data) => {
|
||||
return request({
|
||||
url: '/particulars/point/send-member',
|
||||
method: 'post',
|
||||
data,
|
||||
custom: {
|
||||
showSuccess: true,
|
||||
successMsg: '赠送成功',
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
getPointList: (data) => {
|
||||
return request({
|
||||
url: '/particulars/point/page-record',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
},
|
||||
// 获取积分配置信息
|
||||
getPointConfig: () => {
|
||||
return request({
|
||||
url: '/particulars/point/get-config',
|
||||
method: 'get',
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
export default PointApi
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
import request from '@/peach/request'
|
||||
|
||||
export default {
|
||||
// 获得文章详情
|
||||
getArticle: (id, title) => {
|
||||
return request({
|
||||
url: '/promotion/article/get',
|
||||
method: 'GET',
|
||||
params: { id, title },
|
||||
custom: {
|
||||
auth: false,
|
||||
},
|
||||
})
|
||||
},
|
||||
}
|
|
@ -1,76 +1,142 @@
|
|||
import request from '@/peach/request'
|
||||
|
||||
const GoodsApi = {
|
||||
// 商品列表
|
||||
getProductList: (data) => {
|
||||
return request({
|
||||
url: '/product/spu/page',
|
||||
method: 'GET',
|
||||
params: data,
|
||||
})
|
||||
},
|
||||
// 商品详情 spuIds
|
||||
getProduct: (data) => {
|
||||
return request({
|
||||
url: '/product/spu/get-detail',
|
||||
method: 'GET',
|
||||
params: data,
|
||||
})
|
||||
},
|
||||
// 添加商品
|
||||
addProduct: (data) => {
|
||||
return request({
|
||||
url: '/product/spu/create',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
},
|
||||
// 修改商品
|
||||
editProduct: (data) => {
|
||||
return request({
|
||||
url: '/product/spu/update',
|
||||
method: 'PUT',
|
||||
data,
|
||||
})
|
||||
},
|
||||
// 删除商品
|
||||
delProduct: (data) => {
|
||||
return request({
|
||||
url: '/product/spu/delete',
|
||||
method: 'DELETE',
|
||||
params: data,
|
||||
})
|
||||
},
|
||||
// 商品分类
|
||||
getGoodsCategory: (data) => {
|
||||
return request({
|
||||
url: '/product/category/list',
|
||||
method: 'GET',
|
||||
params: data,
|
||||
})
|
||||
},
|
||||
// 商品品牌
|
||||
getBrand: (data) => {
|
||||
return request({
|
||||
url: '/product/brand/list',
|
||||
method: 'GET',
|
||||
params: data,
|
||||
})
|
||||
},
|
||||
// 历史属性
|
||||
getHistoryProperty: () => {
|
||||
return request({
|
||||
url: '/product/property/history-list',
|
||||
method: 'GET',
|
||||
})
|
||||
},
|
||||
getPropertyList: (data) => {
|
||||
return request({
|
||||
url: '/product/property/get',
|
||||
method: 'GET',
|
||||
params: data,
|
||||
})
|
||||
},
|
||||
// 商品列表
|
||||
getProductList: (data) => {
|
||||
return request({
|
||||
url: '/product/spu/page',
|
||||
method: 'GET',
|
||||
params: data,
|
||||
})
|
||||
},
|
||||
// 商品详情 spuIds
|
||||
getProduct: (data) => {
|
||||
return request({
|
||||
url: '/product/spu/get-detail',
|
||||
method: 'GET',
|
||||
params: data,
|
||||
})
|
||||
},
|
||||
// 添加商品
|
||||
addProduct: (data) => {
|
||||
return request({
|
||||
url: '/product/spu/create',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
},
|
||||
// 修改商品
|
||||
editProduct: (data) => {
|
||||
return request({
|
||||
url: '/product/spu/update',
|
||||
method: 'PUT',
|
||||
data,
|
||||
})
|
||||
},
|
||||
// 删除商品
|
||||
delProduct: (data) => {
|
||||
return request({
|
||||
url: '/product/spu/delete',
|
||||
method: 'DELETE',
|
||||
params: data,
|
||||
})
|
||||
},
|
||||
// 商品分类
|
||||
getGoodsCategory: (data) => {
|
||||
return request({
|
||||
url: '/product/category/list',
|
||||
method: 'GET',
|
||||
params: data,
|
||||
})
|
||||
},
|
||||
// 商品品牌
|
||||
getBrand: (data) => {
|
||||
return request({
|
||||
url: '/product/brand/list',
|
||||
method: 'GET',
|
||||
params: data,
|
||||
})
|
||||
},
|
||||
// 历史属性
|
||||
getHistoryProperty: () => {
|
||||
return request({
|
||||
url: '/product/property/history-list',
|
||||
method: 'GET',
|
||||
})
|
||||
},
|
||||
getPropertyList: (data) => {
|
||||
return request({
|
||||
url: '/product/property/get',
|
||||
method: 'GET',
|
||||
params: data,
|
||||
})
|
||||
},
|
||||
// 创建商品属性项
|
||||
createProperty: (data) => {
|
||||
return request({
|
||||
url: '/product/property/create',
|
||||
method: 'POST',
|
||||
data,
|
||||
custom: {
|
||||
successMsg: '新增成功',
|
||||
},
|
||||
})
|
||||
},
|
||||
// 修改商品属性项
|
||||
editProperty: (data) => {
|
||||
return request({
|
||||
url: '/product/property/update',
|
||||
method: 'PUT',
|
||||
data,
|
||||
custom: {
|
||||
successMsg: '修改成功',
|
||||
},
|
||||
})
|
||||
},
|
||||
// 删除商品属性项
|
||||
delProperty: (data) => {
|
||||
return request({
|
||||
url: '/product/property/delete',
|
||||
method: 'DELETE',
|
||||
params: data,
|
||||
custom: {
|
||||
successMsg: '删除成功',
|
||||
},
|
||||
})
|
||||
},
|
||||
// 创建商品属性值
|
||||
createPropertyValue: (data) => {
|
||||
return request({
|
||||
url: '/property/value/create',
|
||||
method: 'POST',
|
||||
data,
|
||||
custom: {
|
||||
successMsg: '新增成功',
|
||||
},
|
||||
})
|
||||
},
|
||||
// 删除商品属性值
|
||||
delPropertyValue: (data) => {
|
||||
return request({
|
||||
url: '/property/value/delete',
|
||||
method: 'DELETE',
|
||||
params: data,
|
||||
custom: {
|
||||
successMsg: '删除成功',
|
||||
},
|
||||
})
|
||||
},
|
||||
// 修改商品属性值
|
||||
editPropertyValue: (data) => {
|
||||
return request({
|
||||
url: '/property/value/update',
|
||||
method: 'PUT',
|
||||
data,
|
||||
custom: {
|
||||
successMsg: '修改成功',
|
||||
},
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
export default GoodsApi
|
||||
|
|
|
@ -120,9 +120,9 @@ export function getSmsCode(event, mobile) {
|
|||
}
|
||||
|
||||
AuthUtil.sendSmsCode(mobile, scene).then((res) => {
|
||||
// if (res.code === 0) {
|
||||
// modalStore.lastTimer[event] = dayjs().unix()
|
||||
// }
|
||||
if (res.code === 0) {
|
||||
modalStore.lastTimer[event] = dayjs().unix()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -5,177 +5,171 @@ import $router from '@/peach/router'
|
|||
import useSysStore from './sys'
|
||||
|
||||
const useAppStore = defineStore(
|
||||
'app',
|
||||
() => {
|
||||
/**
|
||||
* @description 应用信息
|
||||
* @param string name 应用名称
|
||||
* @param string logo 应用logo
|
||||
* @param string version 应用版本
|
||||
* @param string copyright 版权信息
|
||||
* @param string copyrightTime 版权时间
|
||||
* @param string cdnurl 静态资源域名
|
||||
* @param string filesystem 文件系统
|
||||
*/
|
||||
const info = ref({
|
||||
name: '',
|
||||
logo: '',
|
||||
version: '',
|
||||
copyright: '',
|
||||
copytime: '',
|
||||
cdnurl: '',
|
||||
filesystem: '',
|
||||
})
|
||||
'app',
|
||||
() => {
|
||||
/**
|
||||
* @description 应用信息
|
||||
* @param string name 应用名称
|
||||
* @param string logo 应用logo
|
||||
* @param string version 应用版本
|
||||
* @param string copyright 版权信息
|
||||
* @param string copyrightTime 版权时间
|
||||
* @param string cdnurl 静态资源域名
|
||||
* @param string filesystem 文件系统
|
||||
*/
|
||||
const info = ref({
|
||||
name: '',
|
||||
logo: '',
|
||||
version: '',
|
||||
copyright: '',
|
||||
copytime: '',
|
||||
cdnurl: '',
|
||||
filesystem: '',
|
||||
})
|
||||
|
||||
/**
|
||||
* @description 平台信息
|
||||
* @param Array share.methods 分享方式
|
||||
* @param Object share.forwardInfo 转发信息
|
||||
* @param Object share.posterInfo 海报信息
|
||||
* @param string share.linkAddress 分享链接地址
|
||||
* @param number bindMobile 绑定手机号提醒 0: 提醒 1: 不提醒
|
||||
*/
|
||||
const platform = ref({
|
||||
share: {
|
||||
methods: [],
|
||||
forwardInfo: {},
|
||||
posterInfo: {},
|
||||
linkAddress: '',
|
||||
/**
|
||||
* @description 平台信息
|
||||
* @param Array share.methods 分享方式
|
||||
* @param Object share.forwardInfo 转发信息
|
||||
* @param Object share.posterInfo 海报信息
|
||||
* @param string share.linkAddress 分享链接地址
|
||||
* @param number bindMobile 绑定手机号提醒 0: 提醒 1: 不提醒
|
||||
*/
|
||||
const platform = ref({
|
||||
share: {
|
||||
methods: [],
|
||||
forwardInfo: {},
|
||||
posterInfo: {},
|
||||
linkAddress: '',
|
||||
},
|
||||
bindMobile: 0,
|
||||
})
|
||||
|
||||
const chat = ref({})
|
||||
|
||||
/**
|
||||
* @description 模板信息
|
||||
* @param Object basic 基础模板
|
||||
* @param Object tabbar 底部导航模板
|
||||
*/
|
||||
const template = ref({
|
||||
basic: {
|
||||
tabbar: {
|
||||
items: [
|
||||
{
|
||||
activeIconUrl: '/static/a-index.png',
|
||||
iconUrl: '/static/index.png',
|
||||
text: '首页',
|
||||
url: '/pages/index/index',
|
||||
},
|
||||
bindMobile: 0,
|
||||
})
|
||||
|
||||
const chat = ref({})
|
||||
|
||||
/**
|
||||
* @description 模板信息
|
||||
* @param Object basic 基础模板
|
||||
* @param Object tabbar 底部导航模板
|
||||
*/
|
||||
const template = ref({
|
||||
basic: {
|
||||
tabbar: {
|
||||
items: [
|
||||
{
|
||||
activeIconUrl: '/static/a-index.png',
|
||||
iconUrl: '/static/index.png',
|
||||
text: '首页',
|
||||
url: '/pages/index/index',
|
||||
},
|
||||
{
|
||||
activeIconUrl: '/static/a-product.png',
|
||||
iconUrl: '/static/product.png',
|
||||
text: '产品',
|
||||
url: '/pages/index/product',
|
||||
},
|
||||
{
|
||||
activeIconUrl: '/static/a-order.png',
|
||||
iconUrl: '/static/order.png',
|
||||
text: '订单',
|
||||
url: '/pages/index/order',
|
||||
},
|
||||
{
|
||||
activeIconUrl: '/static/a-my.png',
|
||||
iconUrl: '/static/my.png',
|
||||
text: '我的',
|
||||
url: '/pages/index/my',
|
||||
},
|
||||
{
|
||||
activeIconUrl: 'http://mall.yudao.iocoder.cn/static/images/4-002.png',
|
||||
iconUrl: 'http://mall.yudao.iocoder.cn/static/images/4-001.png',
|
||||
text: 'icons',
|
||||
url: '/pages/index/icons',
|
||||
},
|
||||
],
|
||||
style: {
|
||||
activeColor: '#fc4141',
|
||||
bgColor: '#fff',
|
||||
bgType: 'color',
|
||||
color: '#282828',
|
||||
},
|
||||
theme: 'red',
|
||||
},
|
||||
{
|
||||
activeIconUrl: '/static/a-product.png',
|
||||
iconUrl: '/static/product.png',
|
||||
text: '产品',
|
||||
url: '/pages/index/product',
|
||||
},
|
||||
})
|
||||
|
||||
// 全局分享信息
|
||||
const shareInfo = ref({})
|
||||
|
||||
// 小程序发货信息管理 0: 没有 1:有
|
||||
const hasWechatTradeManaged = ref(0)
|
||||
|
||||
/**
|
||||
* @author Ankkaya
|
||||
* @description 小程序初始化
|
||||
* @param {Type} -
|
||||
* @returns {Type}
|
||||
*/
|
||||
async function init() {
|
||||
// 检查网络
|
||||
const networkStatus = await $platform.checkNetwork()
|
||||
if (!networkStatus) {
|
||||
$router.error('NetworkError')
|
||||
}
|
||||
|
||||
if (true) {
|
||||
this.info = {
|
||||
name: '🍑商城',
|
||||
logo: 'https://static.iocoder.cn/ruoyi-vue-pro-logo.png',
|
||||
version: '1.0.0',
|
||||
copyright: '全部开源,个人与企业可 100% 免费使用',
|
||||
copytime: 'Copyright© 2018-2024',
|
||||
|
||||
cdnurl: 'https://file.sheepjs.com', // 云存储域名
|
||||
filesystem: 'qcloud', // 云存储平台
|
||||
}
|
||||
this.platform = {
|
||||
share: {
|
||||
methods: ['poster', 'link'],
|
||||
linkAddress: 'https://shopro.sheepjs.com/#/',
|
||||
posterInfo: {
|
||||
user_bg: '/static/img/shop/config/user-poster-bg.png',
|
||||
goods_bg: '/static/img/shop/config/goods-poster-bg.png',
|
||||
groupon_bg: '/static/img/shop/config/groupon-poster-bg.png',
|
||||
},
|
||||
},
|
||||
bind_mobile: 0,
|
||||
}
|
||||
this.chat = {
|
||||
chat_domain: 'https://api.shopro.sheepjs.com/chat',
|
||||
room_id: 'admin',
|
||||
}
|
||||
this.has_wechat_trade_managed = 0
|
||||
|
||||
// 加载主题
|
||||
const sysStore = useSysStore()
|
||||
sysStore.setTheme()
|
||||
|
||||
return Promise.resolve(true)
|
||||
} else {
|
||||
$router.error('InitError', res.msg || '加载失败')
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
info,
|
||||
platform,
|
||||
chat,
|
||||
template,
|
||||
shareInfo,
|
||||
hasWechatTradeManaged,
|
||||
init,
|
||||
}
|
||||
},
|
||||
{
|
||||
persist: {
|
||||
enabled: true,
|
||||
strategies: [
|
||||
{
|
||||
key: 'app-store',
|
||||
},
|
||||
],
|
||||
{
|
||||
activeIconUrl: '/static/a-order.png',
|
||||
iconUrl: '/static/order.png',
|
||||
text: '订单',
|
||||
url: '/pages/index/order',
|
||||
},
|
||||
{
|
||||
activeIconUrl: '/static/a-my.png',
|
||||
iconUrl: '/static/my.png',
|
||||
text: '我的',
|
||||
url: '/pages/index/my',
|
||||
},
|
||||
],
|
||||
style: {
|
||||
activeColor: '#fc4141',
|
||||
bgColor: '#fff',
|
||||
bgType: 'color',
|
||||
color: '#282828',
|
||||
},
|
||||
theme: 'red',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
// 全局分享信息
|
||||
const shareInfo = ref({})
|
||||
|
||||
// 小程序发货信息管理 0: 没有 1:有
|
||||
const hasWechatTradeManaged = ref(0)
|
||||
|
||||
/**
|
||||
* @author Ankkaya
|
||||
* @description 小程序初始化
|
||||
* @param {Type} -
|
||||
* @returns {Type}
|
||||
*/
|
||||
async function init() {
|
||||
// 检查网络
|
||||
const networkStatus = await $platform.checkNetwork()
|
||||
if (!networkStatus) {
|
||||
$router.error('NetworkError')
|
||||
}
|
||||
|
||||
if (true) {
|
||||
this.info = {
|
||||
name: '🍑商城',
|
||||
logo: 'https://static.iocoder.cn/ruoyi-vue-pro-logo.png',
|
||||
version: '1.0.0',
|
||||
copyright: '全部开源,个人与企业可 100% 免费使用',
|
||||
copytime: 'Copyright© 2018-2024',
|
||||
|
||||
cdnurl: 'https://file.sheepjs.com', // 云存储域名
|
||||
filesystem: 'qcloud', // 云存储平台
|
||||
}
|
||||
this.platform = {
|
||||
share: {
|
||||
methods: ['poster', 'link'],
|
||||
linkAddress: 'https://shopro.sheepjs.com/#/',
|
||||
posterInfo: {
|
||||
user_bg: '/static/img/shop/config/user-poster-bg.png',
|
||||
goods_bg: '/static/img/shop/config/goods-poster-bg.png',
|
||||
groupon_bg: '/static/img/shop/config/groupon-poster-bg.png',
|
||||
},
|
||||
},
|
||||
bind_mobile: 0,
|
||||
}
|
||||
this.chat = {
|
||||
chat_domain: 'https://api.shopro.sheepjs.com/chat',
|
||||
room_id: 'admin',
|
||||
}
|
||||
this.has_wechat_trade_managed = 0
|
||||
|
||||
// 加载主题
|
||||
const sysStore = useSysStore()
|
||||
sysStore.setTheme()
|
||||
|
||||
return Promise.resolve(true)
|
||||
} else {
|
||||
$router.error('InitError', res.msg || '加载失败')
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
info,
|
||||
platform,
|
||||
chat,
|
||||
template,
|
||||
shareInfo,
|
||||
hasWechatTradeManaged,
|
||||
init,
|
||||
}
|
||||
},
|
||||
{
|
||||
persist: {
|
||||
enabled: true,
|
||||
strategies: [
|
||||
{
|
||||
key: 'app-store',
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
export default useAppStore
|
||||
|
|
|
@ -1,316 +1,319 @@
|
|||
<template>
|
||||
<view class="uni-popup-dialog">
|
||||
<view class="uni-dialog-title">
|
||||
<text class="uni-dialog-title-text" :class="['uni-popup__'+dialogType]">{{titleText}}</text>
|
||||
</view>
|
||||
<view v-if="mode === 'base'" class="uni-dialog-content">
|
||||
<slot>
|
||||
<text class="uni-dialog-content-text">{{content}}</text>
|
||||
</slot>
|
||||
</view>
|
||||
<view v-else class="uni-dialog-content">
|
||||
<slot>
|
||||
<input class="uni-dialog-input" :maxlength="maxlength" v-model="val" :type="inputType"
|
||||
:placeholder="placeholderText" :focus="focus">
|
||||
</slot>
|
||||
</view>
|
||||
<view class="uni-dialog-button-group">
|
||||
<view class="uni-dialog-button" v-if="showClose" @click="closeDialog">
|
||||
<text class="uni-dialog-button-text">{{closeText}}</text>
|
||||
</view>
|
||||
<view class="uni-dialog-button" :class="showClose?'uni-border-left':''" @click="onOk">
|
||||
<text class="uni-dialog-button-text uni-button-color">{{okText}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="uni-popup-dialog">
|
||||
<view class="uni-dialog-title">
|
||||
<text class="uni-dialog-title-text" :class="['uni-popup__' + dialogType]">{{ titleText }}</text>
|
||||
</view>
|
||||
<view v-if="mode === 'base'" class="uni-dialog-content">
|
||||
<slot>
|
||||
<text class="uni-dialog-content-text">{{ content }}</text>
|
||||
</slot>
|
||||
</view>
|
||||
<view v-else class="uni-dialog-content">
|
||||
<slot>
|
||||
<input
|
||||
class="uni-dialog-input"
|
||||
:maxlength="maxlength"
|
||||
v-model="val"
|
||||
:type="inputType"
|
||||
:placeholder="placeholderText"
|
||||
:focus="focus"
|
||||
/>
|
||||
</slot>
|
||||
</view>
|
||||
<view class="uni-dialog-button-group">
|
||||
<view class="uni-dialog-button" v-if="showClose" @click="closeDialog">
|
||||
<text class="uni-dialog-button-text">{{ closeText }}</text>
|
||||
</view>
|
||||
<view class="uni-dialog-button" :class="showClose ? 'uni-border-left' : ''" @click="onOk">
|
||||
<text class="uni-dialog-button-text uni-button-color">{{ okText }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import popup from '../uni-popup/popup.js'
|
||||
import {
|
||||
initVueI18n
|
||||
} from '@dcloudio/uni-i18n'
|
||||
import messages from '../uni-popup/i18n/index.js'
|
||||
const {
|
||||
t
|
||||
} = initVueI18n(messages)
|
||||
/**
|
||||
* PopUp 弹出层-对话框样式
|
||||
* @description 弹出层-对话框样式
|
||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=329
|
||||
* @property {String} value input 模式下的默认值
|
||||
* @property {String} placeholder input 模式下输入提示
|
||||
* @property {Boolean} focus input模式下是否自动聚焦,默认为true
|
||||
* @property {String} type = [success|warning|info|error] 主题样式
|
||||
* @value success 成功
|
||||
* @value warning 提示
|
||||
* @value info 消息
|
||||
* @value error 错误
|
||||
* @property {String} mode = [base|input] 模式、
|
||||
* @value base 基础对话框
|
||||
* @value input 可输入对话框
|
||||
* @showClose {Boolean} 是否显示关闭按钮
|
||||
* @property {String} content 对话框内容
|
||||
* @property {Boolean} beforeClose 是否拦截取消事件
|
||||
* @property {Number} maxlength 输入
|
||||
* @event {Function} confirm 点击确认按钮触发
|
||||
* @event {Function} close 点击取消按钮触发
|
||||
*/
|
||||
import popup from '../uni-popup/popup.js'
|
||||
import { initVueI18n } from '@dcloudio/uni-i18n'
|
||||
import messages from '../uni-popup/i18n/index.js'
|
||||
const { t } = initVueI18n(messages)
|
||||
/**
|
||||
* PopUp 弹出层-对话框样式
|
||||
* @description 弹出层-对话框样式
|
||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=329
|
||||
* @property {String} value input 模式下的默认值
|
||||
* @property {String} placeholder input 模式下输入提示
|
||||
* @property {Boolean} focus input模式下是否自动聚焦,默认为true
|
||||
* @property {String} type = [success|warning|info|error] 主题样式
|
||||
* @value success 成功
|
||||
* @value warning 提示
|
||||
* @value info 消息
|
||||
* @value error 错误
|
||||
* @property {String} mode = [base|input] 模式、
|
||||
* @value base 基础对话框
|
||||
* @value input 可输入对话框
|
||||
* @showClose {Boolean} 是否显示关闭按钮
|
||||
* @property {String} content 对话框内容
|
||||
* @property {Boolean} beforeClose 是否拦截取消事件
|
||||
* @property {Number} maxlength 输入
|
||||
* @event {Function} confirm 点击确认按钮触发
|
||||
* @event {Function} close 点击取消按钮触发
|
||||
*/
|
||||
|
||||
export default {
|
||||
name: "uniPopupDialog",
|
||||
mixins: [popup],
|
||||
emits: ['confirm', 'close', 'update:modelValue', 'input'],
|
||||
props: {
|
||||
inputType: {
|
||||
type: String,
|
||||
default: 'text'
|
||||
},
|
||||
showClose: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// #ifdef VUE2
|
||||
value: {
|
||||
type: [String, Number],
|
||||
default: ''
|
||||
},
|
||||
// #endif
|
||||
// #ifdef VUE3
|
||||
modelValue: {
|
||||
type: [Number, String],
|
||||
default: ''
|
||||
},
|
||||
// #endif
|
||||
export default {
|
||||
name: 'uniPopupDialog',
|
||||
mixins: [popup],
|
||||
emits: ['confirm', 'close', 'update:modelValue', 'input'],
|
||||
props: {
|
||||
inputType: {
|
||||
type: String,
|
||||
default: 'text',
|
||||
},
|
||||
showClose: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
// #ifdef VUE2
|
||||
value: {
|
||||
type: [String, Number],
|
||||
default: '',
|
||||
},
|
||||
// #endif
|
||||
// #ifdef VUE3
|
||||
modelValue: {
|
||||
type: [Number, String],
|
||||
default: '',
|
||||
},
|
||||
// #endif
|
||||
|
||||
|
||||
placeholder: {
|
||||
type: [String, Number],
|
||||
default: ''
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: 'error'
|
||||
},
|
||||
mode: {
|
||||
type: String,
|
||||
default: 'base'
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
content: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
beforeClose: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
cancelText: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
confirmText: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
maxlength: {
|
||||
type: Number,
|
||||
default: -1,
|
||||
},
|
||||
focus: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogType: 'error',
|
||||
val: ""
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
okText() {
|
||||
return this.confirmText || t("uni-popup.ok")
|
||||
},
|
||||
closeText() {
|
||||
return this.cancelText || t("uni-popup.cancel")
|
||||
},
|
||||
placeholderText() {
|
||||
return this.placeholder || t("uni-popup.placeholder")
|
||||
},
|
||||
titleText() {
|
||||
return this.title || t("uni-popup.title")
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
type(val) {
|
||||
this.dialogType = val
|
||||
},
|
||||
mode(val) {
|
||||
if (val === 'input') {
|
||||
this.dialogType = 'info'
|
||||
}
|
||||
},
|
||||
value(val) {
|
||||
if (this.maxlength != -1 && this.mode === 'input') {
|
||||
this.val = val.slice(0, this.maxlength);
|
||||
} else {
|
||||
this.val = val
|
||||
}
|
||||
},
|
||||
val(val) {
|
||||
// #ifdef VUE2
|
||||
// TODO 兼容 vue2
|
||||
this.$emit('input', val);
|
||||
// #endif
|
||||
// #ifdef VUE3
|
||||
// TODO 兼容 vue3
|
||||
this.$emit('update:modelValue', val);
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// 对话框遮罩不可点击
|
||||
this.popup.disableMask()
|
||||
// this.popup.closeMask()
|
||||
if (this.mode === 'input') {
|
||||
this.dialogType = 'info'
|
||||
this.val = this.value;
|
||||
// #ifdef VUE3
|
||||
this.val = this.modelValue;
|
||||
// #endif
|
||||
} else {
|
||||
this.dialogType = this.type
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 点击确认按钮
|
||||
*/
|
||||
onOk() {
|
||||
if (this.mode === 'input') {
|
||||
this.$emit('confirm', this.val)
|
||||
} else {
|
||||
this.$emit('confirm')
|
||||
}
|
||||
if (this.beforeClose) return
|
||||
this.popup.close()
|
||||
},
|
||||
/**
|
||||
* 点击取消按钮
|
||||
*/
|
||||
closeDialog() {
|
||||
this.$emit('close')
|
||||
if (this.beforeClose) return
|
||||
this.popup.close()
|
||||
},
|
||||
close() {
|
||||
this.popup.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
placeholder: {
|
||||
type: [String, Number],
|
||||
default: '',
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: 'error',
|
||||
},
|
||||
mode: {
|
||||
type: String,
|
||||
default: 'base',
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
content: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
beforeClose: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
cancelText: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
confirmText: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
maxlength: {
|
||||
type: Number,
|
||||
default: -1,
|
||||
},
|
||||
focus: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogType: 'error',
|
||||
val: '',
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
okText() {
|
||||
return this.confirmText || t('uni-popup.ok')
|
||||
},
|
||||
closeText() {
|
||||
return this.cancelText || t('uni-popup.cancel')
|
||||
},
|
||||
placeholderText() {
|
||||
return this.placeholder || t('uni-popup.placeholder')
|
||||
},
|
||||
titleText() {
|
||||
return this.title || t('uni-popup.title')
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
type(val) {
|
||||
this.dialogType = val
|
||||
},
|
||||
mode(val) {
|
||||
if (val === 'input') {
|
||||
this.dialogType = 'info'
|
||||
}
|
||||
},
|
||||
value(val) {
|
||||
if (this.maxlength != -1 && this.mode === 'input') {
|
||||
this.val = val.slice(0, this.maxlength)
|
||||
} else {
|
||||
this.val = val
|
||||
}
|
||||
},
|
||||
val(val) {
|
||||
// #ifdef VUE2
|
||||
// TODO 兼容 vue2
|
||||
this.$emit('input', val)
|
||||
// #endif
|
||||
// #ifdef VUE3
|
||||
// TODO 兼容 vue3
|
||||
this.$emit('update:modelValue', val)
|
||||
// #endif
|
||||
},
|
||||
modelValue(newVal, oldVal) {
|
||||
this.val = newVal
|
||||
},
|
||||
},
|
||||
created() {
|
||||
// 对话框遮罩不可点击
|
||||
this.popup.disableMask()
|
||||
// this.popup.closeMask()
|
||||
if (this.mode === 'input') {
|
||||
this.dialogType = 'info'
|
||||
this.val = this.value
|
||||
// #ifdef VUE3
|
||||
this.val = this.modelValue
|
||||
// #endif
|
||||
} else {
|
||||
this.dialogType = this.type
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 点击确认按钮
|
||||
*/
|
||||
onOk() {
|
||||
if (this.mode === 'input') {
|
||||
this.$emit('confirm', this.val)
|
||||
} else {
|
||||
this.$emit('confirm')
|
||||
}
|
||||
if (this.beforeClose) return
|
||||
this.popup.close()
|
||||
},
|
||||
/**
|
||||
* 点击取消按钮
|
||||
*/
|
||||
closeDialog() {
|
||||
this.$emit('close')
|
||||
if (this.beforeClose) return
|
||||
this.popup.close()
|
||||
},
|
||||
close() {
|
||||
this.popup.close()
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.uni-popup-dialog {
|
||||
width: 300px;
|
||||
border-radius: 11px;
|
||||
background-color: #fff;
|
||||
}
|
||||
.uni-popup-dialog {
|
||||
width: 300px;
|
||||
border-radius: 11px;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.uni-dialog-title {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
padding-top: 25px;
|
||||
}
|
||||
.uni-dialog-title {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
padding-top: 25px;
|
||||
}
|
||||
|
||||
.uni-dialog-title-text {
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.uni-dialog-title-text {
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.uni-dialog-content {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 20px;
|
||||
}
|
||||
.uni-dialog-content {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.uni-dialog-content-text {
|
||||
font-size: 14px;
|
||||
color: #6C6C6C;
|
||||
}
|
||||
.uni-dialog-content-text {
|
||||
font-size: 14px;
|
||||
color: #6c6c6c;
|
||||
}
|
||||
|
||||
.uni-dialog-button-group {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
border-top-color: #f5f5f5;
|
||||
border-top-style: solid;
|
||||
border-top-width: 1px;
|
||||
}
|
||||
.uni-dialog-button-group {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
border-top-color: #f5f5f5;
|
||||
border-top-style: solid;
|
||||
border-top-width: 1px;
|
||||
}
|
||||
|
||||
.uni-dialog-button {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
.uni-dialog-button {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
|
||||
flex: 1;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 45px;
|
||||
}
|
||||
flex: 1;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 45px;
|
||||
}
|
||||
|
||||
.uni-border-left {
|
||||
border-left-color: #f0f0f0;
|
||||
border-left-style: solid;
|
||||
border-left-width: 1px;
|
||||
}
|
||||
.uni-border-left {
|
||||
border-left-color: #f0f0f0;
|
||||
border-left-style: solid;
|
||||
border-left-width: 1px;
|
||||
}
|
||||
|
||||
.uni-dialog-button-text {
|
||||
font-size: 16px;
|
||||
color: #333;
|
||||
}
|
||||
.uni-dialog-button-text {
|
||||
font-size: 16px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.uni-button-color {
|
||||
color: #007aff;
|
||||
}
|
||||
.uni-button-color {
|
||||
color: #007aff;
|
||||
}
|
||||
|
||||
.uni-dialog-input {
|
||||
flex: 1;
|
||||
font-size: 14px;
|
||||
border: 1px #eee solid;
|
||||
height: 40px;
|
||||
padding: 0 10px;
|
||||
border-radius: 5px;
|
||||
color: #555;
|
||||
}
|
||||
.uni-dialog-input {
|
||||
flex: 1;
|
||||
font-size: 14px;
|
||||
border: 1px #eee solid;
|
||||
height: 40px;
|
||||
padding: 0 10px;
|
||||
border-radius: 5px;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.uni-popup__success {
|
||||
color: #4cd964;
|
||||
}
|
||||
.uni-popup__success {
|
||||
color: #4cd964;
|
||||
}
|
||||
|
||||
.uni-popup__warn {
|
||||
color: #f0ad4e;
|
||||
}
|
||||
.uni-popup__warn {
|
||||
color: #f0ad4e;
|
||||
}
|
||||
|
||||
.uni-popup__error {
|
||||
color: #dd524d;
|
||||
}
|
||||
.uni-popup__error {
|
||||
color: #dd524d;
|
||||
}
|
||||
|
||||
.uni-popup__info {
|
||||
color: #909399;
|
||||
}
|
||||
</style>
|
||||
.uni-popup__info {
|
||||
color: #909399;
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue