update 营业状态
This commit is contained in:
parent
fb7b940831
commit
228a8360d5
@ -4,23 +4,27 @@
|
|||||||
"version" : "0.0",
|
"version" : "0.0",
|
||||||
"configurations" : [
|
"configurations" : [
|
||||||
{
|
{
|
||||||
"app-plus" : {
|
"app-plus" :
|
||||||
"launchtype" : "local"
|
{
|
||||||
},
|
"launchtype" : "remote"
|
||||||
"default" : {
|
},
|
||||||
"launchtype" : "local"
|
"default" :
|
||||||
},
|
{
|
||||||
"h5" : {
|
"launchtype" : "local"
|
||||||
"launchtype" : "local"
|
},
|
||||||
},
|
"h5" :
|
||||||
"mp-weixin" : {
|
{
|
||||||
"launchtype" : "local"
|
"launchtype" : "local"
|
||||||
},
|
},
|
||||||
"provider" : "aliyun",
|
"mp-weixin" :
|
||||||
"type" : "uniCloud"
|
{
|
||||||
|
"launchtype" : "local"
|
||||||
|
},
|
||||||
|
"provider" : "aliyun",
|
||||||
|
"type" : "uniCloud"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"playground" : "standard",
|
"playground" : "custom",
|
||||||
"type" : "uni-app:app-android"
|
"type" : "uni-app:app-android"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
import APPUpdate, { getCurrentNo } from "@/config/appUpdate";
|
import APPUpdate, { getCurrentNo } from "@/config/appUpdate";
|
||||||
// #endif
|
// #endif
|
||||||
import { mapState, mapActions } from "vuex";
|
import { mapState, mapActions } from "vuex";
|
||||||
import GtPush from "@/utils/gtpush-min.js";
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -12,6 +11,8 @@ export default {
|
|||||||
},
|
},
|
||||||
onLaunch: function () {
|
onLaunch: function () {
|
||||||
uni.setStorageSync("isImSound", true);
|
uni.setStorageSync("isImSound", true);
|
||||||
|
|
||||||
|
this.globalData.isAppActive = true;
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
getCurrentNo((res) => {
|
getCurrentNo((res) => {
|
||||||
this.version = res.version;
|
this.version = res.version;
|
||||||
@ -22,52 +23,27 @@ export default {
|
|||||||
this.onAPPUpdate();
|
this.onAPPUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// plus.push.addEventListener("click", function (msg) {
|
|
||||||
// if (permision.isIOS) {
|
|
||||||
// console.log("ios:click收到" + JSON.parse(JSON.stringify(msg)).payload);
|
|
||||||
// var obj = JSON.parse(JSON.stringify(msg)).payload;
|
|
||||||
// that.toPushMessagePage(obj.data ? obj.data : obj);
|
|
||||||
// } else {
|
|
||||||
// console.log("安卓:click收到" + JSON.parse(JSON.stringify(msg)));
|
|
||||||
// var obj = JSON.parse(JSON.stringify(msg)).payload;
|
|
||||||
// that.toPushMessagePage(obj.data ? obj.data : obj);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// plus.push.addEventListener("receive", (message) => {
|
|
||||||
// console.log("receive收到");
|
|
||||||
// //收到透传消息,执行该事件
|
|
||||||
// let payload = message.payload; //自定义内容获取
|
|
||||||
// let text = message.payload.text;
|
|
||||||
|
|
||||||
// if (permision.isIOS) {
|
|
||||||
// console.log("ios:receive收到");
|
|
||||||
// let payload = message.payload; //自定义内容获取
|
|
||||||
// let text = message.content;
|
|
||||||
// that.createLocalMessage(text, payload);
|
|
||||||
// } else {
|
|
||||||
// console.log("安卓收到");
|
|
||||||
// that.toPushMessagePage(payload);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
this.initAppOrderPush();
|
this.initAppOrderPush();
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef H5
|
|
||||||
this.initH5OrderPush();
|
|
||||||
// #endif
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState("user", ["uid", "userInfo", "socket"]),
|
...mapState("user", ["uid", "userInfo", "socket"]),
|
||||||
},
|
},
|
||||||
onShow: function () {
|
onShow: function () {
|
||||||
|
this.globalData.isAppActive = true;
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.userInfo && Object.keys(this.userInfo).length > 0) {
|
if (this.userInfo && Object.keys(this.userInfo).length > 0) {
|
||||||
this.connectSocket(this.userInfo);
|
this.connectSocket(this.userInfo);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onHide: function () {},
|
onHide: function () {
|
||||||
|
this.globalData.isAppActive = false;
|
||||||
|
},
|
||||||
|
globalData: {
|
||||||
|
isAppActive: false,
|
||||||
|
},
|
||||||
onBackPress: function () {},
|
onBackPress: function () {},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions("user", ["connectSocket"]),
|
...mapActions("user", ["connectSocket"]),
|
||||||
@ -91,105 +67,71 @@ export default {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
initAppOrderPush() {
|
||||||
initH5OrderPush() {
|
uni.getPushClientId({
|
||||||
let _this = this;
|
success: (res) => {
|
||||||
GtPush.setDebugMode(true);
|
var push_clientid = res.cid;
|
||||||
GtPush.init({
|
console.log("客户端推送标识cid:", push_clientid);
|
||||||
appid: "KXgzOaKSzd5HG3p9IPaVa8",
|
|
||||||
onClientId: (res) => {
|
|
||||||
console.log("onClientId = " + res.cid);
|
|
||||||
_this.cid = res.cid;
|
|
||||||
},
|
|
||||||
onlineState: (res) => {
|
|
||||||
console.log("onlineState = " + res.online);
|
|
||||||
_this.online = res.online;
|
|
||||||
},
|
|
||||||
onPushMsg: (res) => {
|
|
||||||
console.log("onPushMsg = " + res.message);
|
|
||||||
_this.messages += "onPushMsg: " + res.message + "\n";
|
|
||||||
},
|
|
||||||
onError: (res) => {
|
|
||||||
_this.messages += "onError: " + res.error + "\n";
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
|
||||||
async initAppOrderPush() {
|
|
||||||
var pinf = plus.push.getClientInfo();
|
|
||||||
var cid = pinf.clientid; //客户端标识
|
|
||||||
|
|
||||||
console.log("当前机子CID:", cid);
|
|
||||||
|
|
||||||
plus.push.getClientInfoAsync((info) => {
|
|
||||||
let cid = info["clientid"];
|
|
||||||
console.log("当前机子CID:", cid);
|
|
||||||
});
|
|
||||||
|
|
||||||
let res = await this.getCidAsync();
|
|
||||||
console.log("getCidAsync", res);
|
|
||||||
|
|
||||||
uni.setClipboardData({
|
|
||||||
data: cid, // 需要复制的内容
|
|
||||||
success: () => {
|
|
||||||
// 成功提示框显示 1 秒钟
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "复制成功",
|
title: push_clientid,
|
||||||
icon: "success",
|
icon: "success",
|
||||||
duration: 1000,
|
duration: 1000,
|
||||||
});
|
});
|
||||||
},
|
|
||||||
fail: () => {
|
console.log(push_clientid);
|
||||||
// 失败提示框显示 1 秒钟
|
|
||||||
uni.showToast({
|
uni.setClipboardData({
|
||||||
title: "复制失败,请重试",
|
data: push_clientid, // 需要复制的内容
|
||||||
icon: "none",
|
success: () => {
|
||||||
duration: 1000,
|
// 成功提示框显示 1 秒钟
|
||||||
|
uni.showToast({
|
||||||
|
title: "复制成功",
|
||||||
|
icon: "success",
|
||||||
|
duration: 1000,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
// 失败提示框显示 1 秒钟
|
||||||
|
uni.showToast({
|
||||||
|
title: "复制失败,请重试",
|
||||||
|
icon: "none",
|
||||||
|
duration: 1000,
|
||||||
|
});
|
||||||
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
fail(err) {
|
||||||
|
console.log(err);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// uni.showToast({
|
uni.onPushMessage((res) => {
|
||||||
// title: cid,
|
console.log("收到推送消息:", res); //监听推送消息
|
||||||
// icon: "success",
|
|
||||||
// duration: 20000,
|
if (res.data) {
|
||||||
// });
|
const app = getApp();
|
||||||
|
if (!app.globalData.isAppActive) {
|
||||||
|
// 读取历史数据
|
||||||
|
const ordrPushHistoryList =
|
||||||
|
uni.getStorageSync("PUSH_MSG_DATA") || [];
|
||||||
|
// 追加新数据(确保 historyList 是数组)
|
||||||
|
const newList = Array.isArray(ordrPushHistoryList)
|
||||||
|
? [...ordrPushHistoryList, res.data]
|
||||||
|
: [res.data];
|
||||||
|
// 存储更新后的数组
|
||||||
|
uni.setStorageSync("PUSH_MSG_DATA", newList);
|
||||||
|
// 创建通知
|
||||||
|
uni.createPushMessage(res.data);
|
||||||
|
} else {
|
||||||
|
console.log("应用已打开,直接处理消息");
|
||||||
|
// 可以在这里直接更新 UI
|
||||||
|
this.$store.dispatch("order/orderPush", res.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const _self = this;
|
const _self = this;
|
||||||
//监听系统通知栏消息点击事件
|
//监听系统通知栏消息点击事件
|
||||||
plus.push.addEventListener(
|
|
||||||
"click",
|
|
||||||
function (message) {
|
|
||||||
//处理点击消息的业务逻辑代码
|
|
||||||
console.log(message);
|
|
||||||
plus.nativeUI.toast("click:" + JSON.stringify(message));
|
|
||||||
//plus.nativeUI.toast('push click');
|
|
||||||
_self._handlePush(message);
|
|
||||||
uni.showToast({
|
|
||||||
title: message,
|
|
||||||
icon: "none",
|
|
||||||
duration: 1000,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
//监听接收透传消息事件
|
|
||||||
plus.push.addEventListener(
|
|
||||||
"receive",
|
|
||||||
function (message) {
|
|
||||||
console.log(message);
|
|
||||||
plus.nativeUI.toast("receive:" + JSON.stringify(message));
|
|
||||||
//处理透传消息的业务逻辑代码
|
|
||||||
//plus.nativeUI.toast('push receive');
|
|
||||||
_self._handlePush(message);
|
|
||||||
uni.showToast({
|
|
||||||
title: message,
|
|
||||||
icon: "none",
|
|
||||||
duration: 1000,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
false
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@ -13,6 +13,6 @@ export function UpdateStoreBizState(params) {
|
|||||||
url: "shop/shop-store-base/update/storeBizState",
|
url: "shop/shop-store-base/update/storeBizState",
|
||||||
method: "post",
|
method: "post",
|
||||||
baseURL: config.adminApi,
|
baseURL: config.adminApi,
|
||||||
data: params,
|
params,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,177 +1,178 @@
|
|||||||
{
|
{
|
||||||
"name": "小发同城商家版",
|
"name" : "小发同城商家版",
|
||||||
"appid": "__UNI__95F809F",
|
"appid" : "__UNI__95F809F",
|
||||||
"package": "com.xiaofa.shopAdmin",
|
"package" : "com.xiaofa.shopAdmin",
|
||||||
"description": "",
|
"description" : "",
|
||||||
"versionName": "1.0.0",
|
"versionName" : "1.0.0",
|
||||||
"versionCode": 102,
|
"versionCode" : 102,
|
||||||
"transformPx": false,
|
"transformPx" : false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
"app-plus": {
|
"app-plus" : {
|
||||||
"usingComponents": true,
|
"usingComponents" : true,
|
||||||
"nvueStyleCompiler": "uni-app",
|
"nvueStyleCompiler" : "uni-app",
|
||||||
"compilerVersion": 3,
|
"compilerVersion" : 3,
|
||||||
"splashscreen": {
|
"splashscreen" : {
|
||||||
"alwaysShowBeforeRender": true,
|
"alwaysShowBeforeRender" : true,
|
||||||
"waiting": true,
|
"waiting" : true,
|
||||||
"autoclose": true,
|
"autoclose" : true,
|
||||||
"delay": 0
|
"delay" : 0
|
||||||
},
|
|
||||||
"ios": {
|
|
||||||
"capabilities": {
|
|
||||||
"com.apple.SafariKeychain": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
/* 模块配置 */
|
|
||||||
"modules": {
|
|
||||||
"Maps": {},
|
|
||||||
"Camera": {},
|
|
||||||
"Record": {},
|
|
||||||
"VideoPlayer": {},
|
|
||||||
"UIWebview": {},
|
|
||||||
"Push": {}
|
|
||||||
},
|
|
||||||
/* 应用发布信息 */
|
|
||||||
"distribute": {
|
|
||||||
/* android打包配置 */
|
|
||||||
"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\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
|
||||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
|
||||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
|
||||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
/* ios打包配置 */
|
|
||||||
"ios": {
|
|
||||||
"privacyDescription": {
|
|
||||||
"NSPhotoLibraryAddUsageDescription": "此App会在上传头像图片服务中访问您的相机权限",
|
|
||||||
"NSPhotoLibraryUsageDescription": "此App会在上传头像图片服务中访问您的相机权限",
|
|
||||||
"NSCameraUsageDescription": "此App会在上传头像图片服务中访问您的相机权限",
|
|
||||||
"NSMicrophoneUsageDescription": "此APP会在使用声音识别服务中使用您的麦克风权限",
|
|
||||||
"NSLocationWhenInUseUsageDescription": "此App会在使用导航服务中使用您的定位权限",
|
|
||||||
"NSLocationAlwaysUsageDescription": "此App会在使用导航服务中使用您的定位权限",
|
|
||||||
"NSLocationAlwaysAndWhenInUseUsageDescription": "此App会在使用导航服务中使用您的定位权限"
|
|
||||||
},
|
},
|
||||||
"dSYMs": false
|
"ios" : {
|
||||||
},
|
"capabilities" : {
|
||||||
/* SDK配置 */
|
"com.apple.SafariKeychain" : true
|
||||||
"sdkConfigs": {
|
}
|
||||||
"maps": {},
|
|
||||||
"push": {
|
|
||||||
"igexin": {
|
|
||||||
"appid": "KXgzOaKSzd5HG3p9IPaVa8",
|
|
||||||
"appkey": "neXXX9r1Tc7gMxN2PIcHA1",
|
|
||||||
"appsecret": "aQQys9eufd8KHH1Y0kfQm6"
|
|
||||||
},
|
|
||||||
"unipush": {
|
|
||||||
"version": "2",
|
|
||||||
"offline": true,
|
|
||||||
"hms": {},
|
|
||||||
"oppo": {},
|
|
||||||
"vivo": {},
|
|
||||||
"mi": {},
|
|
||||||
"meizu": {},
|
|
||||||
"honor": {},
|
|
||||||
"fcm": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"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",
|
"modules" : {
|
||||||
"ipad": {
|
"Maps" : {},
|
||||||
"app": "unpackage/res/icons/76x76.png",
|
"Camera" : {},
|
||||||
"app@2x": "unpackage/res/icons/152x152.png",
|
"Record" : {},
|
||||||
"notification": "unpackage/res/icons/20x20.png",
|
"VideoPlayer" : {},
|
||||||
"notification@2x": "unpackage/res/icons/40x40.png",
|
"UIWebview" : {},
|
||||||
"proapp@2x": "unpackage/res/icons/167x167.png",
|
"Push" : {}
|
||||||
"settings": "unpackage/res/icons/29x29.png",
|
},
|
||||||
"settings@2x": "unpackage/res/icons/58x58.png",
|
/* 应用发布信息 */
|
||||||
"spotlight": "unpackage/res/icons/40x40.png",
|
"distribute" : {
|
||||||
"spotlight@2x": "unpackage/res/icons/80x80.png"
|
/* android打包配置 */
|
||||||
},
|
"android" : {
|
||||||
"iphone": {
|
"permissions" : [
|
||||||
"app@2x": "unpackage/res/icons/120x120.png",
|
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||||
"app@3x": "unpackage/res/icons/180x180.png",
|
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||||
"notification@2x": "unpackage/res/icons/40x40.png",
|
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||||
"notification@3x": "unpackage/res/icons/60x60.png",
|
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||||
"settings@2x": "unpackage/res/icons/58x58.png",
|
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||||
"settings@3x": "unpackage/res/icons/87x87.png",
|
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||||
"spotlight@2x": "unpackage/res/icons/80x80.png",
|
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||||
"spotlight@3x": "unpackage/res/icons/120x120.png"
|
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||||
}
|
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||||
|
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
/* ios打包配置 */
|
||||||
|
"ios" : {
|
||||||
|
"privacyDescription" : {
|
||||||
|
"NSPhotoLibraryAddUsageDescription" : "此App会在上传头像图片服务中访问您的相机权限",
|
||||||
|
"NSPhotoLibraryUsageDescription" : "此App会在上传头像图片服务中访问您的相机权限",
|
||||||
|
"NSCameraUsageDescription" : "此App会在上传头像图片服务中访问您的相机权限",
|
||||||
|
"NSMicrophoneUsageDescription" : "此APP会在使用声音识别服务中使用您的麦克风权限",
|
||||||
|
"NSLocationWhenInUseUsageDescription" : "此App会在使用导航服务中使用您的定位权限",
|
||||||
|
"NSLocationAlwaysUsageDescription" : "此App会在使用导航服务中使用您的定位权限",
|
||||||
|
"NSLocationAlwaysAndWhenInUseUsageDescription" : "此App会在使用导航服务中使用您的定位权限"
|
||||||
|
},
|
||||||
|
"dSYMs" : false
|
||||||
|
},
|
||||||
|
/* SDK配置 */
|
||||||
|
"sdkConfigs" : {
|
||||||
|
"maps" : {},
|
||||||
|
"push" : {
|
||||||
|
"igexin" : {
|
||||||
|
"appid" : "rQxaGAKl7t83KlTubAaKC3",
|
||||||
|
"appkey" : "QSElTn6ttq5nmrIZtFhCT",
|
||||||
|
"appsecret" : "zbC1MMuzaf7kW91fdhm9v8"
|
||||||
|
},
|
||||||
|
"unipush" : {
|
||||||
|
"version" : "2",
|
||||||
|
"offline" : false,
|
||||||
|
"hms" : {},
|
||||||
|
"oppo" : {},
|
||||||
|
"vivo" : {},
|
||||||
|
"mi" : {},
|
||||||
|
"meizu" : {},
|
||||||
|
"honor" : {},
|
||||||
|
"fcm" : {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"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" : {
|
||||||
|
"androidStyle" : "common"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"splashscreen": {
|
|
||||||
"androidStyle": "common"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
/* 快应用特有相关 */
|
|
||||||
"quickapp": {},
|
|
||||||
/* 小程序特有相关 */
|
|
||||||
"mp-weixin": {
|
|
||||||
"appid": "",
|
|
||||||
"setting": {
|
|
||||||
"urlCheck": false
|
|
||||||
},
|
},
|
||||||
"usingComponents": true
|
/* 快应用特有相关 */
|
||||||
},
|
"quickapp" : {},
|
||||||
"h5": {
|
/* 小程序特有相关 */
|
||||||
// "devServer" : {
|
"mp-weixin" : {
|
||||||
// "https" : true,
|
"appid" : "",
|
||||||
// "host" : "127.0.0.1",
|
"setting" : {
|
||||||
// "port" : 8080,
|
"urlCheck" : false
|
||||||
// "disableHostCheck" : true,
|
},
|
||||||
// "proxy" : {
|
"usingComponents" : true
|
||||||
// "/place/v2/suggestion" : {
|
},
|
||||||
// "target" : "https://api.map.baidu.com",
|
"h5" : {
|
||||||
// "changeOrigin" : true,
|
// "devServer" : {
|
||||||
// "secure" : false
|
// "https" : true,
|
||||||
// },
|
// "host" : "127.0.0.1",
|
||||||
// "/admin/shop/shop-base-product-category/list" : {
|
// "port" : 8080,
|
||||||
// "target" : "https://mall.gpxscs.cn",
|
// "disableHostCheck" : true,
|
||||||
// "changeOrigin" : true
|
// "proxy" : {
|
||||||
// }
|
// "/place/v2/suggestion" : {
|
||||||
// }
|
// "target" : "https://api.map.baidu.com",
|
||||||
// },
|
// "changeOrigin" : true,
|
||||||
"title": "小发商城商家中心",
|
// "secure" : false
|
||||||
"template": "index.html",
|
// },
|
||||||
"router": {
|
// "/admin/shop/shop-base-product-category/list" : {
|
||||||
"mode": "history",
|
// "target" : "https://mall.gpxscs.cn",
|
||||||
"base": "/mchapp/"
|
// "changeOrigin" : true
|
||||||
}
|
// }
|
||||||
},
|
// }
|
||||||
"mp-alipay": {
|
// },
|
||||||
"usingComponents": true
|
"title" : "小发商城商家中心",
|
||||||
},
|
"template" : "index.html",
|
||||||
"mp-baidu": {
|
"router" : {
|
||||||
"usingComponents": true
|
"mode" : "history",
|
||||||
},
|
"base" : "/mchapp/"
|
||||||
"mp-toutiao": {
|
}
|
||||||
"usingComponents": true
|
},
|
||||||
},
|
"mp-alipay" : {
|
||||||
"uniStatistics": {
|
"usingComponents" : true
|
||||||
"enable": false
|
},
|
||||||
},
|
"mp-baidu" : {
|
||||||
"vueVersion": "2"
|
"usingComponents" : true
|
||||||
|
},
|
||||||
|
"mp-toutiao" : {
|
||||||
|
"usingComponents" : true
|
||||||
|
},
|
||||||
|
"uniStatistics" : {
|
||||||
|
"enable" : false
|
||||||
|
},
|
||||||
|
"vueVersion" : "2"
|
||||||
}
|
}
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
|
|
||||||
|
|||||||
@ -144,11 +144,17 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/my/businessStatus",
|
"path": "pages/my/storeBusinessStatus/businessStatus",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "营业状态"
|
"navigationBarTitleText": "营业状态"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/my/storeBusinessStatus/updateBusinessTime",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "修改营业时间"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/my/contract",
|
"path": "pages/my/contract",
|
||||||
"style": {
|
"style": {
|
||||||
|
|||||||
@ -166,7 +166,7 @@
|
|||||||
auditInfo.store_status == 1
|
auditInfo.store_status == 1
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<view class="img-shop-init"></view>
|
<view class="img-independent-account"></view>
|
||||||
<view class="tips">店铺创建成功,系统正在处理分账业务申请</view>
|
<view class="tips">店铺创建成功,系统正在处理分账业务申请</view>
|
||||||
</view>
|
</view>
|
||||||
<!--创建店铺失败-->
|
<!--创建店铺失败-->
|
||||||
@ -1449,6 +1449,16 @@ export default {
|
|||||||
background-size: 100% 100%;
|
background-size: 100% 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.img-independent-account {
|
||||||
|
margin: 0 auto;
|
||||||
|
margin-top: 17%;
|
||||||
|
margin-bottom: 20%;
|
||||||
|
width: 400rpx;
|
||||||
|
height: 400rpx;
|
||||||
|
background-image: url("../../static/independent-account.png");
|
||||||
|
background-size: 100% 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.tips {
|
.tips {
|
||||||
margin-bottom: 24rpx;
|
margin-bottom: 24rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
@ -133,7 +133,7 @@
|
|||||||
|
|
||||||
<view class="btn-content">
|
<view class="btn-content">
|
||||||
<view class="myui_check_text">检查并确认店铺信息无误</view>
|
<view class="myui_check_text">检查并确认店铺信息无误</view>
|
||||||
<u-button text="下一步" color="#fe4119" @click="handleNext"></u-button>
|
<u-button text="下一步" class="btn-next" @click="handleNext"></u-button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<u-toast ref="uToast" />
|
<u-toast ref="uToast" />
|
||||||
@ -473,5 +473,11 @@ export default {
|
|||||||
background: $base-color;
|
background: $base-color;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn-next {
|
||||||
|
background: $base-color;
|
||||||
|
color: #fff;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -45,6 +45,14 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
...mapActions("user", ["checkAccountIsPass"]),
|
...mapActions("user", ["checkAccountIsPass"]),
|
||||||
skipuLogin() {
|
skipuLogin() {
|
||||||
|
// uni.switchTab({
|
||||||
|
// url: "/pages/order/order",
|
||||||
|
// });
|
||||||
|
|
||||||
|
// uni.navigateTo({
|
||||||
|
// url: "/pages/my/businessStatus",
|
||||||
|
// });
|
||||||
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/login/login",
|
url: "/pages/login/login",
|
||||||
});
|
});
|
||||||
@ -100,11 +108,13 @@ export default {
|
|||||||
.btn {
|
.btn {
|
||||||
width: 280rpx;
|
width: 280rpx;
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
border: none;
|
border: none;
|
||||||
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-register {
|
.btn-register {
|
||||||
background: $base-color;
|
background: $base-btn-bg-color;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
|
|||||||
@ -1,152 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="businessStatus-container">
|
|
||||||
<view class="business-contetn">
|
|
||||||
<view class="title">营业状态</view>
|
|
||||||
<view class="business-box">
|
|
||||||
<view class="business-status">
|
|
||||||
<view class="status-name">店铺正常营业中</view>
|
|
||||||
<view class="business-time">
|
|
||||||
营业时间:{{ dashboardInfo.store_info.info.store_opening_hours }} -
|
|
||||||
{{ dashboardInfo.store_info.info.store_close_hours }}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<u-switch
|
|
||||||
v-model="dashboardInfo.store_info.store_biz_state"
|
|
||||||
activeColor="#5ac725"
|
|
||||||
inactiveColor="#f56c6c"
|
|
||||||
:activeValue="1"
|
|
||||||
:inactiveValue="2"
|
|
||||||
@change="handerUpdateStoreBizState"
|
|
||||||
></u-switch>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { GetAccountDashboard } from "../../api/user";
|
|
||||||
import { UpdateStoreBizState } from "../../api/store";
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
dashboardInfo: {
|
|
||||||
data: {},
|
|
||||||
notice: {},
|
|
||||||
order: {
|
|
||||||
yestoday_num: 0,
|
|
||||||
},
|
|
||||||
product: {
|
|
||||||
illegal_num: 0,
|
|
||||||
normal_num: 0,
|
|
||||||
off_num: 0,
|
|
||||||
total_num: 0,
|
|
||||||
verify_passed_off_num: 0,
|
|
||||||
verify_refused_num: 0,
|
|
||||||
verify_waiting_num: 0,
|
|
||||||
},
|
|
||||||
return: {
|
|
||||||
fin_num: 0,
|
|
||||||
review_num: 0,
|
|
||||||
total_num: 0,
|
|
||||||
un_fin_num: 0,
|
|
||||||
},
|
|
||||||
store_info: {
|
|
||||||
store_id: 1,
|
|
||||||
store_name: "",
|
|
||||||
store_biz_state: 1,
|
|
||||||
info: {
|
|
||||||
store_opening_hours: "",
|
|
||||||
store_close_hours: "",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
onShow() {
|
|
||||||
this.getAccountDashboard();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
async getAccountDashboard() {
|
|
||||||
let res = await GetAccountDashboard();
|
|
||||||
if (res && res.status == 200) {
|
|
||||||
uni.setStorageSync("accountDashboard", res.data);
|
|
||||||
this.dashboardInfo = res.data;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async handerUpdateStoreBizState(e) {
|
|
||||||
let params = {
|
|
||||||
store_id: this.dashboardInfo.store_info.store_id,
|
|
||||||
store_biz_state: e,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (e == 2) {
|
|
||||||
uni.showModal({
|
|
||||||
title: "提示",
|
|
||||||
content: "你确定要暂时关闭店铺营业?",
|
|
||||||
success: async (res) => {
|
|
||||||
if (res.confirm) {
|
|
||||||
let res = await UpdateStoreBizState(params);
|
|
||||||
if (res && res.status == 200) {
|
|
||||||
uni.showToast({
|
|
||||||
title: `关闭成功`,
|
|
||||||
icon: "error",
|
|
||||||
duration: 1000,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
let res = await UpdateStoreBizState(params);
|
|
||||||
if (res && res.status == 200) {
|
|
||||||
uni.showToast({
|
|
||||||
title: `打开成功`,
|
|
||||||
icon: "error",
|
|
||||||
duration: 1000,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
.businessStatus-container {
|
|
||||||
.business-contetn {
|
|
||||||
margin: 40rpx 20rpx;
|
|
||||||
background: #fff;
|
|
||||||
border-radius: 12rpx;
|
|
||||||
box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.1);
|
|
||||||
|
|
||||||
.title {
|
|
||||||
padding: 20rpx 32rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.business-status {
|
|
||||||
.status-name {
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
&::before {
|
|
||||||
content: "";
|
|
||||||
display: block;
|
|
||||||
width: 6px;
|
|
||||||
height: 6px;
|
|
||||||
background-color: #5ac725;
|
|
||||||
position: absolute;
|
|
||||||
right: 25%;
|
|
||||||
top: 36%;
|
|
||||||
border-radius: 50%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.business-box {
|
|
||||||
padding: 20rpx 32rpx;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -204,7 +204,7 @@ export default {
|
|||||||
},
|
},
|
||||||
skipuBusinessStatus() {
|
skipuBusinessStatus() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/my/businessStatus",
|
url: "/pages/my/storeBusinessStatus/businessStatus",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -0,0 +1,504 @@
|
|||||||
|
<template>
|
||||||
|
<view class="businessStatus-container">
|
||||||
|
<view class="hander">
|
||||||
|
<view class="store-logo">
|
||||||
|
<u--image
|
||||||
|
:src="
|
||||||
|
dashboardInfo.store_info.store_logo || '../../static/user-img.png'
|
||||||
|
"
|
||||||
|
shape="circle"
|
||||||
|
width="100"
|
||||||
|
height="100"
|
||||||
|
></u--image>
|
||||||
|
</view>
|
||||||
|
<view class="store-name">{{ dashboardInfo.store_info.store_name }}</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="business-contetn">
|
||||||
|
<view class="title">
|
||||||
|
<view
|
||||||
|
:class="[
|
||||||
|
'status',
|
||||||
|
{
|
||||||
|
'open-business': dashboardInfo.store_info.store_biz_state == 1,
|
||||||
|
'close-business': dashboardInfo.store_info.store_biz_state == 2,
|
||||||
|
},
|
||||||
|
]"
|
||||||
|
>
|
||||||
|
{{
|
||||||
|
dashboardInfo.store_info.store_biz_state == 1 ? "营业中" : "停业中"
|
||||||
|
}}
|
||||||
|
</view>
|
||||||
|
<view class="tips">本店停业中,不会自动恢复营业。</view>
|
||||||
|
</view>
|
||||||
|
<view class="business-box">
|
||||||
|
<u-cell-group :border="false" class="business-time-content">
|
||||||
|
<u-cell
|
||||||
|
:rightIconStyle="{ fontSize: '24rpx' }"
|
||||||
|
isLink
|
||||||
|
url="/pages/my/storeBusinessStatus/updateBusinessTime"
|
||||||
|
title="营业时间"
|
||||||
|
:label="businessTime"
|
||||||
|
:border="false"
|
||||||
|
></u-cell>
|
||||||
|
</u-cell-group>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="businees-bottom">
|
||||||
|
<view class="bottom-tips">
|
||||||
|
恢复营业后,系统会根据营业时间自动切换营业中、已打烊状态。
|
||||||
|
</view>
|
||||||
|
<u-button
|
||||||
|
:class="[
|
||||||
|
'btn-update-status',
|
||||||
|
{
|
||||||
|
'btn-update-status-bg':
|
||||||
|
dashboardInfo.store_info.store_biz_state == 2,
|
||||||
|
},
|
||||||
|
]"
|
||||||
|
:hairline="true"
|
||||||
|
:plain="true"
|
||||||
|
shape="circle"
|
||||||
|
@click="showBusinessPopup"
|
||||||
|
>
|
||||||
|
{{
|
||||||
|
dashboardInfo.store_info.store_biz_state == 1
|
||||||
|
? "停止营业"
|
||||||
|
: "恢复营业"
|
||||||
|
}}
|
||||||
|
</u-button>
|
||||||
|
</view>
|
||||||
|
<u-popup class="businees-popup" :show="showPopup" mode="center">
|
||||||
|
<view class="businees-popup-content">
|
||||||
|
<view
|
||||||
|
:class="[
|
||||||
|
'popup-logo',
|
||||||
|
{
|
||||||
|
'popup-logo-filter':
|
||||||
|
dashboardInfo.store_info.store_biz_state == 1,
|
||||||
|
},
|
||||||
|
]"
|
||||||
|
></view>
|
||||||
|
<view class="businees-name">
|
||||||
|
{{
|
||||||
|
dashboardInfo.store_info.store_biz_state == 2 ? "恢复" : "停止"
|
||||||
|
}}营业
|
||||||
|
</view>
|
||||||
|
<view class="businees-tips-1">
|
||||||
|
确认将门店
|
||||||
|
<text class="store-name">
|
||||||
|
"{{ dashboardInfo.store_info.store_name }}"
|
||||||
|
</text>
|
||||||
|
恢复营业吗?
|
||||||
|
</view>
|
||||||
|
<view class="businees-tips-2">
|
||||||
|
<text v-if="dashboardInfo.store_info.store_biz_state == 2">
|
||||||
|
恢复营业后门店将在营业时间内接收订单,请提前 做好准备
|
||||||
|
</text>
|
||||||
|
<text v-if="dashboardInfo.store_info.store_biz_state == 1">
|
||||||
|
停业后门店将不再接收新订单
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
<view class="popup-btn-list">
|
||||||
|
<u-button
|
||||||
|
class="btn-item"
|
||||||
|
:hairline="true"
|
||||||
|
:plain="true"
|
||||||
|
shape="circle"
|
||||||
|
@click="closeStoreBusinessStatus"
|
||||||
|
>
|
||||||
|
取消
|
||||||
|
</u-button>
|
||||||
|
<u-button
|
||||||
|
v-if="dashboardInfo.store_info.store_biz_state == 2"
|
||||||
|
class="btn-item btn-item-2"
|
||||||
|
:hairline="true"
|
||||||
|
:plain="true"
|
||||||
|
shape="circle"
|
||||||
|
@click="handerUpdateStoreBizState(1)"
|
||||||
|
>
|
||||||
|
恢复营业
|
||||||
|
</u-button>
|
||||||
|
<u-button
|
||||||
|
v-if="dashboardInfo.store_info.store_biz_state == 1"
|
||||||
|
class="btn-item btn-item-2"
|
||||||
|
:hairline="true"
|
||||||
|
:plain="true"
|
||||||
|
shape="circle"
|
||||||
|
@click="handerUpdateStoreBizState(2)"
|
||||||
|
>
|
||||||
|
停止营业
|
||||||
|
</u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
<u-popup class="inform-popup" :show="showInformPopup" mode="center">
|
||||||
|
<view class="inform-popup-content">
|
||||||
|
<view class="inform-popup-title">已停止营业</view>
|
||||||
|
<view class="inform-popup-tips">
|
||||||
|
当前商家从现在起不接收新订单,手动 恢复营业后可正常接收新订单
|
||||||
|
</view>
|
||||||
|
<view class="popup-btn-list">
|
||||||
|
<u-button
|
||||||
|
class="btn-item"
|
||||||
|
:hairline="true"
|
||||||
|
:plain="true"
|
||||||
|
shape="circle"
|
||||||
|
@click="showInformPopup = false"
|
||||||
|
>
|
||||||
|
取消
|
||||||
|
</u-button>
|
||||||
|
<u-button
|
||||||
|
class="btn-item btn-item-2"
|
||||||
|
:hairline="true"
|
||||||
|
:plain="true"
|
||||||
|
shape="circle"
|
||||||
|
@click="showInformPopup = false"
|
||||||
|
>
|
||||||
|
我知道了
|
||||||
|
</u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { GetAccountDashboard } from "../../../api/user";
|
||||||
|
import { UpdateStoreBizState } from "../../../api/store";
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dashboardInfo: {
|
||||||
|
data: {},
|
||||||
|
notice: {},
|
||||||
|
order: {
|
||||||
|
yestoday_num: 0,
|
||||||
|
},
|
||||||
|
product: {
|
||||||
|
illegal_num: 0,
|
||||||
|
normal_num: 0,
|
||||||
|
off_num: 0,
|
||||||
|
total_num: 0,
|
||||||
|
verify_passed_off_num: 0,
|
||||||
|
verify_refused_num: 0,
|
||||||
|
verify_waiting_num: 0,
|
||||||
|
},
|
||||||
|
return: {
|
||||||
|
fin_num: 0,
|
||||||
|
review_num: 0,
|
||||||
|
total_num: 0,
|
||||||
|
un_fin_num: 0,
|
||||||
|
},
|
||||||
|
store_info: {
|
||||||
|
store_id: 1,
|
||||||
|
store_name: "",
|
||||||
|
store_biz_state: 1,
|
||||||
|
info: {
|
||||||
|
store_opening_hours: "",
|
||||||
|
store_close_hours: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
showPopup: false,
|
||||||
|
showInformPopup: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
businessTime() {
|
||||||
|
return `${this.dashboardInfo.store_info.info.store_opening_hours}-${this.dashboardInfo.store_info.info.store_close_hours}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.getAccountDashboard();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async getAccountDashboard() {
|
||||||
|
let res = await GetAccountDashboard();
|
||||||
|
if (res && res.status == 200) {
|
||||||
|
uni.setStorageSync("accountDashboard", res.data);
|
||||||
|
this.dashboardInfo = res.data;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async handerUpdateStoreBizState(status) {
|
||||||
|
let params = {
|
||||||
|
store_id: this.dashboardInfo.store_info.store_id,
|
||||||
|
store_biz_state: status,
|
||||||
|
};
|
||||||
|
|
||||||
|
let res = await UpdateStoreBizState(params);
|
||||||
|
if (res && res.status == 200) {
|
||||||
|
if (status == 2) {
|
||||||
|
this.showInformPopup = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.getAccountDashboard();
|
||||||
|
this.showPopup = false;
|
||||||
|
},
|
||||||
|
showBusinessPopup() {
|
||||||
|
this.showPopup = true;
|
||||||
|
},
|
||||||
|
closeStoreBusinessStatus() {
|
||||||
|
this.showPopup = false;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@import "@/styles/variables.scss";
|
||||||
|
.businessStatus-container {
|
||||||
|
background: #fafafa;
|
||||||
|
height: calc(100vh - 88rpx);
|
||||||
|
|
||||||
|
.hander {
|
||||||
|
display: flex;
|
||||||
|
flex-flow: column;
|
||||||
|
align-items: center;
|
||||||
|
padding: 60rpx 0 28rpx;
|
||||||
|
|
||||||
|
.store-logo {
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.store-name {
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 34rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.business-contetn {
|
||||||
|
margin: 40rpx 32rpx;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.1);
|
||||||
|
background: #fbf1e8;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
padding: 40rpx 36rpx;
|
||||||
|
|
||||||
|
.status {
|
||||||
|
position: relative;
|
||||||
|
margin-bottom: 12rpx;
|
||||||
|
padding: 0 36rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 36rpx;
|
||||||
|
letter-spacing: 4rpx;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: "";
|
||||||
|
display: block;
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 37%;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.open-business::before {
|
||||||
|
background-color: #5ac725;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close-business::before {
|
||||||
|
background-color: #ed7330;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tips {
|
||||||
|
padding: 0 36rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #271c18;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.business-status {
|
||||||
|
.status-name {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: "";
|
||||||
|
display: block;
|
||||||
|
width: 6px;
|
||||||
|
height: 6px;
|
||||||
|
background-color: #5ac725;
|
||||||
|
position: absolute;
|
||||||
|
right: 25%;
|
||||||
|
top: 36%;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.business-box {
|
||||||
|
padding: 20rpx 32rpx;
|
||||||
|
padding-right: 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep.business-time-content {
|
||||||
|
.u-cell__title-text {
|
||||||
|
color: #909193;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-cell__label {
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.businees-bottom {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
padding: 36rpx 40rpx 60rpx;
|
||||||
|
background: #fff;
|
||||||
|
|
||||||
|
.bottom-tips {
|
||||||
|
margin-bottom: 32rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #909193;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-update-status {
|
||||||
|
border-color: #ccc;
|
||||||
|
color: #000;
|
||||||
|
font-weight: 500;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-update-status-bg {
|
||||||
|
background: $base-color;
|
||||||
|
border: none;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.inform-popup {
|
||||||
|
::v-deep.u-popup__content {
|
||||||
|
border-radius: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inform-popup-content {
|
||||||
|
width: 600rpx;
|
||||||
|
|
||||||
|
.inform-popup-title {
|
||||||
|
padding: 40rpx;
|
||||||
|
text-align: center;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inform-popup-tips {
|
||||||
|
padding: 0 60rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-btn-list {
|
||||||
|
display: flex;
|
||||||
|
margin: 50rpx;
|
||||||
|
|
||||||
|
.btn-item {
|
||||||
|
width: 46%;
|
||||||
|
height: 80rpx;
|
||||||
|
border-color: #909193;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-item-2 {
|
||||||
|
background: $base-color;
|
||||||
|
color: #fff;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.businees-popup {
|
||||||
|
::v-deep.u-popup__content {
|
||||||
|
margin: 0 28px;
|
||||||
|
min-width: 80%;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.businees-popup-content {
|
||||||
|
position: relative;
|
||||||
|
min-width: 80%;
|
||||||
|
|
||||||
|
.popup-logo {
|
||||||
|
position: absolute;
|
||||||
|
top: -50px;
|
||||||
|
left: 37%;
|
||||||
|
height: 80px;
|
||||||
|
width: 100px;
|
||||||
|
background-image: url("../../../static/store.png");
|
||||||
|
background-size: 100% 100%;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-logo-filter {
|
||||||
|
filter: grayscale(100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.businees-name {
|
||||||
|
margin: 120rpx 0 32rpx;
|
||||||
|
text-align: center;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 36rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.businees-tips-1 {
|
||||||
|
margin-bottom: 32rpx;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #909193;
|
||||||
|
|
||||||
|
.store-name {
|
||||||
|
color: $base-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.businees-tips-2 {
|
||||||
|
margin-bottom: 92rpx;
|
||||||
|
padding: 0px 52rpx;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #909193;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-btn-list {
|
||||||
|
display: flex;
|
||||||
|
margin: 72rpx 44rpx 122rpx;
|
||||||
|
|
||||||
|
.btn-item {
|
||||||
|
width: 46%;
|
||||||
|
height: 80rpx;
|
||||||
|
border-color: #909193;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-item-2 {
|
||||||
|
background: $base-color;
|
||||||
|
color: #fff;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -0,0 +1,374 @@
|
|||||||
|
<template>
|
||||||
|
<!-- 时间选择器弹窗 -->
|
||||||
|
<uni-popup ref="popup" type="bottom" :safe-area="false">
|
||||||
|
<view class="custom-picker">
|
||||||
|
<view class="custom-picker__header">
|
||||||
|
<view class="cancel" :style="{ color: canceColor }" @tap="onCancel">
|
||||||
|
{{ cancelText }}
|
||||||
|
</view>
|
||||||
|
<view class="title">{{ title }}</view>
|
||||||
|
<view class="confirm" :style="{ color: confirmColor }" @tap="onConfirm">
|
||||||
|
{{ confirmText }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="time-tips">
|
||||||
|
为保证有骑手接单,请在配送站点营业时间00:00-24:00内选择
|
||||||
|
</view>
|
||||||
|
<picker-view
|
||||||
|
:indicator-class="indicatorClass"
|
||||||
|
:indicator-style="indicatorStyle"
|
||||||
|
class="picker-view"
|
||||||
|
:value="pickerValue"
|
||||||
|
@change="bindChange"
|
||||||
|
@pickstart="pickstart"
|
||||||
|
@pickend="pickend"
|
||||||
|
>
|
||||||
|
<picker-view-column>
|
||||||
|
<view
|
||||||
|
:class="['picker-view__item']"
|
||||||
|
v-for="(item, index) in rangeList[0]"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
{{ item }}
|
||||||
|
</view>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column>
|
||||||
|
<view
|
||||||
|
class="picker-view__item"
|
||||||
|
v-for="(item, index) in rangeList[1]"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
{{ item }}
|
||||||
|
</view>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column>
|
||||||
|
<view class="picker-view__item">{{ segmentation }}</view>
|
||||||
|
</picker-view-column>
|
||||||
|
|
||||||
|
<picker-view-column>
|
||||||
|
<view
|
||||||
|
class="picker-view__item"
|
||||||
|
v-for="(item, index) in rangeList[2]"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
{{ item }}
|
||||||
|
</view>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column>
|
||||||
|
<view
|
||||||
|
class="picker-view__item"
|
||||||
|
v-for="(item, index) in rangeList[3]"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
{{ item }}
|
||||||
|
</view>
|
||||||
|
</picker-view-column>
|
||||||
|
</picker-view>
|
||||||
|
</view>
|
||||||
|
</uni-popup>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// 滚动数据
|
||||||
|
let range = [[], [], [], []];
|
||||||
|
for (let i = 0; i <= 24; i++) {
|
||||||
|
range[0].push(i >= 10 ? String(i) : `0${i}`);
|
||||||
|
range[2].push(i >= 10 ? String(i) : `0${i}`);
|
||||||
|
}
|
||||||
|
for (let i = 0; i < 60; i++) {
|
||||||
|
range[1].push(i >= 10 ? String(i) : `0${i}`);
|
||||||
|
range[3].push(i >= 10 ? String(i) : `0${i}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "TimePickerPopup",
|
||||||
|
props: {
|
||||||
|
// 当前选中的值
|
||||||
|
value: {
|
||||||
|
type: Array,
|
||||||
|
default: () => ["00", "00", "00", "00"],
|
||||||
|
},
|
||||||
|
// 标题
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: "时间",
|
||||||
|
},
|
||||||
|
// 取消按钮文字
|
||||||
|
cancelText: {
|
||||||
|
type: String,
|
||||||
|
default: "取消",
|
||||||
|
},
|
||||||
|
// 取消按钮颜色
|
||||||
|
canceColor: {
|
||||||
|
type: String,
|
||||||
|
default: "#666666",
|
||||||
|
},
|
||||||
|
// 确定按钮文字
|
||||||
|
confirmText: {
|
||||||
|
type: String,
|
||||||
|
default: "确定",
|
||||||
|
},
|
||||||
|
// 确定按钮颜色
|
||||||
|
confirmColor: {
|
||||||
|
type: String,
|
||||||
|
default: "#2bb781",
|
||||||
|
},
|
||||||
|
// 分割符
|
||||||
|
segmentation: {
|
||||||
|
type: String,
|
||||||
|
default: "-",
|
||||||
|
},
|
||||||
|
// 设置选择器中间选中框的类名 注意页面或组件的style中写了scoped时,需要在类名前写/deep/
|
||||||
|
indicatorClass: {
|
||||||
|
type: String,
|
||||||
|
default: "picker-view__indicator",
|
||||||
|
},
|
||||||
|
// 设置选择器中间选中框的样式
|
||||||
|
indicatorStyle: {
|
||||||
|
type: String,
|
||||||
|
default: "",
|
||||||
|
},
|
||||||
|
maxStartHour: {
|
||||||
|
type: Number,
|
||||||
|
default: 23, // 默认23点
|
||||||
|
},
|
||||||
|
maxStartMinute: {
|
||||||
|
type: Number,
|
||||||
|
default: 30, // 默认59分钟
|
||||||
|
},
|
||||||
|
maxEndHour: {
|
||||||
|
type: Number,
|
||||||
|
default: 24, // 默认23点
|
||||||
|
},
|
||||||
|
maxEndMinute: {
|
||||||
|
type: Number,
|
||||||
|
default: 59, // 默认59分钟
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
rangeList: [],
|
||||||
|
pickerValue: [0, 0, 0, 0],
|
||||||
|
isScoll: false, // 是否正在滚动
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.generateRangeLists();
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
// 监听最大时间限制变化
|
||||||
|
maxStartHour() {
|
||||||
|
this.generateRangeLists();
|
||||||
|
},
|
||||||
|
maxStartMinute() {
|
||||||
|
this.generateRangeLists();
|
||||||
|
},
|
||||||
|
maxEndHour() {
|
||||||
|
this.generateRangeLists();
|
||||||
|
},
|
||||||
|
maxEndMinute() {
|
||||||
|
this.generateRangeLists();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
generateRangeLists() {
|
||||||
|
const ranges = [[], [], [], []];
|
||||||
|
|
||||||
|
// 生成开始小时范围 (0 - maxStartHour)
|
||||||
|
for (let i = 0; i <= this.maxStartHour; i++) {
|
||||||
|
ranges[0].push(i >= 10 ? String(i) : `0${i}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 生成开始分钟范围 (0 - maxStartMinute)
|
||||||
|
for (let i = 0; i <= this.maxStartMinute; i++) {
|
||||||
|
ranges[1].push(i >= 10 ? String(i) : `0${i}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 生成结束小时范围 (0 - maxEndHour)
|
||||||
|
for (let i = 0; i <= this.maxEndHour; i++) {
|
||||||
|
ranges[2].push(i >= 10 ? String(i) : `0${i}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 生成结束分钟范围 (0 - maxEndMinute)
|
||||||
|
// 如果结束小时是24,分钟只能是00
|
||||||
|
if (
|
||||||
|
this.pickerValue &&
|
||||||
|
this.pickerValue[2] === this.rangeList[2]?.length - 1
|
||||||
|
) {
|
||||||
|
ranges[3] = ["00"];
|
||||||
|
} else {
|
||||||
|
for (let i = 0; i <= this.maxEndMinute; i++) {
|
||||||
|
ranges[3].push(i >= 10 ? String(i) : `0${i}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.rangeList = ranges;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 开启弹窗
|
||||||
|
*/
|
||||||
|
open() {
|
||||||
|
this.generateRangeLists();
|
||||||
|
|
||||||
|
if (Array.isArray(this.value) && this.value.length) {
|
||||||
|
this.pickerValue = this.value.map((item, index) => {
|
||||||
|
const i = this.rangeList[index].findIndex(
|
||||||
|
(child) => Number(child) == Number(this.value[index])
|
||||||
|
);
|
||||||
|
return i > -1 ? i : 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
// If initial end hour is 24, ensure minute is 00
|
||||||
|
if (this.pickerValue[2] === this.rangeList[2]?.length - 1) {
|
||||||
|
this.pickerValue[3] = 0;
|
||||||
|
this.generateRangeLists();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.pickerValue = [0, 0, 0, 0];
|
||||||
|
}
|
||||||
|
this.$refs.popup.open();
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 关闭弹窗
|
||||||
|
*/
|
||||||
|
close() {
|
||||||
|
this.$refs.popup.close();
|
||||||
|
// 重置选中数据
|
||||||
|
this.pickerValue = [0, 0, 0, 0];
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 点击确定
|
||||||
|
*/
|
||||||
|
onConfirm() {
|
||||||
|
if (!this.isScoll) {
|
||||||
|
let data = this.value || ["00", "00", "00", "00"];
|
||||||
|
if (this.pickerValue && this.pickerValue.length) {
|
||||||
|
data = this.pickerValue.map((item, index) =>
|
||||||
|
String(this.rangeList[index][item])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
this.$emit("confirm", data);
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 点击取消
|
||||||
|
*/
|
||||||
|
onCancel() {
|
||||||
|
this.close();
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 滚动开始
|
||||||
|
*/
|
||||||
|
pickstart() {
|
||||||
|
this.isScoll = true;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 滚动结束
|
||||||
|
*/
|
||||||
|
pickend() {
|
||||||
|
this.isScoll = false;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 选择器改变
|
||||||
|
* @param {Object} e
|
||||||
|
*/
|
||||||
|
bindChange(e) {
|
||||||
|
const newValue = [...e.detail.value];
|
||||||
|
|
||||||
|
// Check if end hour (index 2) is being set to 24
|
||||||
|
if (newValue[2] === this.rangeList[2]?.length - 1) {
|
||||||
|
// Assuming 24 is the last option
|
||||||
|
newValue[3] = 0; // Set to first (and only) option which is '00'
|
||||||
|
this.pickerValue = newValue;
|
||||||
|
this.generateRangeLists(); // Regenerate ranges to limit minutes
|
||||||
|
} else {
|
||||||
|
this.pickerValue = newValue;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.custom-picker {
|
||||||
|
width: 100%;
|
||||||
|
height: 620rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
padding-bottom: 0;
|
||||||
|
padding-bottom: constant(safe-area-inset-bottom);
|
||||||
|
padding-bottom: env(safe-area-inset-bottom);
|
||||||
|
|
||||||
|
&__header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 30rpx 40rpx;
|
||||||
|
|
||||||
|
.cancel {
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.confirm {
|
||||||
|
color: #2bb781;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.picker-view {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
|
||||||
|
&__item {
|
||||||
|
line-height: 100rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep &__indicator {
|
||||||
|
height: 100rpx;
|
||||||
|
color: #2bb781;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__segmentation {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.time-tips {
|
||||||
|
padding: 24rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
background: #fadbd8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.acitve {
|
||||||
|
&::after,
|
||||||
|
&::before {
|
||||||
|
position: initial;
|
||||||
|
}
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
background: #efefef;
|
||||||
|
margin: 0 16rpx;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .uni-picker-view-content {
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .uni-picker-view-indicator {
|
||||||
|
width: 82%;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .picker-view__item {
|
||||||
|
margin-left: 20rpx;
|
||||||
|
width: 80%;
|
||||||
|
font-size: 36rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -0,0 +1,869 @@
|
|||||||
|
<template>
|
||||||
|
<view class="tui-datetime-picker" :style="{ zIndex }">
|
||||||
|
<view
|
||||||
|
class="tui-datetime__mask"
|
||||||
|
:class="{ 'tui-datetime__mask-show': isShow }"
|
||||||
|
:style="{ zIndex: getMaskZIndex }"
|
||||||
|
@touchmove.stop.prevent="stop"
|
||||||
|
catchtouchmove="stop"
|
||||||
|
@tap="maskClick"
|
||||||
|
></view>
|
||||||
|
<view
|
||||||
|
class="tui-datetime__header"
|
||||||
|
:class="{ 'tui-show': isShow }"
|
||||||
|
:style="{ zIndex: getPickerZIndex }"
|
||||||
|
>
|
||||||
|
<view
|
||||||
|
class="tui-picker-header"
|
||||||
|
:class="{ 'tui-date-radius': radius }"
|
||||||
|
:style="{ backgroundColor: headerBackground }"
|
||||||
|
@touchmove.stop.prevent="stop"
|
||||||
|
catchtouchmove="stop"
|
||||||
|
>
|
||||||
|
<view
|
||||||
|
class="tui-btn-picker"
|
||||||
|
:style="{ color: cancelColor }"
|
||||||
|
hover-class="tui-opacity"
|
||||||
|
:hover-stay-time="150"
|
||||||
|
@tap="hide"
|
||||||
|
>
|
||||||
|
取消
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="tui-pickerdate__title"
|
||||||
|
:style="{ fontSize: titleSize + 'rpx', color: titleColor }"
|
||||||
|
>
|
||||||
|
{{ title }}
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="tui-btn-picker"
|
||||||
|
:style="{ color: getColor }"
|
||||||
|
hover-class="tui-opacity"
|
||||||
|
:hover-stay-time="150"
|
||||||
|
@tap="btnFix"
|
||||||
|
>
|
||||||
|
确定
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="tui-date-header"
|
||||||
|
:style="{ backgroundColor: unitBackground }"
|
||||||
|
v-if="unitTop"
|
||||||
|
>
|
||||||
|
<view class="tui-date-unit" v-if="type < 4 || type == 7 || type == 8">
|
||||||
|
年
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="tui-date-unit"
|
||||||
|
v-if="(type < 4 && type > 0) || type == 7 || type == 8"
|
||||||
|
>
|
||||||
|
月
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="tui-date-unit"
|
||||||
|
v-if="type == 1 || type == 2 || type == 7 || type == 8"
|
||||||
|
>
|
||||||
|
日
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="tui-date-unit"
|
||||||
|
v-if="type == 1 || type == 4 || type == 5 || type == 7 || type == 8"
|
||||||
|
>
|
||||||
|
时
|
||||||
|
</view>
|
||||||
|
<view class="tui-date-unit" v-if="(type == 1 || type > 3) && type != 8">
|
||||||
|
分
|
||||||
|
</view>
|
||||||
|
<view class="tui-date-unit" v-if="type > 4 && type != 8">秒</view>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
@touchstart.stop="pickerstart"
|
||||||
|
class="tui-date__picker-body"
|
||||||
|
:style="{ backgroundColor: bodyBackground, height: height + 'rpx' }"
|
||||||
|
>
|
||||||
|
<picker-view
|
||||||
|
:key="type"
|
||||||
|
:immediate-change="immediate"
|
||||||
|
:value="value"
|
||||||
|
@change="change"
|
||||||
|
class="tui-datetime__picker-view"
|
||||||
|
>
|
||||||
|
<picker-view-column v-if="type < 4 || type == 7 || type == 8">
|
||||||
|
<view
|
||||||
|
class="tui-date__column-item"
|
||||||
|
:class="{ 'tui-font-size_32': !unitTop && type == 7 }"
|
||||||
|
v-for="(item, index) in years"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
{{ item }}
|
||||||
|
<text class="tui-date__unit-text" v-if="!unitTop">年</text>
|
||||||
|
</view>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column
|
||||||
|
v-if="(type < 4 && type > 0) || type == 7 || type == 8"
|
||||||
|
>
|
||||||
|
<view
|
||||||
|
class="tui-date__column-item"
|
||||||
|
:class="{ 'tui-font-size_32': !unitTop && type == 7 }"
|
||||||
|
v-for="(item, index) in months"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
{{ formatNum(item) }}
|
||||||
|
<text class="tui-date__unit-text" v-if="!unitTop">月</text>
|
||||||
|
</view>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column
|
||||||
|
v-if="type == 1 || type == 2 || type == 7 || type == 8"
|
||||||
|
>
|
||||||
|
<view
|
||||||
|
class="tui-date__column-item"
|
||||||
|
:class="{ 'tui-font-size_32': !unitTop && type == 7 }"
|
||||||
|
v-for="(item, index) in days"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
{{ formatNum(item) }}
|
||||||
|
<text class="tui-date__unit-text" v-if="!unitTop">日</text>
|
||||||
|
</view>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column
|
||||||
|
v-if="type == 1 || type == 4 || type == 5 || type == 7 || type == 8"
|
||||||
|
>
|
||||||
|
<view
|
||||||
|
class="tui-date__column-item"
|
||||||
|
:class="{ 'tui-font-size_32': !unitTop && type == 7 }"
|
||||||
|
v-for="(item, index) in hours"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
{{ formatNum(item) }}
|
||||||
|
<text class="tui-date__unit-text" v-if="!unitTop"></text>
|
||||||
|
</view>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column v-if="(type == 1 || type > 3) && type != 8">
|
||||||
|
<view
|
||||||
|
class="tui-date__column-item"
|
||||||
|
:class="{ 'tui-font-size_32': !unitTop && type == 7 }"
|
||||||
|
v-for="(item, index) in minutes"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
{{ formatNum(item) }}
|
||||||
|
<text class="tui-date__unit-text" v-if="!unitTop"></text>
|
||||||
|
</view>
|
||||||
|
</picker-view-column>
|
||||||
|
<picker-view-column v-if="type > 4 && type != 8">
|
||||||
|
<view
|
||||||
|
class="tui-date__column-item"
|
||||||
|
:class="{ 'tui-font-size_32': !unitTop && type == 7 }"
|
||||||
|
v-for="(item, index) in seconds"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
{{ formatNum(item) }}
|
||||||
|
<text class="tui-date__unit-text" v-if="!unitTop">秒</text>
|
||||||
|
</view>
|
||||||
|
</picker-view-column>
|
||||||
|
</picker-view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "tuiDatetime",
|
||||||
|
emits: ["cancel", "confirm"],
|
||||||
|
props: {
|
||||||
|
//0-年 1-日期+时间(年月日+时分) 2-日期(年月日) 3-日期(年月) 4-时间(时分) 5-时分秒 6-分秒 7-年月日 时分秒 8-年月日+小时
|
||||||
|
type: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: 1,
|
||||||
|
},
|
||||||
|
//年份区间
|
||||||
|
startYear: {
|
||||||
|
type: Number,
|
||||||
|
default: 1980,
|
||||||
|
},
|
||||||
|
//年份区间
|
||||||
|
endYear: {
|
||||||
|
type: Number,
|
||||||
|
default: 2050,
|
||||||
|
},
|
||||||
|
hoursData: {
|
||||||
|
type: Array,
|
||||||
|
default() {
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
minutesData: {
|
||||||
|
type: Array,
|
||||||
|
default() {
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
secondsData: {
|
||||||
|
type: Array,
|
||||||
|
default() {
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
//显示标题
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: "",
|
||||||
|
},
|
||||||
|
//标题字体大小
|
||||||
|
titleSize: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: 34,
|
||||||
|
},
|
||||||
|
//标题字体颜色
|
||||||
|
titleColor: {
|
||||||
|
type: String,
|
||||||
|
default: "#333",
|
||||||
|
},
|
||||||
|
//"取消"字体颜色
|
||||||
|
cancelColor: {
|
||||||
|
type: String,
|
||||||
|
default: "#888",
|
||||||
|
},
|
||||||
|
//"确定"字体颜色
|
||||||
|
color: {
|
||||||
|
type: String,
|
||||||
|
default: "",
|
||||||
|
},
|
||||||
|
//设置默认显示日期 2019-08-01 || 2019-08-01 17:01 || 2019/08/01
|
||||||
|
setDateTime: {
|
||||||
|
type: String,
|
||||||
|
default: "",
|
||||||
|
},
|
||||||
|
//单位置顶
|
||||||
|
unitTop: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
//圆角设置
|
||||||
|
radius: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
//头部背景色
|
||||||
|
headerBackground: {
|
||||||
|
type: String,
|
||||||
|
default: "#fff",
|
||||||
|
},
|
||||||
|
//根据实际调整,不建议使用深颜色
|
||||||
|
bodyBackground: {
|
||||||
|
type: String,
|
||||||
|
default: "#fff",
|
||||||
|
},
|
||||||
|
//单位置顶时,单位条背景色
|
||||||
|
unitBackground: {
|
||||||
|
type: String,
|
||||||
|
default: "#fff",
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: 520,
|
||||||
|
},
|
||||||
|
//点击遮罩 是否可关闭
|
||||||
|
maskClosable: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
zIndex: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: 998,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
let immediate = true;
|
||||||
|
// #ifdef MP-TOUTIAO
|
||||||
|
immediate = false;
|
||||||
|
// #endif
|
||||||
|
return {
|
||||||
|
immediate,
|
||||||
|
isShow: false,
|
||||||
|
years: [],
|
||||||
|
months: [],
|
||||||
|
days: [],
|
||||||
|
hours: [],
|
||||||
|
minutes: [],
|
||||||
|
seconds: [],
|
||||||
|
year: 0,
|
||||||
|
month: 0,
|
||||||
|
day: 0,
|
||||||
|
hour: 0,
|
||||||
|
minute: 0,
|
||||||
|
second: 0,
|
||||||
|
startDate: "",
|
||||||
|
endDate: "",
|
||||||
|
value: [],
|
||||||
|
isEnd: true,
|
||||||
|
isChange: false,
|
||||||
|
isSelect: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.initData();
|
||||||
|
}, 20);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
yearOrMonth() {
|
||||||
|
return `${this.year}-${this.month}`;
|
||||||
|
},
|
||||||
|
propsChange() {
|
||||||
|
return `${this.type}-${this.startYear}-${this.endYear}-${this.hoursData}-${this.minutesData}-${this.secondsData}`;
|
||||||
|
},
|
||||||
|
getColor() {
|
||||||
|
return (
|
||||||
|
this.color || (uni && uni.$tui && uni.$tui.color.primary) || "#5677fc"
|
||||||
|
);
|
||||||
|
},
|
||||||
|
getMaskZIndex() {
|
||||||
|
return Number(this.zIndex) + 1;
|
||||||
|
},
|
||||||
|
getPickerZIndex() {
|
||||||
|
return Number(this.zIndex) + 2;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
yearOrMonth() {
|
||||||
|
this.setDays();
|
||||||
|
},
|
||||||
|
propsChange() {
|
||||||
|
if (this.isChange) return;
|
||||||
|
this.isChange = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.isChange = false;
|
||||||
|
this.initData();
|
||||||
|
}, 50);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
setDateTime(val) {
|
||||||
|
if (val && val !== true) {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.initData();
|
||||||
|
}, 20);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
stop() {},
|
||||||
|
formatNum: function (num) {
|
||||||
|
return num < 10 ? "0" + num : num + "";
|
||||||
|
},
|
||||||
|
generateArray: function (start, end) {
|
||||||
|
return Array.from(new Array(end + 1).keys()).slice(start);
|
||||||
|
},
|
||||||
|
getIndex: function (arr, val) {
|
||||||
|
if (!arr || arr.length === 0 || val === undefined) return 0;
|
||||||
|
let index = arr.indexOf(val);
|
||||||
|
return index == -1 ? 0 : index;
|
||||||
|
},
|
||||||
|
getCharCount(str) {
|
||||||
|
let regex = new RegExp("/", "g");
|
||||||
|
let result = str.match(regex);
|
||||||
|
return !result ? 0 : result.length;
|
||||||
|
},
|
||||||
|
//日期时间处理
|
||||||
|
initSelectValue() {
|
||||||
|
let fdate = "";
|
||||||
|
if (this.setDateTime && this.setDateTime !== true) {
|
||||||
|
fdate = this.setDateTime.replace(/\-/g, "/");
|
||||||
|
if (this.type == 3 && this.getCharCount(fdate) === 1) {
|
||||||
|
fdate += "/01";
|
||||||
|
} else if (this.type == 0) {
|
||||||
|
fdate += "/01/01";
|
||||||
|
}
|
||||||
|
fdate =
|
||||||
|
fdate && fdate.indexOf("/") == -1 ? `2023/01/01 ${fdate}` : fdate;
|
||||||
|
}
|
||||||
|
let time = null;
|
||||||
|
if (fdate) time = new Date(fdate);
|
||||||
|
else time = new Date();
|
||||||
|
let year = time.getFullYear();
|
||||||
|
if (year > this.endYear) {
|
||||||
|
year = this.endYear;
|
||||||
|
} else if (year < this.startYear) {
|
||||||
|
year = this.startYear;
|
||||||
|
}
|
||||||
|
const month = time.getMonth() + 1;
|
||||||
|
const day = time.getDate();
|
||||||
|
const hour = time.getHours();
|
||||||
|
const minute = time.getMinutes();
|
||||||
|
const second = time.getSeconds();
|
||||||
|
this.year = year;
|
||||||
|
this.month = month;
|
||||||
|
this.day = day;
|
||||||
|
this.hour = hour;
|
||||||
|
this.minute = minute;
|
||||||
|
this.second = second;
|
||||||
|
|
||||||
|
return [year, month, day, hour, minute, second];
|
||||||
|
},
|
||||||
|
initData() {
|
||||||
|
const def = this.initSelectValue();
|
||||||
|
const type = Number(this.type);
|
||||||
|
switch (type) {
|
||||||
|
case 0:
|
||||||
|
this.setYears();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
this.setYears();
|
||||||
|
this.setMonths();
|
||||||
|
this.setDays();
|
||||||
|
this.setHours();
|
||||||
|
this.setMinutes();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
this.setYears();
|
||||||
|
this.setMonths();
|
||||||
|
this.setDays();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
this.setYears();
|
||||||
|
this.setMonths();
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
this.setHours();
|
||||||
|
this.setMinutes();
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
this.setHours();
|
||||||
|
this.setMinutes();
|
||||||
|
this.setSeconds();
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
this.setMinutes();
|
||||||
|
this.setSeconds();
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
this.setYears();
|
||||||
|
this.setMonths();
|
||||||
|
this.setDays();
|
||||||
|
this.setHours();
|
||||||
|
this.setMinutes();
|
||||||
|
this.setSeconds();
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
this.setYears();
|
||||||
|
this.setMonths();
|
||||||
|
this.setDays();
|
||||||
|
this.setHours();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
this.$nextTick(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.setDefaultValues(def);
|
||||||
|
}, 50);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
setDefaultValues(def) {
|
||||||
|
let vals = [];
|
||||||
|
// 1-年月日+时分 2-年月日 3-年月 4-时分 5-时分秒 6-分秒 7-年月日 时分秒 8-年月日+小时
|
||||||
|
const year = this.getIndex(this.years, def[0]);
|
||||||
|
|
||||||
|
const month = this.getIndex(this.months, def[1]);
|
||||||
|
const day = this.getIndex(this.days, def[2]);
|
||||||
|
const hour = this.getIndex(this.hours, def[3]);
|
||||||
|
const minute = this.getIndex(this.minutes, def[4]);
|
||||||
|
const second = this.getIndex(this.seconds, def[5]);
|
||||||
|
|
||||||
|
// console.log(year, month, day, hour, minute, second)
|
||||||
|
const type = Number(this.type);
|
||||||
|
switch (type) {
|
||||||
|
case 0:
|
||||||
|
vals = [year];
|
||||||
|
case 1:
|
||||||
|
vals = [year, month, day, hour, minute];
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
vals = [year, month, day];
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
vals = [year, month];
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
vals = [hour, minute];
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
vals = [hour, minute, second];
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
vals = [minute, second];
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
vals = [year, month, day, hour, minute, second];
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
vals = [year, month, day, hour];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (this.value.join(",") === vals.join(",")) return;
|
||||||
|
setTimeout(() => {
|
||||||
|
this.value = vals;
|
||||||
|
}, 150);
|
||||||
|
},
|
||||||
|
setYears() {
|
||||||
|
this.years = this.generateArray(this.startYear, this.endYear);
|
||||||
|
},
|
||||||
|
setMonths() {
|
||||||
|
this.months = this.generateArray(1, 12);
|
||||||
|
},
|
||||||
|
setDays() {
|
||||||
|
if (this.type == 3 || this.type == 4) return;
|
||||||
|
let totalDays = new Date(this.year, this.month, 0).getDate();
|
||||||
|
totalDays = !totalDays || totalDays < 1 ? 1 : totalDays;
|
||||||
|
this.days = this.generateArray(1, totalDays);
|
||||||
|
},
|
||||||
|
setHours() {
|
||||||
|
if (this.hoursData && this.hoursData.length > 0) {
|
||||||
|
this.hours = this.hoursData;
|
||||||
|
} else {
|
||||||
|
this.hours = this.generateArray(0, 23);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setMinutes() {
|
||||||
|
if (this.minutesData && this.minutesData.length > 0) {
|
||||||
|
this.minutes = this.minutesData;
|
||||||
|
} else {
|
||||||
|
this.minutes = this.generateArray(0, 59);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setSeconds() {
|
||||||
|
if (this.secondsData && this.secondsData.length > 0) {
|
||||||
|
this.seconds = this.secondsData;
|
||||||
|
} else {
|
||||||
|
this.seconds = this.generateArray(0, 59);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
show() {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.isShow = true;
|
||||||
|
}, 250);
|
||||||
|
},
|
||||||
|
hide() {
|
||||||
|
this.isShow = false;
|
||||||
|
this.$emit("cancel", {});
|
||||||
|
},
|
||||||
|
maskClick() {
|
||||||
|
if (!this.maskClosable) return;
|
||||||
|
this.hide();
|
||||||
|
},
|
||||||
|
change(e) {
|
||||||
|
this.value = e.detail.value;
|
||||||
|
const type = Number(this.type);
|
||||||
|
switch (type) {
|
||||||
|
case 0:
|
||||||
|
this.year = this.years[this.value[0]];
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
this.year = this.years[this.value[0]];
|
||||||
|
this.month = this.months[this.value[1]];
|
||||||
|
this.day = this.days[this.value[2]];
|
||||||
|
this.hour = this.hours[this.value[3]];
|
||||||
|
this.minute = this.minutes[this.value[4]];
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
this.year = this.years[this.value[0]];
|
||||||
|
this.month = this.months[this.value[1]];
|
||||||
|
this.day = this.days[this.value[2]];
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
this.year = this.years[this.value[0]];
|
||||||
|
this.month = this.months[this.value[1]];
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
this.hour = this.hours[this.value[0]];
|
||||||
|
this.minute = this.minutes[this.value[1]];
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
this.hour = this.hours[this.value[0]];
|
||||||
|
this.minute = this.minutes[this.value[1]];
|
||||||
|
this.second = this.seconds[this.value[2]];
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
this.minute = this.minutes[this.value[0]];
|
||||||
|
this.second = this.seconds[this.value[1]];
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
this.year = this.years[this.value[0]];
|
||||||
|
this.month = this.months[this.value[1]];
|
||||||
|
this.day = this.days[this.value[2]];
|
||||||
|
this.hour = this.hours[this.value[3]];
|
||||||
|
this.minute = this.minutes[this.value[4]];
|
||||||
|
this.second = this.seconds[this.value[5]];
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
this.year = this.years[this.value[0]];
|
||||||
|
this.month = this.months[this.value[1]];
|
||||||
|
this.day = this.days[this.value[2]];
|
||||||
|
this.hour = this.hours[this.value[3]];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
this.isEnd = true;
|
||||||
|
},
|
||||||
|
selectResult() {
|
||||||
|
let result = {};
|
||||||
|
let year = this.year;
|
||||||
|
let month = this.formatNum(this.month || 0);
|
||||||
|
let day = this.formatNum(this.day || 0);
|
||||||
|
let hour = this.formatNum(this.hour || 0);
|
||||||
|
let minute = this.formatNum(this.minute || 0);
|
||||||
|
let second = this.formatNum(this.second || 0);
|
||||||
|
const type = Number(this.type);
|
||||||
|
switch (type) {
|
||||||
|
case 0:
|
||||||
|
result = {
|
||||||
|
year: year,
|
||||||
|
result: year,
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
result = {
|
||||||
|
year: year,
|
||||||
|
month: month,
|
||||||
|
day: day,
|
||||||
|
hour: hour,
|
||||||
|
minute: minute,
|
||||||
|
result: `${year}-${month}-${day} ${hour}:${minute}`,
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
result = {
|
||||||
|
year: year,
|
||||||
|
month: month,
|
||||||
|
day: day,
|
||||||
|
result: `${year}-${month}-${day}`,
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
result = {
|
||||||
|
year: year,
|
||||||
|
month: month,
|
||||||
|
result: `${year}-${month}`,
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
result = {
|
||||||
|
hour: hour,
|
||||||
|
minute: minute,
|
||||||
|
result: `${hour}:${minute}`,
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
result = {
|
||||||
|
hour: hour,
|
||||||
|
minute: minute,
|
||||||
|
second: second,
|
||||||
|
result: `${hour}:${minute}:${second}`,
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
result = {
|
||||||
|
minute: minute,
|
||||||
|
second: second,
|
||||||
|
result: `${minute}:${second}`,
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
result = {
|
||||||
|
year: year,
|
||||||
|
month: month,
|
||||||
|
day: day,
|
||||||
|
hour: hour,
|
||||||
|
minute: minute,
|
||||||
|
second: second,
|
||||||
|
result: `${year}-${month}-${day} ${hour}:${minute}:${second}`,
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
result = {
|
||||||
|
year: year,
|
||||||
|
month: month,
|
||||||
|
day: day,
|
||||||
|
hour: hour,
|
||||||
|
result: `${year}-${month}-${day} ${hour}:00`,
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
this.$emit("confirm", result);
|
||||||
|
},
|
||||||
|
waitFix(index = 0) {
|
||||||
|
if (this.isEnd) {
|
||||||
|
this.selectResult();
|
||||||
|
} else {
|
||||||
|
index++;
|
||||||
|
if (index >= 20) {
|
||||||
|
this.isEnd = true;
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
this.waitFix(index);
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
btnFix() {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.waitFix();
|
||||||
|
this.hide();
|
||||||
|
}, 80);
|
||||||
|
},
|
||||||
|
pickerstart() {
|
||||||
|
this.isEnd = false;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.tui-datetime-picker {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tui-datetime__picker-view {
|
||||||
|
height: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tui-datetime__mask {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
background-color: rgba(0, 0, 0, 0.6);
|
||||||
|
visibility: hidden;
|
||||||
|
opacity: 0;
|
||||||
|
transition: all 0.3s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tui-datetime__mask-show {
|
||||||
|
visibility: visible !important;
|
||||||
|
opacity: 1 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tui-datetime__header {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
opacity: 0;
|
||||||
|
transition: all 0.3s ease-in-out;
|
||||||
|
transform: translateY(100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tui-date-header {
|
||||||
|
width: 100%;
|
||||||
|
height: 52rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
font-size: 26rpx;
|
||||||
|
line-height: 26rpx;
|
||||||
|
/* #ifdef MP */
|
||||||
|
box-shadow: 0 15rpx 10rpx -15rpx #efefef;
|
||||||
|
/* #endif */
|
||||||
|
/* #ifndef MP */
|
||||||
|
box-shadow: 0 15rpx 10rpx -15rpx #888;
|
||||||
|
/* #endif */
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tui-date-unit {
|
||||||
|
flex: 1;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tui-show {
|
||||||
|
transform: translateY(0);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tui-picker-header {
|
||||||
|
width: 100%;
|
||||||
|
height: 90rpx;
|
||||||
|
padding: 0 40rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-size: 32rpx;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tui-date-radius {
|
||||||
|
border-top-left-radius: 20rpx;
|
||||||
|
border-top-right-radius: 20rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tui-picker-header::after {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
border-bottom: 1rpx solid #eaeef1;
|
||||||
|
-webkit-transform: scaleY(0.5);
|
||||||
|
transform: scaleY(0.5);
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tui-date__picker-body {
|
||||||
|
width: 100%;
|
||||||
|
/* height: 520rpx; */
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tui-date__column-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 36rpx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tui-font-size_32 {
|
||||||
|
font-size: 32rpx !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tui-date__unit-text {
|
||||||
|
font-size: 24rpx !important;
|
||||||
|
padding-left: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tui-btn-picker {
|
||||||
|
padding: 16rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
text-align: center;
|
||||||
|
text-decoration: none;
|
||||||
|
flex-shrink: 0;
|
||||||
|
/* #ifdef H5 */
|
||||||
|
cursor: pointer;
|
||||||
|
/* #endif */
|
||||||
|
}
|
||||||
|
|
||||||
|
.tui-opacity {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tui-pickerdate__title {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
flex: 1;
|
||||||
|
padding: 0 30rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -0,0 +1,170 @@
|
|||||||
|
<template>
|
||||||
|
<view class="businessStatus-container">
|
||||||
|
<view class="hander">
|
||||||
|
<view class="site-time">配送站点营业时间 00:00-24:00</view>
|
||||||
|
<view class="tips-item">
|
||||||
|
门店营业时间需在配送站点营业时间内才会有骑手配送
|
||||||
|
</view>
|
||||||
|
<view class="tips-item tips-item-2">
|
||||||
|
如需在此时间范围外营业,请咨询业务经理调整配送方式
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="business-time-content" @click="showTimePopup">
|
||||||
|
<view class="time-box">
|
||||||
|
<view calss="time">23:30</view>
|
||||||
|
<view>至</view>
|
||||||
|
<view calss="time">23:30</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<ozTimePicker
|
||||||
|
ref="timePickerPopupRef"
|
||||||
|
title="设置营业时间段"
|
||||||
|
segmentation="至"
|
||||||
|
:value="['00', '00', '00', '00']"
|
||||||
|
indicator-class="picker-view__indicator acitve"
|
||||||
|
></ozTimePicker>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { GetAccountDashboard } from "../../../api/user";
|
||||||
|
import { UpdateStoreBizState } from "../../../api/store";
|
||||||
|
import tuiDatetime from "./tui-datetime/tui-datetime.vue";
|
||||||
|
import ozTimePicker from "./oz-timePicker/oz-timePicker.vue";
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
tuiDatetime,
|
||||||
|
ozTimePicker,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dashboardInfo: {
|
||||||
|
data: {},
|
||||||
|
notice: {},
|
||||||
|
order: {
|
||||||
|
yestoday_num: 0,
|
||||||
|
},
|
||||||
|
product: {
|
||||||
|
illegal_num: 0,
|
||||||
|
normal_num: 0,
|
||||||
|
off_num: 0,
|
||||||
|
total_num: 0,
|
||||||
|
verify_passed_off_num: 0,
|
||||||
|
verify_refused_num: 0,
|
||||||
|
verify_waiting_num: 0,
|
||||||
|
},
|
||||||
|
return: {
|
||||||
|
fin_num: 0,
|
||||||
|
review_num: 0,
|
||||||
|
total_num: 0,
|
||||||
|
un_fin_num: 0,
|
||||||
|
},
|
||||||
|
store_info: {
|
||||||
|
store_id: 1,
|
||||||
|
store_name: "",
|
||||||
|
store_biz_state: 1,
|
||||||
|
info: {
|
||||||
|
store_opening_hours: "",
|
||||||
|
store_close_hours: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
showPopup: false,
|
||||||
|
dateTime: "",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
businessTime() {
|
||||||
|
return `${this.dashboardInfo.store_info.info.store_opening_hours}-${this.dashboardInfo.store_info.info.store_close_hours}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.getAccountDashboard();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async getAccountDashboard() {
|
||||||
|
let res = await GetAccountDashboard();
|
||||||
|
if (res && res.status == 200) {
|
||||||
|
uni.setStorageSync("accountDashboard", res.data);
|
||||||
|
this.dashboardInfo = res.data;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
showTimePopup() {
|
||||||
|
this.$refs.timePickerPopupRef.open();
|
||||||
|
},
|
||||||
|
closeTimePopup() {
|
||||||
|
this.showPopup = false;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@import "@/styles/variables.scss";
|
||||||
|
.businessStatus-container {
|
||||||
|
.hander {
|
||||||
|
padding: 52rpx 40rpx 88rpx;
|
||||||
|
background: linear-gradient(33deg, #f7d8de 0%, #fff 100%);
|
||||||
|
|
||||||
|
.site-time {
|
||||||
|
margin-bottom: 40rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 36rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tips-item {
|
||||||
|
position: relative;
|
||||||
|
padding-left: 28rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
margin-bottom: 32rpx;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: "";
|
||||||
|
display: block;
|
||||||
|
width: 12rpx;
|
||||||
|
height: 12rpx;
|
||||||
|
background-color: #0a0301;
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 36%;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tips-item-2 {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.business-time-content {
|
||||||
|
position: relative;
|
||||||
|
top: -20rpx;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
z-index: 2;
|
||||||
|
background: #fff;
|
||||||
|
|
||||||
|
.time-box {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-evenly;
|
||||||
|
margin: 100rpx 40rpx;
|
||||||
|
padding: 36rpx 40rpx;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
background: #f5f6fa;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.time-popup {
|
||||||
|
.time-popup-content {
|
||||||
|
border-radius: 12px;
|
||||||
|
height: 800rpx;
|
||||||
|
|
||||||
|
.time-popup-title {
|
||||||
|
padding: 24rpx;
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -162,7 +162,9 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="order-remark">
|
<view class="order-remark">
|
||||||
<text style="color: #fff; font-weight: bold">备注:</text>
|
<text style="color: #fff; font-weight: bold">备注:</text>
|
||||||
<text style="color: #fff;">{{ item.buyer_info.order_message }}</text>
|
<text style="color: #fff">
|
||||||
|
{{ item.buyer_info.order_message }}
|
||||||
|
</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="commodity-info-block">
|
<view class="commodity-info-block">
|
||||||
<view class="commodity-num">
|
<view class="commodity-num">
|
||||||
@ -191,18 +193,18 @@
|
|||||||
<view class="commodity-specification">
|
<view class="commodity-specification">
|
||||||
规格
|
规格
|
||||||
<text style="padding-left: 8rpx">
|
<text style="padding-left: 8rpx">
|
||||||
{{ item.specification || 0 }}
|
{{ group.specification || 0 }}
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="commodity-num">
|
<view class="commodity-num">
|
||||||
X
|
X
|
||||||
<text style="padding-left: 8rpx">
|
<text style="padding-left: 8rpx">
|
||||||
{{ item.order_item_quantity || 0 }}
|
{{ group.order_item_quantity || 0 }}
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="commodity-price">
|
<view class="commodity-price">
|
||||||
¥{{ item.item_cost_price || 0 }}
|
¥{{ group.order_item_amount || 0 }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -288,11 +290,11 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="order-btn-block">
|
<view class="order-btn-block">
|
||||||
<view class="btn-list">
|
<!-- <view class="btn-list">
|
||||||
<u-button class="btn-item">取消订单</u-button>
|
<u-button class="btn-item">取消订单</u-button>
|
||||||
<u-button class="btn-item">退差价</u-button>
|
<u-button class="btn-item">退差价</u-button>
|
||||||
<u-button class="btn-item">部分退款</u-button>
|
<u-button class="btn-item">部分退款</u-button>
|
||||||
</view>
|
</view> -->
|
||||||
<view class="arrow-item" @click="showRefundOrderInfo(item, index)">
|
<view class="arrow-item" @click="showRefundOrderInfo(item, index)">
|
||||||
{{ item.showRefundOrderInfo ? "收起订单" : "展开订单" }}
|
{{ item.showRefundOrderInfo ? "收起订单" : "展开订单" }}
|
||||||
<u-icon
|
<u-icon
|
||||||
@ -455,7 +457,7 @@
|
|||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="commodity-price">
|
<view class="commodity-price">
|
||||||
¥{{ item.item_cost_price || 0 }}
|
¥{{ item.order_item_amount || 0 }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -816,10 +818,6 @@ export default {
|
|||||||
tuiDropdownList,
|
tuiDropdownList,
|
||||||
tabbar,
|
tabbar,
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
...mapState("account", ["accountInfo"]),
|
|
||||||
...mapState("user", ["userInfo"]),
|
|
||||||
},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
showDropdown: false,
|
showDropdown: false,
|
||||||
@ -960,8 +958,44 @@ export default {
|
|||||||
showOrderLoading: false,
|
showOrderLoading: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState("account", ["accountInfo"]),
|
||||||
|
...mapState("user", ["userInfo"]),
|
||||||
|
...mapState("order", ["pushOrderInfo"]),
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
pushOrderInfo: {
|
||||||
|
handler(newValue, oldValue) {
|
||||||
|
if (newValue) {
|
||||||
|
console.log("order watch", newValue);
|
||||||
|
|
||||||
|
this.orderInfo.order_page_list.records.unshift(newValue);
|
||||||
|
|
||||||
|
this.orderInfo.order_page_list.records =
|
||||||
|
this.orderInfo.order_page_list.records.map((item, index) => ({
|
||||||
|
...item, // 保留原有属性
|
||||||
|
orderNum: index + 1, // 重新分配 orderNum (1, 2, 3, ...)
|
||||||
|
}));
|
||||||
|
|
||||||
|
console.log(this.orderInfo.order_page_list.records);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
onLoad() {},
|
onLoad() {},
|
||||||
onShow() {
|
onShow() {
|
||||||
|
let accountDashboard = uni.getStorageSync("accountDashboard");
|
||||||
|
let auditInfo = uni.getStorageSync("auditInfo");
|
||||||
|
|
||||||
|
if (accountDashboard) {
|
||||||
|
this.shopNmae = accountDashboard.store_info.store_name;
|
||||||
|
this.logoUrl = accountDashboard.store_info.store_logo;
|
||||||
|
} else {
|
||||||
|
this.getAccountDashboard();
|
||||||
|
}
|
||||||
|
if (!auditInfo) {
|
||||||
|
this.getAuditInfo();
|
||||||
|
}
|
||||||
|
|
||||||
this.getOrderList();
|
this.getOrderList();
|
||||||
},
|
},
|
||||||
@ -979,24 +1013,11 @@ export default {
|
|||||||
// this.getOrderList();
|
// this.getOrderList();
|
||||||
// }, 500);
|
// }, 500);
|
||||||
// },
|
// },
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
async getOrderList() {
|
async getOrderList() {
|
||||||
|
// this.showOrderLoading = true;
|
||||||
|
|
||||||
let accountDashboard = uni.getStorageSync("accountDashboard");
|
|
||||||
let auditInfo = uni.getStorageSync("auditInfo");
|
|
||||||
|
|
||||||
if (accountDashboard) {
|
|
||||||
this.shopNmae = accountDashboard.store_info.store_name;
|
|
||||||
this.logoUrl = accountDashboard.store_info.store_logo;
|
|
||||||
} else {
|
|
||||||
await this.getAccountDashboard();
|
|
||||||
}
|
|
||||||
if (!auditInfo) {
|
|
||||||
await this.getAuditInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.showOrderLoading = true;
|
|
||||||
console.log(this.accountInfo)
|
|
||||||
this.params = {
|
this.params = {
|
||||||
storeId: this.accountInfo.store_info.store_id,
|
storeId: this.accountInfo.store_info.store_id,
|
||||||
keyword: this.keyword,
|
keyword: this.keyword,
|
||||||
@ -1007,6 +1028,7 @@ export default {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let res = await GetOrderList(this.params);
|
let res = await GetOrderList(this.params);
|
||||||
|
|
||||||
if (res && res.status == 200) {
|
if (res && res.status == 200) {
|
||||||
if (this.isLoadingReachData) {
|
if (this.isLoadingReachData) {
|
||||||
if (res.data.order_page_list.records.length <= 0) {
|
if (res.data.order_page_list.records.length <= 0) {
|
||||||
|
|||||||
BIN
java-mall-app-shop-admin/static/independent-account.png
Normal file
BIN
java-mall-app-shop-admin/static/independent-account.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 93 KiB |
BIN
java-mall-app-shop-admin/static/store.png
Normal file
BIN
java-mall-app-shop-admin/static/store.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
@ -1,9 +1,9 @@
|
|||||||
import { GetOrderPush } from '../../api/order';
|
import { GetOrderPush } from "../../api/order";
|
||||||
import GtPush from '@/utils/gtpush-min.js';
|
|
||||||
|
|
||||||
const defaultState = () => {
|
const defaultState = () => {
|
||||||
return {
|
return {
|
||||||
pushOrderInfo: {},
|
pushOrderInfo: {},
|
||||||
|
orderWeiDu: 0,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -11,52 +11,19 @@ const state = defaultState();
|
|||||||
|
|
||||||
const getters = {};
|
const getters = {};
|
||||||
|
|
||||||
const mutations = {};
|
const mutations = {
|
||||||
|
ORDERPUSH(state, pushOrderInfo) {
|
||||||
const getClient = () => {
|
state.pushOrderInfo = pushOrderInfo;
|
||||||
// #ifdef APP-PLUS
|
},
|
||||||
let clientInfo = plus.push.getClientInfo(); //获取 clientID
|
|
||||||
uni.setStorageSync('clientid', clientInfo.clientid);
|
|
||||||
return clientInfo.clientid;
|
|
||||||
console.log(clientInfo);
|
|
||||||
// #endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
async intOrderPush({ dispatch }) {
|
orderPush({ commit }, pushOrderInfo) {
|
||||||
GtPush.init({
|
console.log("order vue x:", pushOrderInfo);
|
||||||
appid: 'KXgzOaKSzd5HG3p9IPaVa8',
|
|
||||||
onClientId: (res) => {
|
|
||||||
let params = {
|
|
||||||
cid: res.cid,
|
|
||||||
message: '测试',
|
|
||||||
};
|
|
||||||
|
|
||||||
dispatch('getOrderPush', params);
|
let orderItem = pushOrderInfo.payload.orderItem;
|
||||||
console.log('onClientId = ' + res.cid);
|
|
||||||
},
|
|
||||||
onlineState: (res) => {
|
|
||||||
console.log('onlineState = ' + res.online);
|
|
||||||
},
|
|
||||||
onPushMsg: (res) => {
|
|
||||||
console.log('onPushMsg = ' + res.message);
|
|
||||||
},
|
|
||||||
onError: (res) => {
|
|
||||||
console.log('error', +res.message);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
async getOrderPush({ dispatch }, params) {
|
commit("ORDERPUSH", orderItem);
|
||||||
// #ifdef APP-PLUS
|
|
||||||
let clientid = getClient();
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
let res = await GetOrderPush(params);
|
|
||||||
|
|
||||||
if (res && res.second) {
|
|
||||||
console.log('OrderPush', res);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -77,6 +77,25 @@ const mutations = {
|
|||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
async GetAccountLogin({ dispatch }, params) {
|
async GetAccountLogin({ dispatch }, params) {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
|
||||||
|
const platform = uni.getSystemInfoSync().platform;
|
||||||
|
var push_clientid = "";
|
||||||
|
var osType = "";
|
||||||
|
|
||||||
|
push_clientid = await getPushClientId();
|
||||||
|
|
||||||
|
if (platform == "android") {
|
||||||
|
osType = 1;
|
||||||
|
} else {
|
||||||
|
osType = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
params.cid = push_clientid;
|
||||||
|
params.osType = osType;
|
||||||
|
|
||||||
|
// #endif
|
||||||
|
|
||||||
const res = await GetAccountLogin(params);
|
const res = await GetAccountLogin(params);
|
||||||
|
|
||||||
if (res && res.status == 200) {
|
if (res && res.status == 200) {
|
||||||
@ -103,6 +122,27 @@ const actions = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async GetLogin({ dispatch }, params) {
|
async GetLogin({ dispatch }, params) {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
|
||||||
|
const platform = uni.getSystemInfoSync().platform;
|
||||||
|
var push_clientid = "";
|
||||||
|
var osType = "";
|
||||||
|
|
||||||
|
push_clientid = await getPushClientId();
|
||||||
|
|
||||||
|
if (platform == "android") {
|
||||||
|
osType = 1;
|
||||||
|
} else {
|
||||||
|
osType = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
params.cid = push_clientid;
|
||||||
|
params.osType = osType;
|
||||||
|
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
console.log("登录时的params", params);
|
||||||
|
|
||||||
const res = await GetLogin(params);
|
const res = await GetLogin(params);
|
||||||
|
|
||||||
if (res && res.status == 200) {
|
if (res && res.status == 200) {
|
||||||
@ -194,16 +234,15 @@ const actions = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let {
|
let {
|
||||||
approval_status,
|
approval_status,
|
||||||
store_status ,
|
store_status,
|
||||||
has_ec_signed,
|
has_ec_signed,
|
||||||
has_apply_mer,
|
has_apply_mer,
|
||||||
has_apply_split,
|
has_apply_split,
|
||||||
has_apply_receiver,
|
has_apply_receiver,
|
||||||
has_bind_receiver
|
has_bind_receiver,
|
||||||
}
|
} = res.data;
|
||||||
= res.data;
|
|
||||||
|
|
||||||
//2-未通过;3-待审核;4-未申请过;5-已提交审核; 21 拉卡拉审核未通过
|
//2-未通过;3-待审核;4-未申请过;5-已提交审核; 21 拉卡拉审核未通过
|
||||||
if ([2, 3, 5, 21].includes(approval_status)) {
|
if ([2, 3, 5, 21].includes(approval_status)) {
|
||||||
@ -273,23 +312,31 @@ const actions = {
|
|||||||
// 触发条件:approval_status=1 且 has_ec_signed=1 且 has_apply_mer=1 且 store_status=1 且 has_apply_split=1 且 has_bind_receiver=1
|
// 触发条件:approval_status=1 且 has_ec_signed=1 且 has_apply_mer=1 且 store_status=1 且 has_apply_split=1 且 has_bind_receiver=1
|
||||||
// 提示信息:"恭喜您,入驻流程已全部完成!"
|
// 提示信息:"恭喜您,入驻流程已全部完成!"
|
||||||
|
|
||||||
if(store_status == 2
|
if (
|
||||||
|| has_ec_signed == 2
|
store_status == 2 ||
|
||||||
|| has_apply_mer == 2
|
has_ec_signed == 2 ||
|
||||||
|| has_apply_split == 2
|
has_apply_mer == 2 ||
|
||||||
|| has_apply_receiver == 2
|
has_apply_split == 2 ||
|
||||||
|| has_bind_receiver == 2
|
has_apply_receiver == 2 ||
|
||||||
&& approval_status == 1
|
(has_bind_receiver == 2 && approval_status == 1)
|
||||||
){
|
) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/audit/checkAudit",
|
url: "/pages/audit/checkAudit",
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// store_status int '店铺创建状态:1-已启用(入驻已审批,合同已生成);2-未启用',
|
// store_status int '店铺创建状态:1-已启用(入驻已审批,合同已生成);2-未启用',
|
||||||
if (approval_status == 1 && store_status == 1 && has_ec_signed == 1&& has_apply_mer == 1&& has_apply_split == 1&& has_ec_signed == 1&&has_apply_receiver==1&&has_bind_receiver==1) {
|
if (
|
||||||
|
approval_status == 1 &&
|
||||||
|
store_status == 1 &&
|
||||||
|
has_ec_signed == 1 &&
|
||||||
|
has_apply_mer == 1 &&
|
||||||
|
has_apply_split == 1 &&
|
||||||
|
has_ec_signed == 1 &&
|
||||||
|
has_apply_receiver == 1 &&
|
||||||
|
has_bind_receiver == 1
|
||||||
|
) {
|
||||||
let result = await GetAuditInfo({ mobile: mobile });
|
let result = await GetAuditInfo({ mobile: mobile });
|
||||||
|
|
||||||
uni.setStorageSync(
|
uni.setStorageSync(
|
||||||
@ -332,6 +379,19 @@ const actions = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function getPushClientId() {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
uni.getPushClientId({
|
||||||
|
success: (res) => {
|
||||||
|
resolve(res.cid);
|
||||||
|
},
|
||||||
|
fail(err) {
|
||||||
|
reject(err);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
state,
|
state,
|
||||||
|
|||||||
@ -1,2 +1,4 @@
|
|||||||
/*主颜色*/
|
/*主颜色*/
|
||||||
$base-color: #fe4119; // 蓝色 #4b71ff
|
$base-color: #fe4119; // 蓝色 #4b71ff
|
||||||
|
|
||||||
|
$base-btn-bg-color: linear-gradient(220.55deg, #ff0000 0%, #bc2222 100%);
|
||||||
|
|||||||
@ -1,160 +1,19 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
const uniPush = uniCloud.getPushManager({
|
|
||||||
appId: "__UNI__95F809F"
|
|
||||||
});
|
|
||||||
const db = uniCloud.database();
|
|
||||||
const pushLogCollection = db.collection('push_logs'); // 假设存在 push_logs 集合用于记录推送日志
|
|
||||||
|
|
||||||
// 验证设备 ID 是否有效
|
const { log } = require("console");
|
||||||
const isValidDeviceId = (deviceId) => {
|
|
||||||
return typeof deviceId ==='string' && deviceId.trim()!== '';
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.main = async (event) => {
|
const uniPush = uniCloud.getPushManager({appId:"__UNI__95F809F"}) //注意这里需要传入你的应用appId,用于指定接收消息的客户端
|
||||||
try {
|
|
||||||
let obj = JSON.parse(event.body);
|
|
||||||
|
|
||||||
// 检查发送者和接收者信息
|
|
||||||
if (!obj.senderId ||!obj.receiverId) {
|
exports.main = async (event, context) => {
|
||||||
const errorMsg = '缺少发送者或接收者信息';
|
console.log('event',event);
|
||||||
// 记录错误日志
|
console.log('context',context);
|
||||||
await pushLogCollection.add({
|
|
||||||
senderId: obj.senderId,
|
let obj = JSON.parse(event.body);
|
||||||
receiverId: obj.receiverId,
|
|
||||||
title: obj.title,
|
|
||||||
content: obj.content,
|
|
||||||
status: 'failed',
|
return await uniPush.sendMessage(obj)
|
||||||
errorCode: 400,
|
|
||||||
errorMsg: errorMsg,
|
|
||||||
timestamp: new Date(),
|
|
||||||
requestBody: obj
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
code: 400,
|
|
||||||
msg: errorMsg
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果 category 不是对象,将其移除
|
|
||||||
if (typeof obj.category!== 'object') {
|
|
||||||
delete obj.category;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 从数据库中获取接收者的设备标识
|
|
||||||
if (typeof obj.receiverId!== 'string' || obj.receiverId.trim() === '') {
|
|
||||||
const errorMsg = '接收者 ID 无效';
|
|
||||||
// 记录错误日志
|
|
||||||
await pushLogCollection.add({
|
|
||||||
senderId: obj.senderId,
|
|
||||||
receiverId: obj.receiverId,
|
|
||||||
title: obj.title,
|
|
||||||
content: obj.content,
|
|
||||||
status: 'failed',
|
|
||||||
errorCode: 400,
|
|
||||||
errorMsg: errorMsg,
|
|
||||||
timestamp: new Date(),
|
|
||||||
requestBody: obj
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
code: 400,
|
|
||||||
msg: errorMsg
|
|
||||||
};
|
|
||||||
}
|
|
||||||
const receiverDevices = await db.collection('opendb-device')
|
|
||||||
.where({ userId: obj.receiverId })
|
|
||||||
.get();
|
|
||||||
|
|
||||||
console.log('接收者 ID:', obj.receiverId);
|
|
||||||
console.log('查询到的设备信息原始数据:', receiverDevices.data); // 打印原始数据
|
|
||||||
|
|
||||||
if (receiverDevices.data.length === 0) {
|
|
||||||
const errorMsg = `未找到接收者(ID: ${obj.receiverId})的设备信息`;
|
|
||||||
// 记录错误日志
|
|
||||||
await pushLogCollection.add({
|
|
||||||
senderId: obj.senderId,
|
|
||||||
receiverId: obj.receiverId,
|
|
||||||
title: obj.title,
|
|
||||||
content: obj.content,
|
|
||||||
status: 'failed',
|
|
||||||
errorCode: 404,
|
|
||||||
errorMsg: errorMsg,
|
|
||||||
timestamp: new Date(),
|
|
||||||
requestBody: obj
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
code: 404,
|
|
||||||
msg: errorMsg
|
|
||||||
};
|
|
||||||
}
|
|
||||||
const pushClientIds = "设备id";
|
|
||||||
// console.log(pushClientIds);
|
|
||||||
const validDeviceIds = ["设备id"];
|
|
||||||
validDeviceIds.push();
|
|
||||||
const invalidDeviceIds = [];
|
|
||||||
if (validDeviceIds.length === 0) {
|
|
||||||
const errorMsg = `接收者(ID: ${obj.receiverId})的所有设备 ID 均无效,无效的 ID 包括: ${invalidDeviceIds.join(', ')}`;
|
|
||||||
// 记录错误日志
|
|
||||||
await pushLogCollection.add({
|
|
||||||
senderId: obj.senderId,
|
|
||||||
receiverId: obj.receiverId,
|
|
||||||
title: obj.title,
|
|
||||||
content: obj.content,
|
|
||||||
status: 'failed',
|
|
||||||
errorCode: 400,
|
|
||||||
errorMsg: errorMsg,
|
|
||||||
timestamp: new Date(),
|
|
||||||
requestBody: obj
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
code: 400,
|
|
||||||
msg: errorMsg
|
|
||||||
};
|
|
||||||
}
|
|
||||||
const res = await uniPush.sendMessage({
|
|
||||||
"push_clientid": validDeviceIds,
|
|
||||||
"title": obj.title,
|
|
||||||
"content": obj.content,
|
|
||||||
"payload": obj.payload,
|
|
||||||
"force_notification": true,
|
|
||||||
"request_id": obj.request_id,
|
|
||||||
"options": obj.options
|
|
||||||
});
|
|
||||||
|
|
||||||
// 记录成功日志
|
|
||||||
await pushLogCollection.add({
|
|
||||||
senderId: obj.senderId,
|
|
||||||
receiverId: obj.receiverId,
|
|
||||||
title: obj.title,
|
|
||||||
content: obj.content,
|
|
||||||
status:'success',
|
|
||||||
pushResult: res,
|
|
||||||
timestamp: new Date(),
|
|
||||||
requestBody: obj
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
code: 200,
|
|
||||||
msg: '消息推送成功',
|
|
||||||
data: res
|
|
||||||
};
|
|
||||||
} catch (error) {
|
|
||||||
console.error('消息推送出错:', error);
|
|
||||||
// 记录异常错误日志
|
|
||||||
await pushLogCollection.add({
|
|
||||||
senderId: event.senderId,
|
|
||||||
receiverId: event.receiverId,
|
|
||||||
title: event.title,
|
|
||||||
content: event.content,
|
|
||||||
status: 'failed',
|
|
||||||
errorCode: 500,
|
|
||||||
errorMsg: '消息推送失败',
|
|
||||||
errorDetail: error.message,
|
|
||||||
timestamp: new Date(),
|
|
||||||
requestBody: event.body
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
code: 500,
|
|
||||||
msg: '消息推送失败',
|
|
||||||
error: error.message
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
// 本文件中的json内容将在云函数【运行】时作为参数传给云函数。
|
||||||
|
// 配置教程参考:https://uniapp.dcloud.net.cn/uniCloud/rundebug.html#runparam
|
||||||
|
{
|
||||||
|
}
|
||||||
88
java-mall-app-shop-admin/utils/gtpush-min.js
vendored
88
java-mall-app-shop-admin/utils/gtpush-min.js
vendored
File diff suppressed because one or more lines are too long
@ -57,7 +57,16 @@ service.interceptors.response.use(
|
|||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
console.log("err" + error); // for debug
|
if (error.response && error.response.status === 503) {
|
||||||
|
// 统一处理所有 503 错误
|
||||||
|
console.log("服务器开小差了~");
|
||||||
|
uni.showToast({
|
||||||
|
title: `服务器开小差了~`,
|
||||||
|
icon: "error",
|
||||||
|
duration: 1000,
|
||||||
|
});
|
||||||
|
// 可以在这里显示全局通知或重试逻辑
|
||||||
|
}
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user