Commit 8dc00125 by wwh

update

1 parent 0a44b9a6
<template>
<picker mode="multiSelector" bindchange="bindMultiPickerChange" bindcolumnchange="bindMultiPickerColumnChange" value="{{multiIndex}}" range="{{multiArray}}">
<view class="form-line">
<view class="label-line">{{labelTxt}}</view>
<view class="info">
<view class="money">{{time}}</view>
<image src="../../images/right.png" class="right"/>
</view>
</view>
</picker>
</template>
<script>
import wepy from 'wepy'
export default class TimePicker extends wepy.component {
props = {
time: {
type: String,
default: ''
},
labelTxt:{
type: String,
default: ''
}
}
data = {
years: [],
months: [],
days: [],
hours: [],
minutes: [],
multiArray: [], // 选择范围
multiIndex: [0, 0, 0, 0, 0], // 选中值数组
choose_year: '',
yearIndex: 0
}
// 设置初始值
setTimeDate() {
const date = new Date()
let _yearIndex = 0
// 默认设置
// console.info(this.time)
let _defaultYear = this.time ? this.time.split('-')[0] : 0
// 获取年
for (let i = date.getFullYear(); i <= date.getFullYear() + 5; i++) {
this.years.push('' + i)
// 默认设置的年的位置
if (_defaultYear && i === parseInt(_defaultYear)) {
this.yearIndex = _yearIndex
this.choose_year = _defaultYear
}
_yearIndex = _yearIndex + 1
}
// 获取月份
for (let i = 1; i <= 12; i++) {
if (i < 10) {
i = '0' + i
}
this.months.push('' + i)
}
// 获取日期
for (let i = 1; i <= 31; i++) {
if (i < 10) {
i = '0' + i
}
this.days.push('' + i)
}
// 获取小时
for (let i = 0; i < 24; i++) {
if (i < 10) {
i = '0' + i
}
this.hours.push('' + i)
}
// 获取分钟
for (let i = 0; i < 60; i++) {
if (i < 10) {
i = '0' + i
}
this.minutes.push('' + i)
}
}
// 返回月份的天数
setDays(selectYear, selectMonth) {
let num = selectMonth
let temp = []
if (num === 1 || num === 3 || num === 5 || num === 7 || num === 8 || num === 10 || num === 12) {
// 判断31天的月份
for (let i = 1; i <= 31; i++) {
if (i < 10) {
i = '0' + i
}
temp.push('' + i)
}
} else if (num === 4 || num === 6 || num === 9 || num === 11) { // 判断30天的月份
for (let i = 1; i <= 30; i++) {
if (i < 10) {
i = '0' + i
}
temp.push('' + i)
}
} else if (num === 2) { // 判断2月份天数
let year = parseInt(selectYear)
console.log(year)
if (((year % 400 === 0) || (year % 100 !== 0)) && (year % 4 === 0)) {
for (let i = 1; i <= 29; i++) {
if (i < 10) {
i = '0' + i
}
temp.push('' + i)
}
} else {
for (let i = 1; i <= 28; i++) {
if (i < 10) {
i = '0' + i
}
temp.push('' + i)
}
}
}
return temp
}
// 设置默认值 格式2019-07-10 10:30
setDefaultTime() {
let allDateList = this.time.split(' ')
// 日期
let dateList = allDateList[0].split('-')
let month = parseInt(dateList[1]) - 1
let day = parseInt(dateList[2]) - 1
// 时间
let timeList = allDateList[1].split(':')
this.multiArray[2] = this.setDays(dateList[0], parseInt(dateList[1]))
this.multiIndex = [this.yearIndex, month, day, timeList[0], timeList[1]]
}
methods = {
// 监听picker的滚动事件
bindMultiPickerColumnChange(e) {
// 获取年份
if (e.detail.column === 0) {
this.choose_year = this.multiArray[e.detail.column][e.detail.value]
console.log(this.choose_year)
}
// console.log('修改的列为', e.detail.column, ',值为', e.detail.value);
// 设置月份数组
if (e.detail.column === 1) {
let num = parseInt(this.multiArray[e.detail.column][e.detail.value])
this.multiArray[2] = this.setDays(this.choose_year, num)
}
this.multiIndex[e.detail.column] = e.detail.value
this.$apply()
},
// 获取时间日期
bindMultiPickerChange(e) {
// console.log('picker发送选择改变,携带值为', e.detail.value)
this.multiIndex = e.detail.value
const index = this.multiIndex
const year = this.multiArray[0][index[0]]
const month = this.multiArray[1][index[1]]
const day = this.multiArray[2][index[2]]
const hour = this.multiArray[3][index[3]]
const minute = this.multiArray[4][index[4]]
// console.log(`${year}-${month}-${day}-${hour}-${minute}`);
this.time = year + '-' + month + '-' + day + ' ' + hour + ':' + minute
this.$emit('getDateTime',this.time)
this.$apply()
}
}
onLoad () {
this.setTimeDate()
this.multiArray = [this.years, this.months, this.days, this.hours, this.minutes]
this.choose_year = this.multiArray[0][0]
if (!this.time) {
// 默认显示当前日期
let date = new Date()
let currentMonth = date.getMonth()
let currentDay = date.getDate() - 1
// console.info('月', date.getMonth())
// console.info('日', date.getDate())
let currentHours = date.getHours()
let currentMinutes = date.getMinutes()
this.multiArray[2] = this.setDays(this.choose_year, currentMonth + 1)
this.multiIndex = [0, currentMonth, currentDay, currentHours, currentMinutes]
} else {
this.setDefaultTime()
}
this.$apply()
}
}
</script>
<style lang="scss">
.time-picker{
width: 240rpx;
}
.form-line {
height: 100rpx;
border-bottom: 1rpx #E8E8E8 solid;
padding: 0 24rpx;
display: flex;
align-items: center;
justify-content: space-between;
.label-line {
font-size: 28rpx;
color: #333333;
}
.info {
display: flex;
align-items: center;
justify-content: flex-end;
.money {
font-size: 28rpx;
color: #333333;
}
.right {
width: 26rpx;
height: 26rpx;
margin-left: 24rpx;
}
}
}
</style>
......@@ -15,16 +15,6 @@
<view class="circle">
<view class="circle-item" wx:for="{{circle}}" wx:for-index="index1" wx:for-item="item1" wx:key="index1" ></view>
</view>
<!--<view class="top" wx:if="{{item.coupon_discount_way.is_type == 1 && item.coupon_limit_use.is_type== 2 }}"><text>减免</text>{{item.coupon_discount_way.money / 100}}</view>-->
<!--<view class="top" wx:elif="{{item.coupon_discount_way.is_type == 2 && item.coupon_limit_use.is_type== 2 }}"><text>折扣</text>{{item.coupon_discount_way.money}}</view>-->
<!--<view class="top" wx:elif="{{item.coupon_discount_way.is_type== 1 && item.coupon_limit_use.is_type== 1 }}"><text>减免</text>{{item.coupon_discount_way.money / 100}}</view>-->
<!--<view class="top" wx:elif="{{item.coupon_discount_way.is_type== 2 && item.coupon_limit_use.is_type== 1}}"><text>折扣</text>{{item.coupon_discount_way.money}}</view>-->
<!--<view class="bottom" wx:if="{{item.coupon_discount_way.is_type== 1 && item.coupon_limit_use.is_type== 2 }}">满{{item.coupon_limit_use.money / 100}}元可用</view>-->
<!--<view class="bottom" wx:if="{{item.coupon_discount_way.is_type== 2 && item.coupon_limit_use.is_type== 2 }}">订单满{{item.coupon_limit_use.money / 100}}元可用</view>-->
<!--<view class="bottom" wx:if="{{item.coupon_discount_way.is_type== 1 && item.coupon_limit_use.is_type== 1 }}">不限制</view>-->
<!--<view class="bottom" wx:if="{{item.coupon_discount_way.is_type== 2 && item.coupon_limit_use.is_type== 1 }}">不限制</view>-->
<view class="top" wx:if="{{item.coupon_discount_way.is_type == 1}}"><text>减免</text>{{item.coupon_discount_way.money / 100}}</view>
<view class="top" wx:elif="{{item.coupon_discount_way.is_type == 2}}"><text>折扣</text>{{item.coupon_discount_way.money}}</view>
<view class="top" wx:elif="{{item.coupon_discount_way.is_type == 3}}"><text>包邮</text></view>
......
......@@ -7,49 +7,61 @@
<view class="form-line">
<view class="label-line">优惠券名称</view>
<input type="text" placeholder="请输入优惠券名称" value="{{form.name}}" class="input" @input="getName">
<input type="text" placeholder="请输入优惠券名称" value="{{form.name}}" class="input" @input="getName" />
</view>
<view class="form-line" @tap="checkDiscountType">
<view class="label-line">优惠方式</view>
<view class="info">
<view class="money">{{discountShow}}</view>
<image src="../images/right.png" class="right"></image>
<image src="../images/right.png" class="right" />
</view>
</view>
<view class="form-line">
<view class="label-line">发放数量</view>
<input type="text" placeholder="请输入张数" class="input" @input="getNumber" value="{{form.quantity}}">
<input type="text" placeholder="请输入张数" class="input" @input="getNumber" value="{{form.quantity}}" />
</view>
<view class="form-line">
<view class="label-line">初始领取</view>
<input type="text" placeholder="请输入张数" class="input" @input="getInitNumber" value="{{form.origin_receive_num}}">
<input type="text" placeholder="请输入张数" class="input" @input="getInitNumber" value="{{form.origin_receive_num}}" />
</view>
<view class="form-line" style="border-bottom: none">
<view class="label-line">优惠券详情</view>
</view>
<textarea class="textarea" value="" placeholder="请输入优惠券详情" maxlength="200" @input="getDetail"/>
<textarea class="textarea" value="{{htmlDetail}}" placeholder="请输入优惠券详情" maxlength="200" @input="getDetail"/>
<view class="headline">
<view class="line"></view>
<view class="head">领取限制</view>
</view>
<view class="form-line" @tap="customerType">
<!-- <view class="form-line" @tap="customerType">
<view class="label-line">用户类别</view>
<view class="info">
<view class="money">{{customerTypeShow}}</view>
<image src="../images/right.png" class="right"></image>
<image src="../images/right.png" class="right"/>
</view>
</view>
</view> -->
<view class="form-line" @tap="getLingQuNumber">
<view class="label-line">领取次数</view>
<view class="info">
<view class="money">{{getNumberShow}}</view>
<image src="../images/right.png" class="right"></image>
<image src="../images/right.png" class="right"/>
</view>
</view>
<view class="headline">
<view class="line"></view>
<view class="head">领取时间</view>
</view>
<SdateTimePicker labelTxt='开始时间' :time.sync='receive_start_time' @getDateTime.user='getReceiveStart'>
</SdateTimePicker>
<EdateTimePicker labelTxt='结束时间' :time.sync='receive_end_time' @getDateTime.user='getReceiveEnd'>
</EdateTimePicker>
<view class="headline">
<view class="line"></view>
<view class="head">使用限制</view>
......@@ -58,36 +70,25 @@
<view class="label-line">订单金额</view>
<view class="info">
<view class="money">{{orderMoneySHow}}</view>
<image src="../images/right.png" class="right"></image>
<image src="../images/right.png" class="right"/>
</view>
</view>
<view class="headline">
<view class="line"></view>
<view class="head">使用时间</view>
</view>
<picker style="width: 100%" mode="date" @change="bindStartDateChange">
<view class="form-line">
<view class="label-line">开始时间</view>
<view class="info">
<view class="money">{{start_time}}</view>
<image src="../images/right.png" class="right"></image>
</view>
</view>
</picker>
<picker style="width: 100%" mode="date" @change="bindEndDateChange">
<view class="form-line">
<view class="label-line">结束时间</view>
<view class="info">
<view class="money">{{end_time}}</view>
<image src="../images/right.png" class="right"></image>
</view>
</view>
</picker>
<view class="form-line">
<UseSdateTimePicker labelTxt='开始时间' :time.sync='start_time' @getDateTime.user='getUseStart'>
</UseSdateTimePicker>
<UseEdateTimePicker labelTxt='结束时间' :time.sync='end_time' @getDateTime.user='getUseEnd'>
</UseEdateTimePicker>
<!-- <view class="form-line">
<view class="label-line">领券后</view>
<input type="text" placeholder="领券时间起多少天内可用" class="input" @input="getDayNumber" value="{{form.dayNumber}}">
</view>
<view class="form-line">
<input type="text" placeholder="领券时间起多少天内可用" class="input" @input="getDayNumber" value="{{form.dayNumber}}"/>
</view> -->
<!-- <view class="form-line">
<view class="label-line">商品限制</view>
<view class="input">{{product_limit_type == '1' ? '全品类可用(指定商品请移步电脑端)':'商品编辑请移步电脑端'}}</view>
</view>
......@@ -99,7 +100,7 @@
<view class="check-item {{onLine ? 'checked':'no-check'}}" @tap="checkType('onLine')">线上商城</view>
<view class="check-item {{buySelf ? 'checked':'no-check'}}" @tap="checkType('buySelf')">自助买单</view>
<view class="check-item {{goShop ? 'checked':'no-check'}}" @tap="checkType('goShop')">到店使用</view>
</view>
</view> -->
<view class="button">
<view class="item cancel">取消</view>
......@@ -114,6 +115,7 @@
import coupon from '../../api/couponNew';
import Event from '../../utils/Event';
import Tips from '../../utils/Tips'
import DateTimePicker from '../../components/coupon/dateTimePicker'
export default class CouponIndex extends wepy.page {
def = {
......@@ -129,16 +131,18 @@
},
coupon_discount_way: {}, //优惠方式
coupon_limit_use: {}, //使用限制
start_time: '',
end_time: '',
receive_user_type: '',
receive_start_time:'', //领取起始时间
receive_end_time:'', //领取结束时间
start_time: '', //使用起始时间
end_time: '', //使用结束时间
receive_user_type: '0',
coupon_receive_times: {},
discountShow: '',
customerTypeShow: '',
getNumberShow: '',
orderMoneySHow: '',
htmlDetail: '',
product_limit_type: 1//1全品类可用 2指定商品可用 3指定商品不可用
product_limit_type: 1,//1全品类可用 2指定商品可用 3指定商品不可用
};
data = {...this.def};
......@@ -187,7 +191,10 @@
} else {
this.customerTypeShow = '付费用户';
}
this.htmlDetail = res.data.detail;
this.receive_start_time = res.data.receive_start_time;
this.receive_end_time = res.data.receive_end_time;
this.start_time = res.data.start_time;
this.end_time = res.data.end_time;
......@@ -287,22 +294,30 @@
Tips.toast('请填写初始领取量',null,'none');
return;
}
if(!this.receive_start_time) {
Tips.toast('请选择领取开始时间',null,'none');
return;
}
if(!this.receive_end_time) {
Tips.toast('请选择领取结束时间',null,'none');
return;
}
if(!this.start_time) {
Tips.toast('请选择开始时间',null,'none');
Tips.toast('请选择使用开始时间',null,'none');
return;
}
if(!this.end_time) {
Tips.toast('请选择结束时间',null,'none');
Tips.toast('请选择使用结束时间',null,'none');
return;
}
if(!this.coupon_limit_use.is_type) {
Tips.toast('请选择使用限制',null,'none');
return;
}
if(!this.receive_user_type) {
Tips.toast('请选择用户类型',null,'none');
return;
}
// if(!this.receive_user_type) {
// Tips.toast('请选择用户类型',null,'none');
// return;
// }
if(!this.coupon_receive_times.is_type) {
Tips.toast('请选择领取限制',null,'none');
return;
......@@ -317,6 +332,9 @@
product_limit: [],//商品信息
//优惠方式
coupon_discount_way: this.coupon_discount_way,
//领取时间
receive_start_time: this.receive_start_time,//起始时间
receive_end_time: this.receive_end_time,//结束时间
//使用限制
coupon_limit_use: this.coupon_limit_use,
//使用时间
......@@ -325,7 +343,8 @@
//用户类型
receive_user_type: this.receive_user_type,
// receive_user_type: this.receive_user_type,
receive_user_type: 0, //用户类别 默认全部
//用户领取限制
coupon_receive_times: this.coupon_receive_times,
is_line: this.onLine ? 1 : 0,//线上商城
......@@ -405,8 +424,31 @@
wx.navigateTo({
url: './userImpose'
})
},
getReceiveStart(time){
// console.log('领取开始时间',time)
this.receive_start_time = time
},
getReceiveEnd(time){
// console.log('领取结束时间',time)
this.receive_end_time = time
},
getUseStart(time){
// console.log('使用开始时间',time)
this.start_time = time
},
getUseEnd(time){
// console.log('使用结束时间',time)
this.end_time = time
}
};
components = {
SdateTimePicker:DateTimePicker,
EdateTimePicker:DateTimePicker,
UseSdateTimePicker:DateTimePicker,
UseEdateTimePicker:DateTimePicker
};
config = {
navigationBarTitleText: '新建优惠券',
enablePullDownRefresh: true
......
......@@ -291,20 +291,6 @@
tap: 'scan',
auth: false
},
// {
// name : '客户管理',
// img: 'http://static.ledouya.com/Fri_t8HvQvgLX3LVMxSndrvUo9rq',
// url : '/customerModule/pages/index',
// tap: '',
// auth: false
// },
// {
// name : '优惠券',
// img: 'http://static.ledouya.com/FpYGmWD1FnQuMep0mnvqugsinbCL',
// url : '../../couponModule/pages/index',
// tap: '',
// auth: false
// },
{
name : '订单管理',
img: 'http://static.ledouya.com/FjReFSSw0qXd_PPSA5TfPB5svtLo',
......@@ -312,20 +298,13 @@
tap: "order",
auth: false
},
// {
// name : '财务管理',
// img: 'http://static.ledouya.com/Fn1UW8kmP5-czVPZhAiOdpjOj6FM',
// url : '../../financeModule/pages/index',
// tap: "",
// auth: false
// },
// {
// name : '帮助中心',
// img: 'http://static.ledouya.com/Fs_1qNyrhU7csc-3XZV0hs4uxrb_',
// url : '',
// tap: 'helpCenter',
// auth: false
// }
{
name : '优惠券',
img: 'http://static.ledouya.com/FpYGmWD1FnQuMep0mnvqugsinbCL',
url : '../../couponModule/pages/index',
tap: '',
auth: false
},
],
shopInfo:{},
expirationTime:'',
......@@ -349,7 +328,7 @@
this.func[1].auth = false;
this.func[2].auth = false;
this.func[3].auth = false;
// this.func[4].auth = false;
this.func[4].auth = false;
// this.func[5].auth = false;
console.log(this.roles,'roleListroleList---');
for(let i=0;i<this.roleList.length;i++){
......@@ -360,7 +339,7 @@
this.func[1].auth = true;
this.func[2].auth = true;
this.func[3].auth = true;
// this.func[4].auth = true;
this.func[4].auth = true;
// this.func[5].auth = true;
this.$apply();
}
......
......@@ -16,7 +16,7 @@
</view>
<view class='goods-numBox'>
<text class='goods-price'>¥{{item.price_current/100}}</text>
<view class="goods-btn {{item.is_insert == '1'?'btn_defalut':''}}" data-index='{{item.is_insert}}' data-goods="{{item}}" @tap.stop='upDownShelf'>{{item.is_insert == '0'?'上架到网店':'已上架到网店'}}</view>
<view class="goods-btn {{item.is_insert == '1'?'btn_defalut':''}}" data-index='{{item.is_insert}}' data-goods="{{item}}" @tap.stop='upDownShelf'>{{item.is_insert == '0'?'上架到网店':'已上架'}}</view>
</view>
</view>
</view>
......@@ -128,13 +128,14 @@ export default class supplyIndex extends wepy.page {
<style lang="scss">
@import "../../styles/variable";
page{
padding-top: 90rpx;
padding-top: 115rpx;
}
.supply-contanier{
height:100%;
.scroll-box{
width:100%;
height:90rpx;
// height:90rpx;
height:115rpx;
white-space: nowrap;
position: fixed;
top:0;
......@@ -144,32 +145,42 @@ export default class supplyIndex extends wepy.page {
background: #fff;
.nav-header{
width:100%;
height:90rpx;
// height:90rpx;
height:66rpx;
margin-top:25rpx;
.nav_h_item{
display: inline-block;
font-size:32rpx;
font-weight:400;
color:rgba(51,51,51,1);
margin-right:85rpx;
position: relative;
height:90rpx;
line-height: 90rpx;
display:inline-block;
padding:8rpx 20rpx;
background:rgba(242,242,243,1);
border-radius:30rpx;
margin-right: 20rpx;
line-height: 50rpx;
// margin-right:85rpx;
// position: relative;
// height:90rpx;
// line-height: 90rpx;
// display:inline-block;
&:first-child{
margin-left:60rpx;
margin-left:24rpx;
}
}
.nav_h_item.nav_active{
&:after{
content:'';
position: absolute;
bottom:0;
left:50%;
margin-left:-25px;
width:100rpx;
height:8rpx;
background:rgba(5,133,255,1);
border-radius:4rpx;
}
background:rgba(26,151,219,1);
color:#fff;
// &:after{
// content:'';
// position: absolute;
// bottom:0;
// left:50%;
// margin-left:-25px;
// width:100rpx;
// height:8rpx;
// background:rgba(5,133,255,1);
// border-radius:4rpx;
// }
}
}
}
......@@ -219,21 +230,19 @@ export default class supplyIndex extends wepy.page {
line-height:42rpx;
}
.goods-btn{
// width:140rpx;
padding:0rpx 10rpx;
height:58rpx;
width:150rpx;
height:56rpx;
background:#1296db;
border-radius:8rpx;
font-size:26rpx;
font-family:PingFangSC-Regular,PingFang SC;
font-weight:400;
color:rgba(255,255,255,1);
line-height:58rpx;
line-height:56rpx;
text-align: center;
}
.btn_defalut{
background: #aaa;
padding:0rpx 10rpx;
}
}
}
......
......@@ -28,7 +28,7 @@
<view class="btn-groups">
<view class="btn-back" @tap='back'>供销主页</view>
<view class="btn-upGoods" @tap='shelfGoods' wx:if="{{goodsInfo.is_insert == '0'}}">上架到网店</view>
<view class="btn-upGoods is_insert" wx:elif="{{goodsInfo.is_insert == '1'}}">已上架到网店</view>
<view class="btn-upGoods is_insert" wx:elif="{{goodsInfo.is_insert == '1'}}">已上架</view>
</view>
</view>
</template>
......
......@@ -14,10 +14,25 @@ export default class http {
const res = await wepy.request(param);
if(this.isSuccess(res)) {
if(res.data.error == -1) {
Tips.modal(res.data.error_reason,'温馨提示');
return ;
}
if(res.data.error == -1) {
// Tips.modal(res.data.error_reason,'温馨提示');
wx.showModal({
title: '温馨提示',
content: res.data.error_reason,
showCancel: false,
success: res => {
wepy.reLaunch({
url: '/pages/home/index'
})
},
fail: res => {
wepy.reLaunch({
url: '/pages/home/index'
})
}
})
return ;
}
if (res.data.error == 10001 || res.data.error == 10002 || res.data.error == 10003 || res.data.error == 10004 || res.data.error == 11020) {
setTimeout(() => {
wepy.reLaunch({
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!