发布开始修改细节

master
Sigo 4 years ago
parent abb95b0fc9
commit 000cf9254d

@ -4,7 +4,9 @@ import "babel-polyfill";
import "es6-promise/auto"; import "es6-promise/auto";
import ElementUI from "element-ui"; import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css"; import "element-ui/lib/theme-chalk/index.css";
import { Message } from "element-ui"; import {
Message
} from "element-ui";
Vue.use(ElementUI); Vue.use(ElementUI);
import App from "./App.vue"; import App from "./App.vue";
import store from "./store"; import store from "./store";
@ -22,18 +24,26 @@ import "./utils/dialog";
import "./plugins"; import "./plugins";
// import "./utils/directive/focus"; // import "./utils/directive/focus";
import echarts from "echarts"; import echarts from "echarts";
import { getCookie } from "./utils/utils.js"; import {
getCookie
} from "./utils/utils.js";
import apiConfig from "../config/api.config.js"; import apiConfig from "../config/api.config.js";
import vueEsign from "vue-esign"; import vueEsign from "vue-esign";
import animated from "animate.css"; // npm install animate.css --save安装在引入 import animated from "animate.css"; // npm install animate.css --save安装在引入
import formatTime from "./utils/filters.js"; import formatTime from "./utils/filters.js";
import arrDiff from "./utils/array.js"; import arrDiff from "./utils/array.js";
import { Loading } from "element-ui"; import {
Loading
} from "element-ui";
import countdown from "./utils/countdown.js"; import countdown from "./utils/countdown.js";
import "./utils/rem.js"; import "./utils/rem.js";
Vue.use(animated); Vue.use(animated);
Vue.use(vueEsign); Vue.use(vueEsign);
import {
thousands
} from '@/utils/index.js'
import Vue from "vue"; import Vue from "vue";
import Router from "vue-router"; import Router from "vue-router";
import router from "./router"; import router from "./router";
@ -44,10 +54,13 @@ Vue.use(VueAxios, axios);
axios.defaults.baseURL = apiConfig.baseUrl; axios.defaults.baseURL = apiConfig.baseUrl;
Vue.use(Print); //注册 Vue.use(Print); //注册
import { message } from "./utils/resetMessage.js"; //现在提示弹窗每次只弹一条 import {
message
} from "./utils/resetMessage.js"; //现在提示弹窗每次只弹一条
// import VueParticles from 'vue-particles' // import VueParticles from 'vue-particles'
// Vue.use(VueParticles) // Vue.use(VueParticles)
Vue.prototype.$thousands = thousands
Vue.prototype.$message = message; Vue.prototype.$message = message;
Vue.prototype.$countdown = countdown; Vue.prototype.$countdown = countdown;
Vue.prototype.bus = new Vue(); Vue.prototype.bus = new Vue();
@ -66,7 +79,7 @@ export function getNextDate(date, day) {
} }
axios.defaults.withCredentials = true; //让ajax携带cookie axios.defaults.withCredentials = true; //让ajax携带cookie
// 全局过滤器--时间戳格式化时间//.padStart(2 , "0") 不足两位的用0填充 // 全局过滤器--时间戳格式化时间//.padStart(2 , "0") 不足两位的用0填充
Vue.filter("dateFormat", function(originVal) { Vue.filter("dateFormat", function (originVal) {
const dt = new Date(originVal); const dt = new Date(originVal);
const y = dt.getFullYear(); const y = dt.getFullYear();
const m = (dt.getMonth() + 1 + "").padStart(2, "0"); const m = (dt.getMonth() + 1 + "").padStart(2, "0");
@ -76,7 +89,7 @@ Vue.filter("dateFormat", function(originVal) {
const ss = (dt.getSeconds() + "").padStart(2, "0"); const ss = (dt.getSeconds() + "").padStart(2, "0");
return `${y}-${m}-${d} ${hh}:${mm}:${ss}`; return `${y}-${m}-${d} ${hh}:${mm}:${ss}`;
}); });
Vue.filter("dateMonth", function(originVal) { Vue.filter("dateMonth", function (originVal) {
const dt = new Date(originVal); const dt = new Date(originVal);
const y = dt.getFullYear(); const y = dt.getFullYear();
const m = (dt.getMonth() + 1 + "").padStart(2, "0"); const m = (dt.getMonth() + 1 + "").padStart(2, "0");
@ -86,10 +99,10 @@ Vue.filter("dateMonth", function(originVal) {
const ss = (dt.getSeconds() + "").padStart(2, "0"); const ss = (dt.getSeconds() + "").padStart(2, "0");
return `${y}-${m}-${d}`; return `${y}-${m}-${d}`;
}); });
Vue.filter("phone", function(phone) { Vue.filter("phone", function (phone) {
return phone.substring(0, 3) + "****" + phone.substring(phone.length - 4); return phone.substring(0, 3) + "****" + phone.substring(phone.length - 4);
}); });
Vue.filter("identityNum", function(identityNum) { Vue.filter("identityNum", function (identityNum) {
return ( return (
identityNum.substring(0, 4) + identityNum.substring(0, 4) +
"**************" + "**************" +
@ -97,11 +110,11 @@ Vue.filter("identityNum", function(identityNum) {
); );
}); });
Vue.filter("money", function(money) { Vue.filter("money", function (money) {
return (money * 1).toFixed(2); return (money * 1).toFixed(2);
}); });
Vue.prototype.openLoading = function() { Vue.prototype.openLoading = function () {
const loading = this.$loading({ const loading = this.$loading({
// 声明一个loading对象 // 声明一个loading对象
lock: true, // 是否锁屏 lock: true, // 是否锁屏
@ -112,7 +125,7 @@ Vue.prototype.openLoading = function() {
body: true, body: true,
customClass: "mask" // 遮罩层新增类名 customClass: "mask" // 遮罩层新增类名
}); });
setTimeout(function() { setTimeout(function () {
// 设定定时器超时5S后自动关闭遮罩层避免请求失败时遮罩层一直存在的问题 // 设定定时器超时5S后自动关闭遮罩层避免请求失败时遮罩层一直存在的问题
loading.close(); // 关闭遮罩层 loading.close(); // 关闭遮罩层
}, 5000); }, 5000);
@ -151,7 +164,9 @@ router.beforeEach((to, from, next) => {
message: "请先登录", message: "请先登录",
duration: 2000 duration: 2000
}); });
next({ path: "/login" }); next({
path: "/login"
});
} }
}); });
Vue.directive("role", { Vue.directive("role", {
@ -178,7 +193,9 @@ new Vue({
el: "#app", el: "#app",
router, router,
store, store,
components: { App }, components: {
App
},
template: "<App/>" template: "<App/>"
}); });

@ -56,7 +56,7 @@
<el-form-item v-show="form.shareCommissionRules===1" :prop="form.shareCommissionRules===1?'orderCommission':''"> <el-form-item v-show="form.shareCommissionRules===1" :prop="form.shareCommissionRules===1?'orderCommission':''">
<amount-input ref="orderCommission" @amount="handleAmount" name="orderCommission" placeholder="单据金额抽成(%)"></amount-input> <amount-input ref="orderCommission" @amount="handleAmount" name="orderCommission" placeholder="单据金额抽成(%)"></amount-input>
</el-form-item> </el-form-item>
<el-form-item label="推广图片"> <el-form-item label="活动图片" prop="imageUrl">
<active-img @active-img="handleImage"></active-img> <active-img @active-img="handleImage"></active-img>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -120,37 +120,17 @@ export default {
shareCommissionRules: [ shareCommissionRules: [
{ required: true, message: '请选择分享提成规则', trigger: ['blur', 'change'] }, { required: true, message: '请选择分享提成规则', trigger: ['blur', 'change'] },
], ],
couponNum: [{ required: true, message: '优惠券数量', trigger: 'blur' }], // imageUrl: [{ required: true, message: '', trigger: ['blur', 'change'] }],
shareAmount: [
{ required: true, message: '请输入分润', trigger: 'blur' },
{
pattern: /^\d*(?:\.\d{0,2})?$/,
//pattern: /^1[3456789]\d{9}$/,
message: '最多能输入两位小数',
trigger: 'blur',
},
],
phone: [
{ required: true, message: '请输入联系方式', trigger: 'blur' },
{ min: 11, max: 11, message: '请输入11位手机号码', trigger: 'blur' },
{
pattern: /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/,
//pattern: /^1[3456789]\d{9}$/,
message: '请输入正确的手机号码',
trigger: 'blur',
},
],
imgUrl: [{ required: true, message: '请上传活动图片', trigger: 'change' }],
region: [{ required: true, message: '请选择活动区域', trigger: 'change' }],
}, },
} }
}, },
methods: { methods: {
// ============================== ============================== //
// //
handleNext() { handleNext() {
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {
this.$emit('next', 2) this.$emit('next', 2, this.form)
} else { } else {
return false return false
} }
@ -164,6 +144,7 @@ export default {
this.$refs.form.resetFields() this.$refs.form.resetFields()
this.$baseMessage('重置成功', 'success') this.$baseMessage('重置成功', 'success')
}, },
// ============================== ============================== //
// //
handleImage(file) { handleImage(file) {
let form = Object.assign({}, this.form); let form = Object.assign({}, this.form);
@ -190,4 +171,7 @@ export default {
justify-content: center; justify-content: center;
padding: 50px 0; padding: 50px 0;
} }
.form .el-form-item {
margin-bottom: 15px;
}
</style> </style>

@ -34,9 +34,15 @@ export default {
data() { data() {
return { return {
choose: 0, choose: 0,
form: {}
} }
}, },
methods: { methods: {
//
handleData(form) {
this.form = Object.assign({}, form);
console.log('form', form);
},
handleChoose(num) { handleChoose(num) {
this.choose = num this.choose = num
}, },

@ -94,8 +94,10 @@ export default {
this.form = Object.assign({}, form) this.form = Object.assign({}, form)
}, },
// //
handleNext(active) { handleNext(active, form) {
this.active = active this.active = active
let activeName = active == 1 ? 'edit' : active == 2 ? 'templates' : 'complete'
this.$refs[activeName].handleData(fiorm)
}, },
}, },
} }

@ -128,12 +128,12 @@ export function paramObj(url) {
} }
return JSON.parse( return JSON.parse(
'{"' + '{"' +
decodeURIComponent(search) decodeURIComponent(search)
.replace(/"/g, '\\"') .replace(/"/g, '\\"')
.replace(/&/g, '","') .replace(/&/g, '","')
.replace(/=/g, '":"') .replace(/=/g, '":"')
.replace(/\+/g, " ") + .replace(/\+/g, " ") +
'"}' '"}'
); );
} }
@ -156,9 +156,9 @@ export function translateDataToTree(data) {
const temp = JSON.parse(JSON.stringify(children)); const temp = JSON.parse(JSON.stringify(children));
temp.splice(index, 1); temp.splice(index, 1);
translator([current], temp); translator([current], temp);
typeof parent.children !== "undefined" typeof parent.children !== "undefined" ?
? parent.children.push(current) parent.children.push(current) :
: (parent.children = [current]); (parent.children = [current]);
} }
}); });
}); });
@ -263,8 +263,8 @@ export function random(m, n) {
* @description addEventListener * @description addEventListener
* @type {function(...[*]=)} * @type {function(...[*]=)}
*/ */
export const on = (function() { export const on = (function () {
return function(element, event, handler, useCapture = false) { return function (element, event, handler, useCapture = false) {
if (element && event && handler) { if (element && event && handler) {
element.addEventListener(event, handler, useCapture); element.addEventListener(event, handler, useCapture);
} }
@ -275,8 +275,8 @@ export const on = (function() {
* @description removeEventListener * @description removeEventListener
* @type {function(...[*]=)} * @type {function(...[*]=)}
*/ */
export const off = (function() { export const off = (function () {
return function(element, event, handler, useCapture = false) { return function (element, event, handler, useCapture = false) {
if (element && event) { if (element && event) {
element.removeEventListener(event, handler, useCapture); element.removeEventListener(event, handler, useCapture);
} }
@ -350,16 +350,16 @@ export function getNextDate(date, day) {
// -------------------------- 基于只能输入数字与小数点情况下获取两位小数 ------------------------- // // -------------------------- 基于只能输入数字与小数点情况下获取两位小数 ------------------------- //
export function parseNumber(values) { export function parseNumber(values) {
if (values.split(".")[1]) { if (values.split(".")[1]) {
return values.split(".")[1].length > 2 return values.split(".")[1].length > 2 ?
? parseFloat( parseFloat(
values.split(".")[0] + values.split(".")[0] +
"." + "." +
values values
.split(".")[1] .split(".")[1]
.toString() .toString()
.slice(0, 2) .slice(0, 2)
) ) :
: parseFloat(values.split(".")[0] + "." + values.split(".")[1]); parseFloat(values.split(".")[0] + "." + values.split(".")[1]);
} else { } else {
return values; return values;
} }
@ -375,7 +375,10 @@ export function handleSelectOption(data, labelField, valueField) {
const cloneData = JSON.parse(JSON.stringify(data)); const cloneData = JSON.parse(JSON.stringify(data));
let result = []; let result = [];
data.forEach(item => { data.forEach(item => {
result.push({ label: item[labelField], value: item[valueField] }); result.push({
label: item[labelField],
value: item[valueField]
});
}); });
return result; return result;
} }
@ -483,7 +486,10 @@ export function compoteFormatTimestamp(timestamp) {
* @param {object} param * @param {object} param
*/ */
export function getTableSummation(param) { export function getTableSummation(param) {
const { columns, data } = param; const {
columns,
data
} = param;
const sums = []; const sums = [];
const fields = ["price", "number", "amount"]; const fields = ["price", "number", "amount"];
columns.forEach((column, index) => { columns.forEach((column, index) => {
@ -524,3 +530,21 @@ export function stateFormat(row, column, cellValue) {
.replace(/\.$/, ""); .replace(/\.$/, "");
} }
} }
/**
* @description (/\d{1,3}(?=(\d{3})+$)/g, '$&,') 只能正数使用
*/
// -------------------------- 千分号 ------------------------- //
export function thousands(value) {
;
/\d{1,3}(?=(\d{3})+$)/g, '$&,'
if (value) {
if (value.includes('.')) {
let array = value.split('.')
let data = array[0].replace(/\d{1,3}(?=(\d{3})+$)/g, '$&,')
return data + '.' + array[1]
} else {
let data = value.replace(/\d{1,3}(?=(\d{3})+$)/g, '$&,')
return data
}
}
}

Loading…
Cancel
Save