v1.1
1、提货点 2、客服(腾讯云智服) 3、接口权限控制 4、复制第三方商品可配置 4、优化附件上传配置 5、手机端核销订单 6、手机端订单统计、订单管理 7、短信优化 8、订阅消息全自动化
This commit is contained in:
@@ -71,6 +71,7 @@ export const fromList = {
|
||||
title: '选择时间',
|
||||
custom: true,
|
||||
fromTxt: [
|
||||
{ text: '全部', val: '' },
|
||||
{ text: '今天', val: 'today' },
|
||||
{ text: '昨天', val: 'yesterday' },
|
||||
{ text: '最近7天', val: 'lately7' },
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import Cookies from 'js-cookie'
|
||||
/**
|
||||
* Created by PanJiaChen on 16/11/18.
|
||||
*/
|
||||
@@ -31,7 +32,7 @@ function padLeftZero (str) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the time to string
|
||||
* 更改时间格式成2010-01-10格式
|
||||
* @param {(Object|string|number)} time
|
||||
* @param {string} cFormat
|
||||
* @returns {string | null}
|
||||
@@ -47,15 +48,11 @@ export function parseTime(time, cFormat) {
|
||||
} else {
|
||||
if ((typeof time === 'string')) {
|
||||
if ((/^[0-9]+$/.test(time))) {
|
||||
// support "1548221490638"
|
||||
time = parseInt(time)
|
||||
} else {
|
||||
// support safari
|
||||
// https://stackoverflow.com/questions/4310953/invalid-date-in-safari
|
||||
time = time.replace(new RegExp(/-/gm), '/')
|
||||
}
|
||||
}
|
||||
|
||||
if ((typeof time === 'number') && (time.toString().length === 10)) {
|
||||
time = time * 1000
|
||||
}
|
||||
@@ -381,3 +378,45 @@ export function removeClass(ele, cls) {
|
||||
ele.className = ele.className.replace(reg, ' ')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断地址
|
||||
*/
|
||||
export function parseQuery() {
|
||||
const res = {};
|
||||
|
||||
const query = (location.href.split("?")[1] || "")
|
||||
.trim()
|
||||
.replace(/^(\?|#|&)/, "");
|
||||
|
||||
if (!query) {
|
||||
return res;
|
||||
}
|
||||
|
||||
query.split("&").forEach(param => {
|
||||
const parts = param.replace(/\+/g, " ").split("=");
|
||||
const key = decodeURIComponent(parts.shift());
|
||||
const val = parts.length > 0 ? decodeURIComponent(parts.join("=")) : null;
|
||||
|
||||
if (res[key] === undefined) {
|
||||
res[key] = val;
|
||||
} else if (Array.isArray(res[key])) {
|
||||
res[key].push(val);
|
||||
} else {
|
||||
res[key] = [res[key], val];
|
||||
}
|
||||
});
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是核销员
|
||||
*/
|
||||
export function isWriteOff() {
|
||||
if(localStorage.getItem('storeStaffList')){
|
||||
let JavaInfo = JSON.parse(Cookies.get('JavaInfo'))
|
||||
let staff = JSON.parse(localStorage.getItem('storeStaffList'))
|
||||
return staff.some(item => item.avatar === JavaInfo.account)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { MessageBox, Message } from 'element-ui'
|
||||
import store from '@/store'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import SettingMer from '@/utils/settingMer'
|
||||
|
||||
import { isPhone } from "@/libs/wechat";
|
||||
// create an axios instance
|
||||
const service = axios.create({
|
||||
baseURL: SettingMer.apiBaseURL, // url = base url + request url
|
||||
@@ -15,12 +15,12 @@ const service = axios.create({
|
||||
service.interceptors.request.use(
|
||||
config => {
|
||||
// do something before request is sent
|
||||
|
||||
if (store.getters.token) {
|
||||
const token = !store.getters.token?sessionStorage.getItem('token'):store.getters.token;
|
||||
if (token) {
|
||||
// let each request carry token
|
||||
// ['X-Token'] is a custom headers key
|
||||
// please modify it according to the actual situationf
|
||||
config.headers['Authori-zation'] = getToken()
|
||||
config.headers['Authori-zation'] = token
|
||||
}
|
||||
if(/get/i.test(config.method)){
|
||||
config.params = config.params || {}
|
||||
@@ -62,6 +62,9 @@ service.interceptors.response.use(
|
||||
})
|
||||
}
|
||||
if (res.code !== 200) {
|
||||
if (isPhone()) { //移动端
|
||||
return Promise.reject(res || 'Error')
|
||||
}
|
||||
Message({
|
||||
message: res.message || 'Error',
|
||||
type: 'error',
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
/**
|
||||
* Created by PanJiaChen on 16/11/18.
|
||||
*/
|
||||
const baseAttr = {
|
||||
min: "%s最小长度为:min",
|
||||
max: "%s最大长度为:max",
|
||||
length: "%s长度必须为:length",
|
||||
range: "%s长度为:range",
|
||||
pattern: "$s格式错误"
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} path
|
||||
@@ -86,3 +93,52 @@ export function isArray(arg) {
|
||||
}
|
||||
return Array.isArray(arg)
|
||||
}
|
||||
|
||||
const bindMessage = (fn, message) => {
|
||||
fn.message = field => message.replace("%s", field || "");
|
||||
};
|
||||
|
||||
export function required(message, opt = {}) {
|
||||
return {
|
||||
required: true,
|
||||
message,
|
||||
type: "string",
|
||||
...opt
|
||||
};
|
||||
}
|
||||
bindMessage(required, "请输入%s");
|
||||
|
||||
/**
|
||||
* 正确的金额
|
||||
*
|
||||
* @param message
|
||||
* @returns {*}
|
||||
*/
|
||||
export function num(message) {
|
||||
return attrs.pattern(
|
||||
/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
|
||||
message
|
||||
);
|
||||
}
|
||||
bindMessage(num, "%s格式不正确");
|
||||
|
||||
|
||||
const attrs = Object.keys(baseAttr).reduce((attrs, key) => {
|
||||
attrs[key] = (attr, message = "", opt = {}) => {
|
||||
const _attr =
|
||||
key === "range" ? { min: attr[0], max: attr[1] } : { [key]: attr };
|
||||
|
||||
return {
|
||||
message: message.replace(
|
||||
`:${key}`,
|
||||
key === "range" ? `${attr[0]}-${attr[1]}` : attr
|
||||
),
|
||||
type: "string",
|
||||
..._attr,
|
||||
...opt
|
||||
};
|
||||
};
|
||||
bindMessage(attrs[key], baseAttr[key]);
|
||||
return attrs;
|
||||
}, {});
|
||||
export default attrs;
|
||||
|
||||
Reference in New Issue
Block a user