mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2026-03-24 18:17:22 +08:00
Merge branch 'develop' into 'master'
Develop See merge request jianweie/coreshoppro!6
This commit is contained in:
@@ -36,7 +36,7 @@ namespace CoreCms.Net.Filter
|
|||||||
public void OnException(ExceptionContext context)
|
public void OnException(ExceptionContext context)
|
||||||
{
|
{
|
||||||
|
|
||||||
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.Web, "全局异常", "全局捕获异常", context.Exception);
|
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.Web, "全局异常", context.Exception.Message, context.Exception);
|
||||||
|
|
||||||
HttpStatusCode status = HttpStatusCode.InternalServerError;
|
HttpStatusCode status = HttpStatusCode.InternalServerError;
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace CoreCms.Net.Filter
|
|||||||
public void OnException(ExceptionContext context)
|
public void OnException(ExceptionContext context)
|
||||||
{
|
{
|
||||||
|
|
||||||
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.Web, "全局异常", "全局捕获异常", context.Exception);
|
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.Web, "全局异常", context.Exception.Message, context.Exception);
|
||||||
|
|
||||||
|
|
||||||
HttpStatusCode status = HttpStatusCode.InternalServerError;
|
HttpStatusCode status = HttpStatusCode.InternalServerError;
|
||||||
|
|||||||
@@ -26,11 +26,11 @@ namespace CoreCms.Net.Middlewares;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 异常错误统一返回记录
|
/// 异常错误统一返回记录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ExceptionHandlerMiddForAdmin
|
public class ExceptionHandlerMiddlewareForAdmin
|
||||||
{
|
{
|
||||||
private readonly RequestDelegate _next;
|
private readonly RequestDelegate _next;
|
||||||
|
|
||||||
public ExceptionHandlerMiddForAdmin(RequestDelegate next)
|
public ExceptionHandlerMiddlewareForAdmin(RequestDelegate next)
|
||||||
{
|
{
|
||||||
_next = next;
|
_next = next;
|
||||||
}
|
}
|
||||||
@@ -50,7 +50,7 @@ public class ExceptionHandlerMiddForAdmin
|
|||||||
private async Task HandleExceptionAsync(HttpContext context, Exception ex)
|
private async Task HandleExceptionAsync(HttpContext context, Exception ex)
|
||||||
{
|
{
|
||||||
if (ex == null) return;
|
if (ex == null) return;
|
||||||
NLogUtil.WriteAll(LogLevel.Error, LogType.Web, "全局捕获异常", "全局捕获异常", new Exception("全局捕获异常", ex));
|
NLogUtil.WriteAll(LogLevel.Error, LogType.Web, "全局捕获异常", ex.Message, ex);
|
||||||
await WriteExceptionAsync(context, ex).ConfigureAwait(false);
|
await WriteExceptionAsync(context, ex).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,12 +26,12 @@ namespace CoreCms.Net.Middlewares;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 异常错误统一返回记录
|
/// 异常错误统一返回记录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ExceptionHandlerMiddForClent
|
public class ExceptionHandlerMiddlewareForClent
|
||||||
{
|
{
|
||||||
private readonly RequestDelegate _next;
|
private readonly RequestDelegate _next;
|
||||||
|
|
||||||
|
|
||||||
public ExceptionHandlerMiddForClent(RequestDelegate next)
|
public ExceptionHandlerMiddlewareForClent(RequestDelegate next)
|
||||||
{
|
{
|
||||||
_next = next;
|
_next = next;
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ public class ExceptionHandlerMiddForClent
|
|||||||
{
|
{
|
||||||
if (ex == null) return;
|
if (ex == null) return;
|
||||||
|
|
||||||
NLogUtil.WriteAll(LogLevel.Error, LogType.ApiRequest, "全局捕获异常", "全局捕获异常", new Exception("全局捕获异常", ex));
|
NLogUtil.WriteAll(LogLevel.Error, LogType.ApiRequest, "全局捕获异常", ex.Message, ex);
|
||||||
|
|
||||||
await WriteExceptionAsync(context, ex).ConfigureAwait(false);
|
await WriteExceptionAsync(context, ex).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
@@ -38,7 +38,7 @@ namespace CoreCms.Net.Middlewares
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static IApplicationBuilder UseExceptionHandlerMiddForAdmin(this IApplicationBuilder app)
|
public static IApplicationBuilder UseExceptionHandlerMiddForAdmin(this IApplicationBuilder app)
|
||||||
{
|
{
|
||||||
return app.UseMiddleware<ExceptionHandlerMiddForAdmin>();
|
return app.UseMiddleware<ExceptionHandlerMiddlewareForAdmin>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -48,7 +48,7 @@ namespace CoreCms.Net.Middlewares
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static IApplicationBuilder UseExceptionHandlerMiddForClent(this IApplicationBuilder app)
|
public static IApplicationBuilder UseExceptionHandlerMiddForClent(this IApplicationBuilder app)
|
||||||
{
|
{
|
||||||
return app.UseMiddleware<ExceptionHandlerMiddForClent>();
|
return app.UseMiddleware<ExceptionHandlerMiddlewareForClent>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,210 +0,0 @@
|
|||||||
/**
|
|
||||||
* 格式化器
|
|
||||||
* @Author: wenjm
|
|
||||||
* @Date: 2018-02-24 23:28:28
|
|
||||||
* @Last Modified by: wenjm
|
|
||||||
* @Last Modified time: 2018-05-15 14:35:01
|
|
||||||
*/
|
|
||||||
export default {
|
|
||||||
|
|
||||||
formatDateTime(value) {
|
|
||||||
return this.formatDate(value, 'yyyy-MM-dd hh:mm:ss');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 格式化时间显示方式
|
|
||||||
* 用法:format="yyyy-MM-dd hh:mm:ss";
|
|
||||||
*/
|
|
||||||
formatDate(value, format = 'yyyy-MM-dd') {
|
|
||||||
if (!value) return "";
|
|
||||||
if (!format) format = "yyyy-MM-dd";
|
|
||||||
let d = value;
|
|
||||||
if (typeof value === 'string') {
|
|
||||||
if (value.indexOf("/Date(") > -1)
|
|
||||||
d = new Date(parseInt(value.replace("/Date(", "").replace(")/", ""), 10));
|
|
||||||
else
|
|
||||||
d = new Date(Date.parse(value.replace(/-/g, "/").replace("T", " ").split(".")[0])); //.split(".")[0] 用来处理出现毫秒的情况,截取掉.xxx,否则会出错
|
|
||||||
}
|
|
||||||
let o = {
|
|
||||||
"M+": d.getMonth() + 1, //month
|
|
||||||
"d+": d.getDate(), //day
|
|
||||||
"h+": d.getHours(), //hour
|
|
||||||
"m+": d.getMinutes(), //minute
|
|
||||||
"s+": d.getSeconds(), //second
|
|
||||||
"q+": Math.floor((d.getMonth() + 3) / 3), //quarter
|
|
||||||
"S": d.getMilliseconds() //millisecond
|
|
||||||
};
|
|
||||||
if (/(y+)/.test(format)) {
|
|
||||||
format = format.replace(RegExp.$1, (d.getFullYear() + "").substr(4 - RegExp.$1.length));
|
|
||||||
}
|
|
||||||
for (let k in o) {
|
|
||||||
if (new RegExp("(" + k + ")").test(format)) {
|
|
||||||
format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return format;
|
|
||||||
},
|
|
||||||
|
|
||||||
formatTime(t) {
|
|
||||||
if (isNaN(t) || t == 0) { return 0; }
|
|
||||||
|
|
||||||
let n = 31536000000;
|
|
||||||
if (t >= n) {
|
|
||||||
return this.formatNumber(t / n, '#,##0.##') + ' 年';
|
|
||||||
}
|
|
||||||
|
|
||||||
n = 86400000;
|
|
||||||
if (t >= n) {
|
|
||||||
return this.formatNumber(t / n, '#,##0.##') + ' 日';
|
|
||||||
}
|
|
||||||
|
|
||||||
n = 3600000;
|
|
||||||
if (t >= n) {
|
|
||||||
return this.formatNumber(t / n, '#,##0.##') + ' 小时';
|
|
||||||
}
|
|
||||||
|
|
||||||
n = 60000;
|
|
||||||
if (t >= n) {
|
|
||||||
return this.formatNumber(t / n, '#,##0.##') + ' 分';
|
|
||||||
}
|
|
||||||
|
|
||||||
n = 1000;
|
|
||||||
if (t >= n) {
|
|
||||||
return this.formatNumber(t / n, '#,##0.##') + ' 秒';
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.formatNumber(t, '#,##0.##') + ' 毫秒';
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 格式化数字显示方式
|
|
||||||
* 用法
|
|
||||||
* formatNumber(12345.999,'#,##0.00');
|
|
||||||
* formatNumber(12345.999,'#,##0.##');
|
|
||||||
* formatNumber(123,'000000');
|
|
||||||
*/
|
|
||||||
formatNumber(value, pattern) {
|
|
||||||
if (value == null)
|
|
||||||
return value;
|
|
||||||
let strarr = value ? value.toString().split('.') : ['0'];
|
|
||||||
let fmtarr = pattern ? pattern.split('.') : [''];
|
|
||||||
let retstr = '';
|
|
||||||
// 整数部分
|
|
||||||
let str = strarr[0];
|
|
||||||
let fmt = fmtarr[0];
|
|
||||||
let i = str.length - 1;
|
|
||||||
let comma = false;
|
|
||||||
for (let f = fmt.length - 1; f >= 0; f--) {
|
|
||||||
switch (fmt.substr(f, 1)) {
|
|
||||||
case '#':
|
|
||||||
if (i >= 0) retstr = str.substr(i--, 1) + retstr;
|
|
||||||
break;
|
|
||||||
case '0':
|
|
||||||
if (i >= 0) retstr = str.substr(i--, 1) + retstr;
|
|
||||||
else retstr = '0' + retstr;
|
|
||||||
break;
|
|
||||||
case ',':
|
|
||||||
comma = true;
|
|
||||||
retstr = ',' + retstr;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (i >= 0) {
|
|
||||||
if (comma) {
|
|
||||||
let l = str.length;
|
|
||||||
for (; i >= 0; i--) {
|
|
||||||
retstr = str.substr(i, 1) + retstr;
|
|
||||||
if (i > 0 && ((l - i) % 3) == 0) retstr = ',' + retstr;
|
|
||||||
}
|
|
||||||
} else retstr = str.substr(0, i + 1) + retstr;
|
|
||||||
}
|
|
||||||
retstr = retstr + '.';
|
|
||||||
// 处理小数部分
|
|
||||||
str = strarr.length > 1 ? strarr[1] : '';
|
|
||||||
fmt = fmtarr.length > 1 ? fmtarr[1] : '';
|
|
||||||
i = 0;
|
|
||||||
for (let f = 0; f < fmt.length; f++) {
|
|
||||||
switch (fmt.substr(f, 1)) {
|
|
||||||
case '#':
|
|
||||||
if (i < str.length) retstr += str.substr(i++, 1);
|
|
||||||
break;
|
|
||||||
case '0':
|
|
||||||
if (i < str.length) retstr += str.substr(i++, 1);
|
|
||||||
else retstr += '0';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return retstr.replace(/^,+/, '').replace(/\.$/, '');
|
|
||||||
},
|
|
||||||
|
|
||||||
//格式化金额
|
|
||||||
formatMoney(value, pattern) {
|
|
||||||
if (!value || value == 0)
|
|
||||||
return 0;
|
|
||||||
let sign = value < 0 ? '-' : '';
|
|
||||||
return sign + this.formatNumber(Math.abs(value), pattern || '#,##0.00');
|
|
||||||
},
|
|
||||||
|
|
||||||
formatMoneyCn(value) {
|
|
||||||
return '¥' + this.formatMoney(value);
|
|
||||||
},
|
|
||||||
|
|
||||||
formatWeek(value) {
|
|
||||||
let week = new Array("日", "一", "二", "三", "四", "五", "六");
|
|
||||||
let datetimeReg = /^[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])\s+(20|21|22|23|[0-1]\d):[0-5]\d:[0-5]\d$/;
|
|
||||||
if (datetimeReg.test(value)) {
|
|
||||||
value = value.replace(/-/g, "/");
|
|
||||||
}
|
|
||||||
let day = new Date(value).getDay();
|
|
||||||
|
|
||||||
return "星期" + week[day];
|
|
||||||
},
|
|
||||||
|
|
||||||
formatMoneyAuto(value, pattern = '#,##0.00') {
|
|
||||||
let unit = "元";
|
|
||||||
if (value) {
|
|
||||||
let unitNum = {
|
|
||||||
// '千': 1000.00,
|
|
||||||
'万': 10000.00,
|
|
||||||
'千万': 10000000.00,
|
|
||||||
'亿': 100000000.00,
|
|
||||||
'百亿': 10000000000.00
|
|
||||||
};
|
|
||||||
let unitCount = {
|
|
||||||
// "4": '千',
|
|
||||||
"5": '万',
|
|
||||||
"8": '千万',
|
|
||||||
"9": '亿',
|
|
||||||
"11": '百亿'
|
|
||||||
};
|
|
||||||
let count = 0;
|
|
||||||
let money = value;
|
|
||||||
|
|
||||||
while (money >= 1) {
|
|
||||||
money = money / 10;
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
let tmp = unitCount[count + ""];
|
|
||||||
while (count >= 4 && tmp === undefined) {
|
|
||||||
tmp = unitCount[(--count) + ""];
|
|
||||||
}
|
|
||||||
unit = tmp === undefined ? unit : tmp;
|
|
||||||
value = (count >= 4) ? value / (unitNum[unit]) : value;
|
|
||||||
}
|
|
||||||
return this.formatMoney(value, pattern) + unit || "";
|
|
||||||
},
|
|
||||||
|
|
||||||
formatFileSize(value) {
|
|
||||||
if (null == value || value == '') {
|
|
||||||
return "0 Bytes";
|
|
||||||
}
|
|
||||||
var unitArr = new Array("Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB");
|
|
||||||
var index = 0;
|
|
||||||
var srcsize = parseFloat(value);
|
|
||||||
index = Math.floor(Math.log(srcsize) / Math.log(1024));
|
|
||||||
var size = srcsize / Math.pow(1024, index);
|
|
||||||
size = size.toFixed(2);
|
|
||||||
return size + unitArr[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
格式化器:
|
|
||||||
支持日期格式化、格式化数字显示、格式化金额、格式化星期、小写金额转大写、文件格式化
|
|
||||||
|
|
||||||
使用:
|
|
||||||
日期格式使用:
|
|
||||||
2018-02-24 23:28:28 :
|
|
||||||
var date=formatter.formatDateTime(new Date());
|
|
||||||
2018-02-24
|
|
||||||
var date=formatter.formatDate(new Date(),"yyyy-MM-dd");
|
|
||||||
2018/02/24
|
|
||||||
var date=formatter.formatDate(new Date(),"yyyy/MM/dd");
|
|
||||||
2018-02-24 23:28
|
|
||||||
var date=formatter.formatDate(new Date(),"yyyy-MM-dd HH:mm");
|
|
||||||
|
|
||||||
格式化数字显示方式:
|
|
||||||
123,45.999
|
|
||||||
var money=formatter.formatNumber(12345.999,'#,##0.00');
|
|
||||||
星期五
|
|
||||||
var week=formatter.formatWeek("五");
|
|
||||||
小写转大写
|
|
||||||
一千二百三十四
|
|
||||||
var chinese=formatter.formatMoneyAuto("1234");
|
|
||||||
文件大小转化:
|
|
||||||
1Kb
|
|
||||||
var fileSize=formatter.formatFileSize("1024");
|
|
||||||
|
|
||||||
1Mb
|
|
||||||
var fileSize=formatter.formatFileSize("1024*1024");
|
|
||||||
|
|
||||||
|
|
||||||
案例:
|
|
||||||
<script>
|
|
||||||
import formatter from '@/common/utils/formatter.js';
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
appcache: '0Mb'
|
|
||||||
};
|
|
||||||
},
|
|
||||||
onLoad(e) {
|
|
||||||
var self = this;
|
|
||||||
// #ifdef APP-PLUS
|
|
||||||
// 获取当前应用缓存大小并转化为MB、KB、GB等格式
|
|
||||||
plus.cache.calculate(function(size) {
|
|
||||||
console.log(size);
|
|
||||||
self.appcache = formatter.formatFileSize(size);
|
|
||||||
});
|
|
||||||
// #endif
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="coreshop-margin-left-10 coreshop-margin-right-10 coreshop-margin-bottom-10 coreshop-margin-top-10 coreshop-bg-white">
|
<view class="coreshop-margin-left-10 coreshop-margin-right-10 coreshop-margin-bottom-10 coreshop-margin-top-10 coreshop-bg-white">
|
||||||
<u-swiper :list="swiperItems" :height="swiperHeight" :interval="swiperDuration" keyName="image" @click="taped"></u-swiper>
|
<u-swiper :list="swiperItems" :height="swiperHeight" :interval="swiperDuration" keyName="image" @click="taped" indicator indicatorMode="line" circular></u-swiper>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
swiperItems: [],
|
swiperItems: [],
|
||||||
swiperHeight: 130,
|
swiperHeight: 150,
|
||||||
swiperDuration: 2500,
|
swiperDuration: 2500,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
<view class="solitaire-details-product-item" v-for="(item, index) in items" :key="index">
|
<view class="solitaire-details-product-item" v-for="(item, index) in items" :key="index">
|
||||||
<view class="coreshop-flex">
|
<view class="coreshop-flex">
|
||||||
<u-avatar :src="item.productObj.images ? item.productObj.images+'?x-oss-process=image/resize,m_lfit,h_320,w_240' : item.goodObj.image+'?x-oss-process=image/resize,m_lfit,h_320,w_240'" :size="60" shape="square"></u-avatar>
|
<u-avatar :src="item.productObj.images ? item.productObj.images+'?x-oss-process=image/resize,m_lfit,h_320,w_240' : item.goodObj.image+'?x-oss-process=image/resize,m_lfit,h_320,w_240'" :size="60" shape="square"></u-avatar>
|
||||||
<view class="coreshop-margin-left-10">
|
<view class="coreshop-margin-left-10 coreshop-btn-all">
|
||||||
<view class="coreshop-font-13 u-line-2">{{item.goodObj.name}} </view>
|
<view class="coreshop-font-13 u-line-2">{{item.goodObj.name}} </view>
|
||||||
<view class="coreshop-font-12 coreshop-text-yellow coreshop-margin-top-10 u-line-1">{{ item.productObj.spesDesc }}</view>
|
<view class="coreshop-font-12 coreshop-text-yellow coreshop-margin-top-10 u-line-1">{{ item.productObj.spesDesc }}</view>
|
||||||
<view class="coreshop-flex coreshop-justify-between coreshop-margin-top-10">
|
<view class="coreshop-flex coreshop-justify-between coreshop-margin-top-10">
|
||||||
@@ -134,8 +134,6 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 右边浮动球 -->
|
|
||||||
<!--<coreshop-fab horizontal="right" vertical="bottom" direction="vertical"></coreshop-fab>-->
|
|
||||||
<!-- 登录提示 -->
|
<!-- 登录提示 -->
|
||||||
<coreshop-login-modal></coreshop-login-modal>
|
<coreshop-login-modal></coreshop-login-modal>
|
||||||
|
|
||||||
@@ -144,7 +142,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import formatter from '@/common/utils/formatter.js';
|
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
@@ -160,7 +157,7 @@
|
|||||||
background: 'none',
|
background: 'none',
|
||||||
color: '#fff'
|
color: '#fff'
|
||||||
},
|
},
|
||||||
totalprice: '0.00',
|
totalprice: 0,
|
||||||
cart: [],
|
cart: [],
|
||||||
type: 2,
|
type: 2,
|
||||||
cartType: this.$globalConstVars.paymentType.solitaire,
|
cartType: this.$globalConstVars.paymentType.solitaire,
|
||||||
@@ -209,11 +206,10 @@
|
|||||||
this.cart.forEach(function (item, index, input) {
|
this.cart.forEach(function (item, index, input) {
|
||||||
goodsTotalMoney += item.price * item.nums
|
goodsTotalMoney += item.price * item.nums
|
||||||
})
|
})
|
||||||
//this.totalprice = this.$common.formatMoney(goodsTotalMoney, 2, '')
|
this.totalprice = parseFloat(goodsTotalMoney).toFixed(2);
|
||||||
this.totalprice = parseFloat(formatter.formatMoney(goodsTotalMoney))
|
console.log(this.totalprice);
|
||||||
},
|
},
|
||||||
toNumberChange: function (e) {
|
toNumberChange: function (e) {
|
||||||
console.log(e);
|
|
||||||
this.$u.throttle(this.numberChange(e), 500)
|
this.$u.throttle(this.numberChange(e), 500)
|
||||||
},
|
},
|
||||||
numberChange: function (e) {
|
numberChange: function (e) {
|
||||||
@@ -221,6 +217,11 @@
|
|||||||
var item = this.items[e.name];
|
var item = this.items[e.name];
|
||||||
var nums = e.value;
|
var nums = e.value;
|
||||||
|
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中',
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
|
||||||
if (nums > 0) {
|
if (nums > 0) {
|
||||||
let data = {
|
let data = {
|
||||||
ProductId: item.productId,
|
ProductId: item.productId,
|
||||||
@@ -267,9 +268,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_this.getGoodsTotalMoney();
|
_this.getGoodsTotalMoney();
|
||||||
|
setTimeout(function () {
|
||||||
|
uni.hideLoading();
|
||||||
|
}, 500);
|
||||||
} else {
|
} else {
|
||||||
_this.$u.toast(res.msg);
|
_this.$u.toast(res.msg);
|
||||||
|
setTimeout(function () {
|
||||||
|
uni.hideLoading();
|
||||||
|
}, 500);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -277,7 +283,6 @@
|
|||||||
var deleteId = 0;
|
var deleteId = 0;
|
||||||
for (var i = 0; i < _this.cart.length; i++) {
|
for (var i = 0; i < _this.cart.length; i++) {
|
||||||
if (_this.cart[i].key == e.name && _this.cart[i].productId == item.productId) {
|
if (_this.cart[i].key == e.name && _this.cart[i].productId == item.productId) {
|
||||||
//移除数据库
|
|
||||||
deleteIndex = i;
|
deleteIndex = i;
|
||||||
deleteId = _this.cart[i].id;
|
deleteId = _this.cart[i].id;
|
||||||
}
|
}
|
||||||
@@ -290,6 +295,13 @@
|
|||||||
if (res.status) {
|
if (res.status) {
|
||||||
_this.cart.splice(deleteIndex, 1);
|
_this.cart.splice(deleteIndex, 1);
|
||||||
_this.getGoodsTotalMoney();
|
_this.getGoodsTotalMoney();
|
||||||
|
setTimeout(function () {
|
||||||
|
uni.hideLoading();
|
||||||
|
}, 500);
|
||||||
|
} else {
|
||||||
|
setTimeout(function () {
|
||||||
|
uni.hideLoading();
|
||||||
|
}, 500);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -300,9 +312,11 @@
|
|||||||
this.$u.toast('请先选择商品')
|
this.$u.toast('请先选择商品')
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
var totalprice = parseFloat(formatter.formatMoney(this.totalprice));
|
var totalprice = parseFloat(this.totalprice);
|
||||||
var startBuyPrice = parseFloat(formatter.formatMoney(this.model.startBuyPrice));
|
var startBuyPrice = parseFloat(this.model.startBuyPrice);
|
||||||
if (totalprice < startBuyPrice) {
|
console.log('商品价格:' + this.totalprice);
|
||||||
|
console.log('起购价格:' + this.model.startBuyPrice);
|
||||||
|
if (this.totalprice < this.model.startBuyPrice) {
|
||||||
this.$u.toast('最小购买价格为' + this.model.startBuyPrice + '元,请增加购买产品')
|
this.$u.toast('最小购买价格为' + this.model.startBuyPrice + '元,请增加购买产品')
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,14 +42,16 @@
|
|||||||
<view class="fliter-item-title-hd"><view class="fliter-item-title-hd-title">品牌</view></view>
|
<view class="fliter-item-title-hd"><view class="fliter-item-title-hd-title">品牌</view></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="fliter-i-c coreshop-flex-direction-row">
|
<view class="fliter-i-c coreshop-flex-direction-row">
|
||||||
<view v-for="item in brandList" :key="item.id" v-if="item.id && item.name" @click="selectKey('brandList', item.id)">
|
<scroll-view style="max-height: 300px;" :scroll-top="scrollTop" scroll-y="true" class="scroll-Y" show-scrollbar="true">
|
||||||
<view class="fic-item" v-if="!item.isSelect">
|
<view v-for="item in brandList" :key="item.id" v-if="item.id && item.name" @click="selectKey('brandList', item.id)">
|
||||||
<view class="fic-item-text two-line">{{ item.name }}</view>
|
<view class="fic-item" v-if="!item.isSelect">
|
||||||
|
<view class="fic-item-text two-line">{{ item.name }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="fic-item fic-item-active" v-if="item.isSelect">
|
||||||
|
<view class="fic-item-text two-line">{{ item.name }}</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="fic-item fic-item-active" v-if="item.isSelect">
|
</scroll-view>
|
||||||
<view class="fic-item-text two-line">{{ item.name }}</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="fliter-item" v-if="labelList.length > 0">
|
<view class="fliter-item" v-if="labelList.length > 0">
|
||||||
@@ -248,7 +250,6 @@
|
|||||||
//加载执行
|
//加载执行
|
||||||
onLoad: function (options) {
|
onLoad: function (options) {
|
||||||
uni.showTabBar();
|
uni.showTabBar();
|
||||||
//console.log(options);
|
|
||||||
var where = {};
|
var where = {};
|
||||||
if (options.id) {
|
if (options.id) {
|
||||||
where.catId = options.id;
|
where.catId = options.id;
|
||||||
@@ -331,7 +332,6 @@
|
|||||||
},
|
},
|
||||||
//点击综合排序
|
//点击综合排序
|
||||||
comprehensive: function (value) {
|
comprehensive: function (value) {
|
||||||
//console.log('点击综合排序:' + value);
|
|
||||||
if (value) {
|
if (value) {
|
||||||
this.searchData.order = {
|
this.searchData.order = {
|
||||||
key: 'sort',
|
key: 'sort',
|
||||||
@@ -433,7 +433,6 @@
|
|||||||
_this.labelList = filter.labelIds;
|
_this.labelList = filter.labelIds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//console.log(_this.searchData);
|
|
||||||
if (res.data.totalPages > _this.searchData.page) {
|
if (res.data.totalPages > _this.searchData.page) {
|
||||||
_this.loadStatus = 'loadmore';
|
_this.loadStatus = 'loadmore';
|
||||||
_this.searchData.page++;
|
_this.searchData.page++;
|
||||||
@@ -615,7 +614,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == 'brandList') {
|
if (type == 'brandList') {
|
||||||
for (let i = 0; i < this.brandList.length; i++) {
|
for (let i = 0; i < this.brandList.length; i++) {
|
||||||
if (this.brandList[i].id == id) {
|
if (this.brandList[i].id == id) {
|
||||||
@@ -625,7 +623,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == 'labelList') {
|
if (type == 'labelList') {
|
||||||
for (let i = 0; i < this.labelList.length; i++) {
|
for (let i = 0; i < this.labelList.length; i++) {
|
||||||
if (this.labelList[i].id == id) {
|
if (this.labelList[i].id == id) {
|
||||||
@@ -635,7 +632,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(this.brandList);
|
|
||||||
},
|
},
|
||||||
closeDropdown() {
|
closeDropdown() {
|
||||||
this.$refs.uDropdown.close();
|
this.$refs.uDropdown.close();
|
||||||
|
|||||||
@@ -682,37 +682,6 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region 设置是否支付============================================================
|
|
||||||
// POST: Api/CoreCmsUserServicesOrder/DoSetisPay/10
|
|
||||||
/// <summary>
|
|
||||||
/// 设置是否支付
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="entity"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost]
|
|
||||||
[Description("设置是否支付")]
|
|
||||||
public async Task<AdminUiCallBack> DoSetisPay([FromBody] FMUpdateBoolDataByIntId entity)
|
|
||||||
{
|
|
||||||
var jm = new AdminUiCallBack();
|
|
||||||
|
|
||||||
var oldModel = await _coreCmsUserServicesOrderServices.QueryByIdAsync(entity.id, false);
|
|
||||||
if (oldModel == null)
|
|
||||||
{
|
|
||||||
jm.msg = "不存在此信息";
|
|
||||||
return jm;
|
|
||||||
}
|
|
||||||
oldModel.isPay = (bool)entity.data;
|
|
||||||
|
|
||||||
var bl = await _coreCmsUserServicesOrderServices.UpdateAsync(p => new CoreCmsUserServicesOrder() { isPay = oldModel.isPay }, p => p.id == oldModel.id);
|
|
||||||
jm.code = bl ? 0 : 1;
|
|
||||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
|
||||||
|
|
||||||
return jm;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region 获取核销码列表============================================================
|
#region 获取核销码列表============================================================
|
||||||
// POST: Api/CoreCmsUserServicesTicket/GetPageList
|
// POST: Api/CoreCmsUserServicesTicket/GetPageList
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -200,11 +200,11 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
laydate.render({
|
laydate.render({
|
||||||
elem: '#editTime-CoreCmsServices-startTime',
|
elem: '#createTime-CoreCmsServices-startTime',
|
||||||
type: 'datetime'
|
type: 'datetime'
|
||||||
});
|
});
|
||||||
laydate.render({
|
laydate.render({
|
||||||
elem: '#editTime-CoreCmsServices-endTime',
|
elem: '#createTime-CoreCmsServices-endTime',
|
||||||
type: 'datetime'
|
type: 'datetime'
|
||||||
});
|
});
|
||||||
laydate.render({
|
laydate.render({
|
||||||
|
|||||||
@@ -1,277 +0,0 @@
|
|||||||
<script type="text/html" template lay-done="layui.data.sendParams(d);">
|
|
||||||
<div class="layui-form coreshop-form layui-form-pane" lay-filter="LAY-app-CoreCmsServices-editForm" id="LAY-app-CoreCmsServices-editForm">
|
|
||||||
<input type="hidden" name="id" value="{{d.params.data.model.id || '' }}" />
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label for="title" class="layui-form-label layui-form-required">项目名称</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input name="title" lay-verify="required|verifytitle" value="{{d.params.data.model.title || '' }}" class="layui-input" lay-reqText="请输入项目名称" placeholder="请输入项目名称" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label for="description" class="layui-form-label layui-form-required">售价</label>
|
|
||||||
<div class="layui-input-inline layui-inline-2">
|
|
||||||
<input name="money" lay-verify="required|money" value="{{d.params.data.model.money || '' }}" class="layui-input" placeholder="请输入售价" lay-reqText="请输入售价" />
|
|
||||||
</div>
|
|
||||||
<label for="thumbnail" class="layui-form-label layui-form-required">项目缩略图</label>
|
|
||||||
<div class="layui-input-inline layui-inline-8">
|
|
||||||
<input name="thumbnail" id="thumbnailInput" lay-verify="required" value="{{d.params.data.model.thumbnail || '' }}" class="layui-input" placeholder="请上传项目缩略图" lay-reqText="请上传项目缩略图" />
|
|
||||||
</div>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<img class="coreshop-upload-img" id="viewImgBoxthumbnail" src="{{d.params.data.model.thumbnail || layui.setter.noImagePicUrl }}">
|
|
||||||
<button type="button" class="layui-btn" id="upBtnthumbnail" lay-active="doCropperImg">上传图片</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label for="description" class="layui-form-label layui-form-required">一句话概述</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<input name="description" lay-verify="required|verifydescription" class="layui-input" lay-reqText="请输入项目概述" placeholder="请输入项目概述" value="{{d.params.data.model.description || '' }}" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label for="allowedMembership" class="layui-form-label layui-form-required">允许会员</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<div id="selectBox" class="xm-select-demo"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label for="consumableStore" class="layui-form-label layui-form-required">核销门店</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<div id="selectStoreBox" class="xm-select-demo"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label for="status" class="layui-form-label layui-form-required">项目状态</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<select name="status">
|
|
||||||
{{# layui.each(d.params.data.status, function(index, item){ }}
|
|
||||||
<option value="{{ item.value }}" {{ d.params.data.model.status==item.value ? 'selected="selected"' : '' }}>{{ item.description }}</option>
|
|
||||||
{{# }); }}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<label for="maxBuyNumber" class="layui-form-label layui-form-required">重复购买数</label>
|
|
||||||
<div class="layui-input-inline layui-inline-2">
|
|
||||||
<input type="number" min="0" max="999999" name="maxBuyNumber" lay-verify="required|number" class="layui-input" value="{{d.params.data.model.maxBuyNumber}}" placeholder="请输入项目重复购买次数" lay-reqText="请输入项目重复购买次数并为数字" />
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-mid">0为不限制</div>
|
|
||||||
<label for="amount" class="layui-form-label layui-form-required">可销售数量</label>
|
|
||||||
<div class="layui-input-inline layui-inline-2">
|
|
||||||
<input type="number" min="0" max="999999" name="amount" lay-verify="required|number" class="layui-input" value="{{d.params.data.model.amount }}" placeholder="请输入项目可销售数量" lay-reqText="请输入项目可销售数量并为数字" />
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-mid">销售完售罄状态</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label for="startTime" class="layui-form-label layui-form-required">可购买时间</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<input name="startTime" id="editTime-CoreCmsServices-startTime" type="text" lay-verify="required|datetime" class="layui-input" placeholder="请输入项目开始时间" lay-reqText="请输入项目开始时间" value="{{d.params.data.model.startTime }}" />
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-mid">至</div>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<input name="endTime" id="editTime-CoreCmsServices-endTime" type="text" lay-verify="required|datetime" class="layui-input" placeholder="请输入项目截止时间" lay-reqText="请输入项目截止时间" value="{{d.params.data.model.endTime }}" />
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-mid">在此时间段内,前端才能进行显示并购买</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label for="validityType" class="layui-form-label layui-form-required">有效期类型</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
|
|
||||||
<select name="validityType" id="validityType" lay-verify="required" lay-verify="required|number" lay-reqText="请选择核销有效期类型" lay-filter="validityTypeChange">
|
|
||||||
{{# layui.each(d.params.data.types, function(index, item){ }}
|
|
||||||
<option value="{{ item.value }}" {{ d.params.data.model.validityType==item.value ? 'selected="selected"' : '' }}>{{ item.description }}</option>
|
|
||||||
{{# }); }}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-mid">不限:购买后不限制核销服务券时间,限时间段:只能在允许的时间段内进行服务券的核销消费。</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item" style="display: none;" id="validityBox">
|
|
||||||
<label for="validityStartTime" class="layui-form-label">核销时间段</label>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<input name="validityStartTime" id="editTime-CoreCmsServices-validityStartTime" type="text" class="layui-input" placeholder="请输入核销开始时间" lay-reqText="请输入核销开始时间" value="{{d.params.data.model.validityStartTime || '' }}" />
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-mid">至</div>
|
|
||||||
<div class="layui-input-inline">
|
|
||||||
<input name="validityEndTime" id="editTime-CoreCmsServices-validityEndTime" type="text" class="layui-input" placeholder="请输入核销结束时间" lay-reqText="请输入核销结束时间" value="{{d.params.data.model.validityEndTime || '' }}" />
|
|
||||||
</div>
|
|
||||||
<button type="button" class="layui-btn" lay-active="e1">三月内</button>
|
|
||||||
<button type="button" class="layui-btn" lay-active="e2">半年内</button>
|
|
||||||
<button type="button" class="layui-btn" lay-active="e3">一年内</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<label for="ticketNumber" class="layui-form-label layui-form-required">服务券数量</label>
|
|
||||||
<div class="layui-input-inline layui-inline-2">
|
|
||||||
<input type="number" min="0" max="999999" name="ticketNumber" lay-verify="required|number" class="layui-input" value="{{d.params.data.model.ticketNumber || '' }}" placeholder="请输入核销服务券数量" lay-reqText="请输入核销服务券数量并为数字" />
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-mid">购买服务项目后,将按照此数量发送服务券。到店使用服务券上的核销码进行核销消费</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item layui-form-text">
|
|
||||||
<label for="contentBody" class="layui-form-label layui-form-required">详细说明</label>
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<div class="document-editor">
|
|
||||||
<div class="toolbar-container" id="toolbar-container"></div>
|
|
||||||
<div class="content-container">
|
|
||||||
<div id="editor"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="layui-form-item text-right core-hidden">
|
|
||||||
<input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-CoreCmsServices-editForm-submit" id="LAY-app-CoreCmsServices-editForm-submit" value="确认编辑">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</script>
|
|
||||||
<script>
|
|
||||||
var debug = layui.setter.debug;
|
|
||||||
layui.data.sendParams = function (d) {
|
|
||||||
//开启调试情况下获取接口赋值数据
|
|
||||||
if (debug) { console.log(d.params.data); }
|
|
||||||
layui.use(['admin', 'form', 'laydate', 'coreHelper', 'cropperImg', 'xmSelect', 'util'],
|
|
||||||
function () {
|
|
||||||
var $ = layui.$
|
|
||||||
, form = layui.form
|
|
||||||
, admin = layui.admin
|
|
||||||
, laydate = layui.laydate
|
|
||||||
, cropperImg = layui.cropperImg
|
|
||||||
, xmSelect = layui.xmSelect
|
|
||||||
, util = layui.util
|
|
||||||
, coreHelper = layui.coreHelper;
|
|
||||||
|
|
||||||
if (d.params.data.model.validityType == 2) {
|
|
||||||
$('#validityBox').show();
|
|
||||||
}
|
|
||||||
|
|
||||||
let dataStrArr = d.params.data.model.allowedMembership.split(","); //分割成字符串数组
|
|
||||||
let dataIntArr = [];//保存转换后的整型字符串
|
|
||||||
dataStrArr.forEach(item => {
|
|
||||||
dataIntArr.push(+item);
|
|
||||||
});
|
|
||||||
|
|
||||||
var selectBox = xmSelect.render({
|
|
||||||
el: '#selectBox',
|
|
||||||
tips: '请选择用户级别?',
|
|
||||||
name: 'allowedMembership',
|
|
||||||
layVerify: 'required',
|
|
||||||
prop: {
|
|
||||||
name: 'title',
|
|
||||||
value: 'id',
|
|
||||||
},
|
|
||||||
data: d.params.data.userGrade,
|
|
||||||
initValue: dataIntArr
|
|
||||||
})
|
|
||||||
|
|
||||||
let dataStoreStrArr = d.params.data.model.consumableStore.split(","); //分割成字符串数组
|
|
||||||
let dataStoreIntArr = [];//保存转换后的整型字符串
|
|
||||||
dataStoreStrArr.forEach(item => {
|
|
||||||
dataStoreIntArr.push(+item);
|
|
||||||
});
|
|
||||||
var selectStoreBox = xmSelect.render({
|
|
||||||
el: '#selectStoreBox',
|
|
||||||
tips: '请选择核销门店?',
|
|
||||||
name: 'consumableStore',
|
|
||||||
layVerify: 'required',
|
|
||||||
prop: {
|
|
||||||
name: 'storeName',
|
|
||||||
value: 'id',
|
|
||||||
},
|
|
||||||
data: d.params.data.stores,
|
|
||||||
initValue: dataStoreIntArr
|
|
||||||
})
|
|
||||||
|
|
||||||
//加载编辑器
|
|
||||||
var Authorization = layui.data(layui.setter.tableName)[layui.setter.request.tokenName];
|
|
||||||
editor = CKEDITOR.replace('editor', {
|
|
||||||
fileTools_requestHeaders: {
|
|
||||||
'Authorization': Authorization
|
|
||||||
}
|
|
||||||
});
|
|
||||||
editor.setData(d.params.data.model.contentBody);
|
|
||||||
|
|
||||||
//项目缩略图图片上传
|
|
||||||
$('#upBtnthumbnail').click(function () {
|
|
||||||
cropperImg.cropImg({
|
|
||||||
aspectRatio: 1 / 1,
|
|
||||||
imgSrc: $('#viewImgBoxthumbnail').attr('src'),
|
|
||||||
onCrop: function (data) {
|
|
||||||
var loadIndex = layer.load(2);
|
|
||||||
coreHelper.Post("api/Tools/UploadFilesFByBase64", { base64: data }, function (res) {
|
|
||||||
if (0 === res.code) {
|
|
||||||
$('#viewImgBoxthumbnail').attr('src', res.data.fileUrl);
|
|
||||||
$("#thumbnailInput").val(res.data.fileUrl);
|
|
||||||
layer.msg(res.msg);
|
|
||||||
layer.close(loadIndex);
|
|
||||||
} else {
|
|
||||||
layer.close(loadIndex);
|
|
||||||
layer.msg(res.msg, { icon: 2, anim: 6 });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
laydate.render({
|
|
||||||
elem: '#editTime-CoreCmsServices-startTime',
|
|
||||||
type: 'datetime'
|
|
||||||
});
|
|
||||||
laydate.render({
|
|
||||||
elem: '#editTime-CoreCmsServices-endTime',
|
|
||||||
type: 'datetime'
|
|
||||||
});
|
|
||||||
laydate.render({
|
|
||||||
elem: '#editTime-CoreCmsServices-validityStartTime',
|
|
||||||
type: 'datetime'
|
|
||||||
});
|
|
||||||
laydate.render({
|
|
||||||
elem: '#editTime-CoreCmsServices-validityEndTime',
|
|
||||||
type: 'datetime'
|
|
||||||
});
|
|
||||||
|
|
||||||
form.verify({
|
|
||||||
money: [/((^[1-9]\d*)|^0)(\.\d{0,2}){0,1}$/, '请输入金额'],
|
|
||||||
verifytitle: [/^[\S]{0,50}$/, '项目名称最大只允许输入50位字符,且不能出现空格'],
|
|
||||||
verifythumbnail: [/^[\S]{0,255}$/, '项目缩略图最大只允许输入255位字符,且不能出现空格'],
|
|
||||||
verifydescription: [/^[\S]{0,255}$/, '项目概述最大只允许输入255位字符,且不能出现空格'],
|
|
||||||
verifyallowedMembership: [/^[\S]{0,50}$/, '允许购买会员级别最大只允许输入50位字符,且不能出现空格'],
|
|
||||||
});
|
|
||||||
|
|
||||||
form.on('select(validityTypeChange)', function (data) {
|
|
||||||
console.log(data.value);
|
|
||||||
if (data.value == 2) {
|
|
||||||
$('#validityBox').show();
|
|
||||||
} else {
|
|
||||||
$('#validityBox').hide();
|
|
||||||
$('#editTime-CoreCmsServices-validityStartTime').val("");
|
|
||||||
$('#editTime-CoreCmsServices-validityEndTime').val("");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//处理属性 为 lay-active 的所有元素事件
|
|
||||||
util.event('lay-active', {
|
|
||||||
e1: function () {
|
|
||||||
$('#editTime-CoreCmsServices-validityStartTime').val(layui.util.toDateString(new Date(), 'yyyy-MM-dd 00:00:00'));
|
|
||||||
$('#editTime-CoreCmsServices-validityEndTime').val(layui.util.toDateString((new Date()).setMonth((new Date()).getMonth() + 3), 'yyyy-MM-dd 00:00:00'));
|
|
||||||
}
|
|
||||||
, e2: function () {
|
|
||||||
$('#editTime-CoreCmsServices-validityStartTime').val(layui.util.toDateString(new Date(), 'yyyy-MM-dd 00:00:00'));
|
|
||||||
$('#editTime-CoreCmsServices-validityEndTime').val(layui.util.toDateString((new Date()).setMonth((new Date()).getMonth() + 6), 'yyyy-MM-dd 00:00:00'));
|
|
||||||
}
|
|
||||||
, e3: function () {
|
|
||||||
$('#editTime-CoreCmsServices-validityStartTime').val(layui.util.toDateString(new Date(), 'yyyy-MM-dd 00:00:00'));
|
|
||||||
$('#editTime-CoreCmsServices-validityEndTime').val(layui.util.toDateString((new Date()).setFullYear((new Date()).getFullYear() + 1), 'yyyy-MM-dd 00:00:00'));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//重载form
|
|
||||||
form.render(null, 'LAY-app-CoreCmsServices-editForm');
|
|
||||||
})
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<title>服务项目表</title>
|
<title>服务购买表</title>
|
||||||
<!--当前位置开始-->
|
<!--当前位置开始-->
|
||||||
<div class="layui-card layadmin-header">
|
<div class="layui-card layadmin-header">
|
||||||
<div class="layui-breadcrumb" lay-filter="breadcrumb">
|
<div class="layui-breadcrumb" lay-filter="breadcrumb">
|
||||||
@@ -10,70 +10,98 @@
|
|||||||
<style>
|
<style>
|
||||||
/* 重写样式 */
|
/* 重写样式 */
|
||||||
</style>
|
</style>
|
||||||
<script type="text/html" template lay-type="Post" lay-url="{{ layui.setter.apiUrl }}Api/CoreCmsServices/GetIndex" lay-done="layui.data.done(d);">
|
<script type="text/html" template lay-type="Post" lay-url="{{ layui.setter.apiUrl }}Api/CoreCmsUserServicesOrder/GetIndex" lay-done="layui.data.done(d);">
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<div class="table-body">
|
<div class="table-body">
|
||||||
<table id="LAY-app-CoreCmsServices-tableBox" lay-filter="LAY-app-CoreCmsServices-tableBox"></table>
|
<table id="LAY-app-CoreCmsUserServicesOrder-tableBox" lay-filter="LAY-app-CoreCmsUserServicesOrder-tableBox"></table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/html" id="LAY-app-CoreCmsServices-toolbar">
|
<script type="text/html" id="LAY-app-CoreCmsUserServicesOrder-toolbar">
|
||||||
<div class="layui-form coreshop-toolbar-search-form">
|
<div class="layui-form coreshop-toolbar-search-form">
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
|
<div class="layui-inline">
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="text" name="serviceOrderId" placeholder="请输入服务订单编号" class="layui-input">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-inline">
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="text" name="userId" placeholder="请输入关联用户" class="layui-input">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-inline">
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="text" name="servicesId" placeholder="请输入关联服务" class="layui-input">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-inline">
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<select name="isPay">
|
||||||
|
<option value="">请选择是否支付</option>
|
||||||
|
<option value="True">是</option>
|
||||||
|
<option value="False">否</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="layui-inline">
|
<div class="layui-inline">
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<input type="text" name="title" placeholder="请输入项目名称" class="layui-input">
|
<input type="text" name="paymentId" placeholder="请输入支付单号" class="layui-input">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-inline">
|
<div class="layui-inline">
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<select name="status">
|
<select name="status">
|
||||||
<option value="">请选择项目状态</option>
|
<option value="">请选择状态</option>
|
||||||
{{# layui.each(indexData.status, function(index, item){ }}
|
{{# layui.each(indexData.serviceOrderStatus, function(index, item){ }}
|
||||||
<option value="{{ item.value }}">{{ item.description }}</option>
|
<option value="{{ item.value }}">{{ item.title }}</option>
|
||||||
{{# }); }}
|
{{# }); }}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="layui-inline">
|
<div class="layui-inline">
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline" style="width: 260px;">
|
||||||
<select name="validityType">
|
<input type="text" name="payTime" id="searchTime-CoreCmsUserServicesOrder-payTime" placeholder="请输入支付时间" class="layui-input">
|
||||||
<option value="">请选择核销类型</option>
|
|
||||||
{{# layui.each(indexData.types, function(index, item){ }}
|
|
||||||
<option value="{{ item.value }}">{{ item.description }}</option>
|
|
||||||
{{# }); }}
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="layui-inline">
|
<div class="layui-inline">
|
||||||
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-CoreCmsServices-search"><i class="layui-icon layui-icon-search"></i>筛选</button>
|
<div class="layui-input-inline" style="width: 260px;">
|
||||||
|
<input type="text" name="createTime" id="searchTime-CoreCmsUserServicesOrder-createTime" placeholder="请输入订单创建时间" class="layui-input">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-inline">
|
||||||
|
<div class="layui-input-inline" style="width: 260px;">
|
||||||
|
<input type="text" name="servicesEndTime" id="searchTime-CoreCmsUserServicesOrder-servicesEndTime" placeholder="请输入截止服务时间" class="layui-input">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-inline">
|
||||||
|
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-CoreCmsUserServicesOrder-search"><i class="layui-icon layui-icon-search"></i>筛选</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
<script type="text/html" id="LAY-app-CoreCmsServices-pagebar">
|
|
||||||
|
<script type="text/html" id="LAY-app-CoreCmsUserServicesOrder-pagebar">
|
||||||
<div class="layui-btn-container">
|
<div class="layui-btn-container">
|
||||||
<button class="layui-btn layui-btn-sm" lay-event="addData"><i class="layui-icon layui-icon-add-1"></i>添加数据</button>
|
|
||||||
<button class="layui-btn layui-btn-sm" lay-event="selectExportExcel"><i class="layui-icon layui-icon-add-circle"></i>选择导出</button>
|
<button class="layui-btn layui-btn-sm" lay-event="selectExportExcel"><i class="layui-icon layui-icon-add-circle"></i>选择导出</button>
|
||||||
<button class="layui-btn layui-btn-sm" lay-event="queryExportExcel"><i class="layui-icon layui-icon-download-circle"></i>查询导出</button>
|
<button class="layui-btn layui-btn-sm" lay-event="queryExportExcel"><i class="layui-icon layui-icon-download-circle"></i>查询导出</button>
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
<script type="text/html" id="LAY-app-CoreCmsServices-tableBox-bar">
|
|
||||||
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
|
<script type="text/html" id="LAY-app-CoreCmsUserServicesOrder-tableBox-bar">
|
||||||
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
|
<a class="layui-btn layui-btn-xs" lay-event="detail">核销码</a>
|
||||||
<a class="layui-btn layui-btn-danger layui-btn-xs" data-dropdown="#CoreCmsServicesTbDelDrop{{d.LAY_INDEX}}" no-shade="true">删除</a>
|
<a class="layui-btn layui-btn-danger layui-btn-xs" data-dropdown="#CoreCmsUserServicesOrderTbCancellationDrop{{d.LAY_INDEX}}" no-shade="true">作废</a>
|
||||||
<div class="dropdown-menu-nav dropdown-popconfirm dropdown-top-right layui-hide" id="CoreCmsServicesTbDelDrop{{d.LAY_INDEX}}"
|
<div class="dropdown-menu-nav dropdown-popconfirm dropdown-top-right layui-hide" id="CoreCmsUserServicesOrderTbCancellationDrop{{d.LAY_INDEX}}"
|
||||||
style="max-width: 200px;white-space: normal;min-width: auto;margin-left: 10px;">
|
style="max-width: 200px;white-space: normal;min-width: auto;margin-left: 10px;">
|
||||||
<div class="dropdown-anchor"></div>
|
<div class="dropdown-anchor"></div>
|
||||||
<div class="dropdown-popconfirm-title">
|
<div class="dropdown-popconfirm-title">
|
||||||
<i class="layui-icon layui-icon-help"></i>
|
<i class="layui-icon layui-icon-help"></i>
|
||||||
确定要删除吗?
|
确定要作废订单吗?
|
||||||
</div>
|
</div>
|
||||||
<div class="dropdown-popconfirm-btn">
|
<div class="dropdown-popconfirm-btn">
|
||||||
<a class="layui-btn layui-btn-primary cursor" btn-cancel>取消</a>
|
<a class="layui-btn layui-btn-primary cursor" btn-cancel>取消</a>
|
||||||
<a class="layui-btn layui-btn-normal cursor" lay-event="del">确定</a>
|
<a class="layui-btn layui-btn-normal cursor" lay-event="cancellation">确定</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
@@ -83,7 +111,7 @@
|
|||||||
var debug = layui.setter.debug;
|
var debug = layui.setter.debug;
|
||||||
layui.data.done = function (d) {
|
layui.data.done = function (d) {
|
||||||
//开启调试情况下获取接口赋值数据
|
//开启调试情况下获取接口赋值数据
|
||||||
if (debug) { console.log(d.data); }
|
if (debug) { console.log(d); }
|
||||||
|
|
||||||
indexData = d.data;
|
indexData = d.data;
|
||||||
layui.use(['index', 'table', 'laydate', 'util', 'coredropdown', 'coreHelper'],
|
layui.use(['index', 'table', 'laydate', 'util', 'coredropdown', 'coreHelper'],
|
||||||
@@ -98,25 +126,22 @@
|
|||||||
, util = layui.util
|
, util = layui.util
|
||||||
, view = layui.view;
|
, view = layui.view;
|
||||||
|
|
||||||
|
|
||||||
//重载form
|
|
||||||
form.render();
|
|
||||||
var searchwhere;
|
var searchwhere;
|
||||||
//监听搜索
|
//监听搜索
|
||||||
form.on('submit(LAY-app-CoreCmsServices-search)',
|
form.on('submit(LAY-app-CoreCmsUserServicesOrder-search)',
|
||||||
function (data) {
|
function (data) {
|
||||||
var field = data.field;
|
var field = data.field;
|
||||||
searchwhere = field;
|
searchwhere = field;
|
||||||
//执行重载
|
//执行重载
|
||||||
table.reloadData('LAY-app-CoreCmsServices-tableBox', { where: field });
|
table.reloadData('LAY-app-CoreCmsUserServicesOrder-tableBox', { where: field });
|
||||||
});
|
});
|
||||||
//数据绑定
|
//数据绑定
|
||||||
table.render({
|
table.render({
|
||||||
elem: '#LAY-app-CoreCmsServices-tableBox',
|
elem: '#LAY-app-CoreCmsUserServicesOrder-tableBox',
|
||||||
url: layui.setter.apiUrl + 'Api/CoreCmsServices/GetPageList',
|
url: layui.setter.apiUrl + 'Api/CoreCmsUserServicesOrder/GetPageList',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
toolbar: '#LAY-app-CoreCmsServices-toolbar',
|
toolbar: '#LAY-app-CoreCmsUserServicesOrder-toolbar',
|
||||||
pagebar: '#LAY-app-CoreCmsServices-pagebar',
|
pagebar: '#LAY-app-CoreCmsUserServicesOrder-pagebar',
|
||||||
className: 'pagebarbox',
|
className: 'pagebarbox',
|
||||||
defaultToolbar: ['filter', 'print', 'exports'],
|
defaultToolbar: ['filter', 'print', 'exports'],
|
||||||
height: 'full-127',//面包屑142px,搜索框4行172,3行137,2行102,1行67
|
height: 'full-127',//面包屑142px,搜索框4行172,3行137,2行102,1行67
|
||||||
@@ -127,77 +152,36 @@
|
|||||||
cols: [
|
cols: [
|
||||||
[
|
[
|
||||||
{ type: "checkbox", fixed: "left" },
|
{ type: "checkbox", fixed: "left" },
|
||||||
{ field: 'id', title: '序列', width: 70, sort: false },
|
{ field: 'id', title: '序列', width: 50, sort: false },
|
||||||
{ field: 'title', title: '项目名称', sort: false, width: 205 },
|
{ field: 'serviceOrderId', title: '服务订单编号', sort: false, width: 125 },
|
||||||
{
|
{
|
||||||
field: 'thumbnail', title: '缩略图', sort: false, width: 85,
|
field: 'userId', title: '关联用户', sort: false, width: 155, templet: function (d) {
|
||||||
templet: function (d) {
|
return d.userId + '【' + d.userName + '】';
|
||||||
if (d.thumbnail) {
|
|
||||||
return '<a href="javascript:void(0);" onclick=layui.coreHelper.viewImage("' + d.thumbnail + '")><image style="max-width:28px;max-height:28px;" src="' + d.thumbnail + '" /></a>';
|
|
||||||
} else {
|
|
||||||
return '<a href="javascript:void(0);" onclick=layui.coreHelper.viewImage("' + setter.noImagePicUrl + '")><image style="max-width:30px;max-height:30px;" src="' + setter.noImagePicUrl + '" /></a>';
|
|
||||||
}
|
|
||||||
}, width: 60
|
|
||||||
},
|
|
||||||
{ field: 'money', title: '售价', sort: false, width: 80, templet: function (data) { return '¥' + data.money } },
|
|
||||||
|
|
||||||
//{ field: 'description', title: '项目概述', sort: false, width: 105 },
|
|
||||||
//{ field: 'contentBody', title: '项目详细说明', sort: false, width: 105 },
|
|
||||||
{
|
|
||||||
field: 'allowedMembership', title: '允许购买会员级别', sort: false, width: 305, templet: function (data) {
|
|
||||||
var arr = data.allowedMembership.split(',');
|
|
||||||
var outStr = "";
|
|
||||||
for (var i = 0; i < arr.length; i++) {
|
|
||||||
for (var j = 0; j < d.data.userGrade.length; j++) {
|
|
||||||
if (d.data.userGrade[j].id == arr[i]) {
|
|
||||||
outStr += '<span class="layui-badge layui-badge-gray">' + d.data.userGrade[j].title + '</span> ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return outStr;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{ field: 'serviceTitle', title: '关联服务', sort: false },
|
||||||
|
{ field: 'isPay', title: '是否支付', width: 95, templet: '#switch_isPay', sort: false, unresize: true },
|
||||||
|
{ field: 'payTime', title: '支付时间', width: 130, sort: false },
|
||||||
|
{ field: 'paymentId', title: '支付单号', sort: false, width: 125 },
|
||||||
{
|
{
|
||||||
field: 'status',
|
field: 'status', title: '状态', sort: false, width: 80, templet: function (data) {
|
||||||
title: '项目状态',
|
for (var i = 0; i < d.data.serviceOrderStatus.length; i++) {
|
||||||
sort: false,
|
if (data.status == d.data.serviceOrderStatus[i].value) {
|
||||||
width: 85,
|
return d.data.serviceOrderStatus[i].description;
|
||||||
templet: function (data) {
|
|
||||||
for (var j = 0; j < d.data.status.length; j++) {
|
|
||||||
if (d.data.status[j].value == data.status) {
|
|
||||||
return d.data.status[j].description;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ field: 'maxBuyNumber', title: '项目重复购买次数', sort: false, width: 125 },
|
{ field: 'createTime', title: '订单创建时间', width: 130, sort: false },
|
||||||
{ field: 'amount', title: '项目可销售数量', sort: false, width: 105 },
|
{ field: 'servicesEndTime', title: '截止服务时间', width: 130, sort: false },
|
||||||
{ field: 'startTime', title: '项目开始时间', width: 130, sort: false },
|
{ width: 122, align: 'center', title: '操作', fixed: 'right', toolbar: '#LAY-app-CoreCmsUserServicesOrder-tableBox-bar' }
|
||||||
{ field: 'endTime', title: '项目截止时间', width: 130, sort: false },
|
|
||||||
{
|
|
||||||
field: 'validityType', title: '核销有效期类型', sort: false, width: 105,
|
|
||||||
templet: function (data) {
|
|
||||||
for (var j = 0; j < d.data.types.length; j++) {
|
|
||||||
if (d.data.types[j].value == data.validityType) {
|
|
||||||
return d.data.types[j].description;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ field: 'validityStartTime', title: '核销开始时间', width: 130, sort: false },
|
|
||||||
{ field: 'validityEndTime', title: '核销结束时间', width: 130, sort: false },
|
|
||||||
{ field: 'ticketNumber', title: '核销服务券数量', sort: false, width: 105 },
|
|
||||||
{ field: 'createTime', title: '项目创建时间', width: 130, sort: false },
|
|
||||||
{ field: 'updateTime', title: '项目更新时间', width: 130, sort: false },
|
|
||||||
{ width: 142, align: 'center', title: '操作', fixed: 'right', toolbar: '#LAY-app-CoreCmsServices-tableBox-bar' }
|
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
//监听排序事件
|
//监听排序事件
|
||||||
table.on('sort(LAY-app-CoreCmsServices-tableBox)', function (obj) {
|
table.on('sort(LAY-app-CoreCmsUserServicesOrder-tableBox)', function (obj) {
|
||||||
table.reloadData('LAY-app-CoreCmsServices-tableBox', {
|
table.reloadData('LAY-app-CoreCmsUserServicesOrder-tableBox', {
|
||||||
initSort: obj, //记录初始排序,如果不设的话,将无法标记表头的排序状态。
|
initSort: obj, //记录初始排序,如果不设的话,将无法标记表头的排序状态。
|
||||||
where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式)
|
where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式)
|
||||||
orderField: obj.field, //排序字段
|
orderField: obj.field, //排序字段
|
||||||
@@ -206,20 +190,14 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
//监听行双击事件
|
//监听行双击事件
|
||||||
table.on('rowDouble(LAY-app-CoreCmsServices-tableBox)', function (obj) {
|
table.on('rowDouble(LAY-app-CoreCmsUserServicesOrder-tableBox)', function (obj) {
|
||||||
//查看详情
|
//查看详情
|
||||||
doDetails(obj);
|
doDetails(obj);
|
||||||
});
|
});
|
||||||
//头工具栏事件
|
//头工具栏事件
|
||||||
table.on('pagebar(LAY-app-CoreCmsServices-tableBox)', function (obj) {
|
table.on('pagebar(LAY-app-CoreCmsUserServicesOrder-tableBox)', function (obj) {
|
||||||
var checkStatus = table.checkStatus(obj.config.id);
|
var checkStatus = table.checkStatus(obj.config.id);
|
||||||
switch (obj.event) {
|
switch (obj.event) {
|
||||||
case 'addData':
|
|
||||||
doCreate();
|
|
||||||
break;
|
|
||||||
case 'batchDelete':
|
|
||||||
doBatchDelete(checkStatus);
|
|
||||||
break;
|
|
||||||
case 'selectExportExcel':
|
case 'selectExportExcel':
|
||||||
doSelectExportExcel(checkStatus);
|
doSelectExportExcel(checkStatus);
|
||||||
break;
|
break;
|
||||||
@@ -229,139 +207,26 @@
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
//监听工具条
|
//监听工具条
|
||||||
table.on('tool(LAY-app-CoreCmsServices-tableBox)',
|
table.on('tool(LAY-app-CoreCmsUserServicesOrder-tableBox)',
|
||||||
function (obj) {
|
function (obj) {
|
||||||
if (obj.event === 'detail') {
|
if (obj.event === 'detail') {
|
||||||
doDetails(obj);
|
doDetails(obj);
|
||||||
} else if (obj.event === 'del') {
|
} else if (obj.event === 'cancellation') {
|
||||||
doDelete(obj);
|
doCancellation(obj);
|
||||||
} else if (obj.event === 'edit') {
|
|
||||||
doEdit(obj)
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//执行创建操作
|
|
||||||
function doCreate() {
|
|
||||||
coreHelper.Post("Api/CoreCmsServices/GetCreate", null, function (e) {
|
|
||||||
if (e.code === 0) {
|
|
||||||
admin.popup({
|
|
||||||
shadeClose: false,
|
|
||||||
title: '创建数据',
|
|
||||||
area: ['1200px', '90%'],
|
|
||||||
id: 'LAY-popup-CoreCmsServices-create',
|
|
||||||
success: function (layero, index) {
|
|
||||||
view(this.id).render('good/servicegoods/create', { data: e.data }).done(function () {
|
|
||||||
//监听提交
|
|
||||||
form.on('submit(LAY-app-CoreCmsServices-createForm-submit)',
|
|
||||||
function (data) {
|
|
||||||
var field = data.field; //获取提交的字段
|
|
||||||
|
|
||||||
field.contentBody = window.editor.getData();
|
|
||||||
if (!!!field.contentBody) {
|
|
||||||
layer.msg('文章详情内容不能为空', { icon: 5 });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (field.validityType == 2) {
|
|
||||||
if (!field.validityStartTime || !field.validityStartTime) {
|
|
||||||
layer.msg('请设置【核销有效时段】', { icon: 5 });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug) { console.log(field); } //开启调试返回数据
|
|
||||||
//提交 Ajax 成功后,关闭当前弹层并重载表格
|
|
||||||
coreHelper.Post("Api/CoreCmsServices/DoCreate", field, function (e) {
|
|
||||||
console.log(e)
|
|
||||||
if (e.code === 0) {
|
|
||||||
layui.table.reloadData('LAY-app-CoreCmsServices-tableBox'); //重载表格
|
|
||||||
layer.close(index); //再执行关闭
|
|
||||||
layer.msg(e.msg);
|
|
||||||
} else {
|
|
||||||
layer.msg(e.msg);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
// 禁止弹窗出现滚动条
|
|
||||||
//$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
|
||||||
}
|
|
||||||
, btn: ['确定', '取消']
|
|
||||||
, yes: function (index, layero) {
|
|
||||||
layero.contents().find("#LAY-app-CoreCmsServices-createForm-submit").click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
layer.msg(e.msg);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//执行编辑操作
|
|
||||||
function doEdit(obj) {
|
|
||||||
coreHelper.Post("Api/CoreCmsServices/GetEdit", { id: obj.data.id }, function (e) {
|
|
||||||
if (e.code === 0) {
|
|
||||||
admin.popup({
|
|
||||||
shadeClose: false,
|
|
||||||
title: '编辑数据',
|
|
||||||
area: ['1200px', '90%'],
|
|
||||||
id: 'LAY-popup-CoreCmsServices-edit',
|
|
||||||
success: function (layero, index) {
|
|
||||||
view(this.id).render('good/servicegoods/edit', { data: e.data }).done(function () {
|
|
||||||
//监听提交
|
|
||||||
form.on('submit(LAY-app-CoreCmsServices-editForm-submit)',
|
|
||||||
function (data) {
|
|
||||||
var field = data.field; //获取提交的字段
|
|
||||||
|
|
||||||
field.contentBody = window.editor.getData();
|
|
||||||
if (!!!field.contentBody) {
|
|
||||||
layer.msg('文章详情内容不能为空', { icon: 5 });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (field.validityType == 2) {
|
|
||||||
if (!field.validityStartTime || !field.validityStartTime) {
|
|
||||||
layer.msg('请设置【核销有效时段】', { icon: 5 });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug) { console.log(field); } //开启调试返回数据
|
|
||||||
//提交 Ajax 成功后,关闭当前弹层并重载表格
|
|
||||||
coreHelper.Post("Api/CoreCmsServices/DoEdit", field, function (e) {
|
|
||||||
console.log(e)
|
|
||||||
if (e.code === 0) {
|
|
||||||
layui.table.reloadData('LAY-app-CoreCmsServices-tableBox'); //重载表格
|
|
||||||
layer.close(index); //再执行关闭
|
|
||||||
layer.msg(e.msg);
|
|
||||||
} else {
|
|
||||||
layer.msg(e.msg);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
})
|
|
||||||
// 禁止弹窗出现滚动条
|
|
||||||
//$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
|
||||||
}
|
|
||||||
, btn: ['确定', '取消']
|
|
||||||
, yes: function (index, layero) {
|
|
||||||
layero.contents().find("#LAY-app-CoreCmsServices-editForm-submit").click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
layer.msg(e.msg);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//执行预览操作
|
//执行预览操作
|
||||||
function doDetails(obj) {
|
function doDetails(obj) {
|
||||||
coreHelper.Post("Api/CoreCmsServices/GetDetails", { id: obj.data.id }, function (e) {
|
coreHelper.Post("Api/CoreCmsUserServicesOrder/GetDetails", { id: obj.data.id }, function (e) {
|
||||||
if (e.code === 0) {
|
if (e.code === 0) {
|
||||||
admin.popup({
|
admin.popup({
|
||||||
shadeClose: false,
|
shadeClose: false,
|
||||||
title: '查看详情',
|
title: '查看详情',
|
||||||
area: ['1200px', '90%'],
|
area: ['1200px', '90%'],
|
||||||
id: 'LAY-popup-CoreCmsServices-details',
|
id: 'LAY-popup-CoreCmsUserServicesOrder-details',
|
||||||
success: function (layero, index) {
|
success: function (layero, index) {
|
||||||
view(this.id).render('good/servicegoods/details', { data: e.data }).done(function () {
|
view(this.id).render('order/servicesOrder/details', { data: e.data }).done(function () {
|
||||||
form.render();
|
form.render();
|
||||||
});
|
});
|
||||||
// 禁止弹窗出现滚动条
|
// 禁止弹窗出现滚动条
|
||||||
@@ -373,40 +238,20 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//执行单个删除
|
//执行作废订单
|
||||||
function doDelete(obj) {
|
function doCancellation(obj) {
|
||||||
coreHelper.Post("Api/CoreCmsServices/DoDelete", { id: obj.data.id }, function (e) {
|
coreHelper.Post("Api/CoreCmsUserServicesOrder/DoCancellation", { id: obj.data.id }, function (e) {
|
||||||
if (debug) { console.log(e); } //开启调试返回数据
|
if (debug) { console.log(e); } //开启调试返回数据
|
||||||
table.reloadData('LAY-app-CoreCmsServices-tableBox');
|
table.reloadData('LAY-app-CoreCmsUserServicesOrder-tableBox');
|
||||||
layer.msg(e.msg);
|
layer.msg(e.msg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//执行批量删除
|
|
||||||
function doBatchDelete(checkStatus) {
|
|
||||||
var checkData = checkStatus.data;
|
|
||||||
if (checkData.length === 0) {
|
|
||||||
return layer.msg('请选择要删除的数据');
|
|
||||||
}
|
|
||||||
layer.confirm('确定删除吗?删除后将无法恢复。',
|
|
||||||
function (index) {
|
|
||||||
var delidsStr = [];
|
|
||||||
layui.each(checkData,
|
|
||||||
function (index, item) {
|
|
||||||
delidsStr.push(item.id);
|
|
||||||
});
|
|
||||||
coreHelper.Post("Api/CoreCmsServices/DoBatchDelete", { id: delidsStr }, function (e) {
|
|
||||||
if (debug) { console.log(e); } //开启调试返回数据
|
|
||||||
table.reloadData('LAY-app-CoreCmsServices-tableBox');
|
|
||||||
layer.msg(e.msg);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//执行查询条件导出excel
|
//执行查询条件导出excel
|
||||||
function doQueryExportexcel() {
|
function doQueryExportexcel() {
|
||||||
layer.confirm('确定根据当前的查询条件导出数据吗?',
|
layer.confirm('确定根据当前的查询条件导出数据吗?',
|
||||||
function (index) {
|
function (index) {
|
||||||
var field = searchwhere;
|
var field = searchwhere;
|
||||||
coreHelper.PostForm("Api/CoreCmsServices/QueryExportExcel", field, function (e) {
|
coreHelper.PostForm("Api/CoreCmsUserServicesOrder/QueryExportExcel", field, function (e) {
|
||||||
if (debug) { console.log(e); } //开启调试返回数据
|
if (debug) { console.log(e); } //开启调试返回数据
|
||||||
if (e.code === 0) {
|
if (e.code === 0) {
|
||||||
window.open(e.data);
|
window.open(e.data);
|
||||||
@@ -430,7 +275,7 @@
|
|||||||
delidsStr.push(item.id);
|
delidsStr.push(item.id);
|
||||||
});
|
});
|
||||||
layer.close(index);
|
layer.close(index);
|
||||||
coreHelper.Post("Api/CoreCmsServices/SelectExportExcel", { id: delidsStr }, function (e) {
|
coreHelper.Post("Api/CoreCmsUserServicesOrder/SelectExportExcel", { id: delidsStr }, function (e) {
|
||||||
if (debug) { console.log(e); } //开启调试返回数据
|
if (debug) { console.log(e); } //开启调试返回数据
|
||||||
if (e.code === 0) {
|
if (e.code === 0) {
|
||||||
window.open(e.data);
|
window.open(e.data);
|
||||||
@@ -440,27 +285,34 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
laydate.render({
|
||||||
|
elem: '#searchTime-CoreCmsUserServicesOrder-payTime',
|
||||||
|
type: 'datetime',
|
||||||
|
range: '到',
|
||||||
|
});
|
||||||
|
laydate.render({
|
||||||
|
elem: '#searchTime-CoreCmsUserServicesOrder-createTime',
|
||||||
|
type: 'datetime',
|
||||||
|
range: '到',
|
||||||
|
});
|
||||||
|
laydate.render({
|
||||||
|
elem: '#searchTime-CoreCmsUserServicesOrder-servicesEndTime',
|
||||||
|
type: 'datetime',
|
||||||
|
range: '到',
|
||||||
|
});
|
||||||
|
|
||||||
//监听 表格复选框操作
|
//监听 表格复选框操作
|
||||||
laydate.render({
|
|
||||||
elem: '#searchTime-CoreCmsServices-startTime',
|
//重载form
|
||||||
type: 'datetime',
|
form.render();
|
||||||
range: '到',
|
|
||||||
});
|
|
||||||
laydate.render({
|
|
||||||
elem: '#searchTime-CoreCmsServices-endTime',
|
|
||||||
type: 'datetime',
|
|
||||||
range: '到',
|
|
||||||
});
|
|
||||||
laydate.render({
|
|
||||||
elem: '#searchTime-CoreCmsServices-validityStartTime',
|
|
||||||
type: 'datetime',
|
|
||||||
range: '到',
|
|
||||||
});
|
|
||||||
laydate.render({
|
|
||||||
elem: '#searchTime-CoreCmsServices-validityEndTime',
|
|
||||||
type: 'datetime',
|
|
||||||
range: '到',
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<!--设置是否支付-->
|
||||||
|
<script type="text/html" id="switch_isPay">
|
||||||
|
<input type="checkbox" name="switch_isPay" value="{{d.id}}" lay-skin="switch" lay-text="已支付|未支付" disabled="disabled" lay-filter="switch_isPay" {{ d.isPay ? 'checked' : '' }}>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace CoreCms.Net.Web.WebApi
|
|||||||
//确保NLog.config中连接字符串与appsettings.json中同步
|
//确保NLog.config中连接字符串与appsettings.json中同步
|
||||||
NLogUtil.EnsureNlogConfig("NLog.config");
|
NLogUtil.EnsureNlogConfig("NLog.config");
|
||||||
//其他项目启动时需要做的事情
|
//其他项目启动时需要做的事情
|
||||||
NLogUtil.WriteAll(LogLevel.Trace, LogType.Web, "接口启动", "接口启动成功");
|
NLogUtil.WriteAll(LogLevel.Trace, LogType.ApiRequest, "接口启动", "接口启动成功");
|
||||||
|
|
||||||
host.Run();
|
host.Run();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user