From 7f1c261af1b485948b60517a0d840c099f565b64 Mon Sep 17 00:00:00 2001 From: iceling Date: Thu, 16 Jan 2020 16:46:18 +0800 Subject: [PATCH] 各种有礼的代码修改 --- pages/giftpack/birthdaygift/birthdaygift.js | 49 ++++++++++++++++++++----------------------------- pages/giftpack/birthdaygift/birthdaygift.wxml | 13 ++++++++++--- pages/giftpack/evaluategift/evaluategift.js | 32 +++++++++++++++----------------- pages/giftpack/evaluategift/evaluategift.wxml | 26 +++++++++++++++++++------- pages/giftpack/festival/festival.js | 218 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ pages/giftpack/festival/festival.json | 7 +++++++ pages/giftpack/festival/festival.wxml | 171 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ pages/giftpack/festival/festival.wxss | 411 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ pages/user/assistance/giftpacklist.js | 2 +- pages/user/assistance/giftpacklist.wxml | 2 +- 10 files changed, 873 insertions(+), 58 deletions(-) create mode 100644 pages/giftpack/festival/festival.js create mode 100644 pages/giftpack/festival/festival.json create mode 100644 pages/giftpack/festival/festival.wxml create mode 100644 pages/giftpack/festival/festival.wxss diff --git a/pages/giftpack/birthdaygift/birthdaygift.js b/pages/giftpack/birthdaygift/birthdaygift.js index c789f95..206af80 100644 --- a/pages/giftpack/birthdaygift/birthdaygift.js +++ b/pages/giftpack/birthdaygift/birthdaygift.js @@ -19,7 +19,7 @@ Page({ getActId: '', getActType: '', giftID: '', - receiveState: '一键全部领取', + receiveState: 0, textTitle: '', getUrl: '', noShow: false, @@ -29,13 +29,11 @@ Page({ growUpTitle: "", is_sub: 0, //是否重复领取 }, - GetList: function () { + GetList: function() { var th = this; var url = "/api/weshop/marketing/giftbag/bound/get"; - wx.showLoading({ - title: '加载中', - }) getApp().request.promiseGet(url, { + isShowLoading: true, data: { "actId": th.data.getActId, //活动id "actType": 4, //活动类型 1新人礼 2评价有礼 3节日营销 4生日营销 @@ -44,7 +42,6 @@ Page({ "userId": d.user_id //用户ID } }).then(res => { - wx.hideLoading(); if (res.data.code == 0) { if (res.data.data.lbCoupons.length > 0 && res.data.data.lbCoupons != null) { //礼包内容--礼券 @@ -93,19 +90,18 @@ Page({ }) if (res.data.data.receiveState == 0) { th.setData({ - receiveState: '一键全部领取' + receiveState: 0 }) } else { th.setData({ - receiveState: '已领取' + receiveState: 1 }) } if (res.data.data.actIntro != '') { th.setData({ textShow: true, - textTitle: res.data.data.actIntro.replace(/\/g, '\div>') + textTitle: res.data.data.actIntro.replace(/\ - - {{receiveState}} - + + + 已领取 + + + + + 一键领取 + + diff --git a/pages/giftpack/evaluategift/evaluategift.js b/pages/giftpack/evaluategift/evaluategift.js index b41121c..2d6059d 100644 --- a/pages/giftpack/evaluategift/evaluategift.js +++ b/pages/giftpack/evaluategift/evaluategift.js @@ -19,7 +19,7 @@ Page({ getActId: '', getActType: '', giftBagId: '', - receiveState: '一键全部领取', + receiveState: 0, textTitle: '', getUrl: '', noShow: false, @@ -39,6 +39,7 @@ Page({ }) var url = "/api/weshop/marketing/giftbag/bound/get"; getApp().request.promiseGet(url, { + isShowLoading: true, data: { "actId": th.data.getActId, //活动Id "actType": 2, //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 @@ -50,7 +51,6 @@ Page({ "gifbagid": th.data.giftBagId } }).then(res => { - wx.hideLoading(); if (res.data.code == 0) { if (res.data.data.lbCoupons.length > 0 && res.data.data.lbCoupons != null) { //礼包内容--礼券 @@ -99,11 +99,11 @@ Page({ }) if (res.data.data.receiveState == 0) { th.setData({ - receiveState: '一键全部领取' + receiveState:0 }) } else { th.setData({ - receiveState: '已领取' + receiveState: 1 }) } @@ -132,8 +132,7 @@ Page({ if (orderType) { th.setData({ orderType: orderType}) } - - + th.GetList(); }, onShow: function() { @@ -145,7 +144,7 @@ Page({ }, GetReceive: function() { var th = this; - if (th.data.receiveState == '已领取') { + if (th.data.receiveState) { return false; } var is_sub = th.data.is_sub; //判断是否重复提交 @@ -166,27 +165,26 @@ Page({ }; var data = JSON.stringify(json); var url = th.data.url + "/api/weshop/marketing/free/receive/gift/record/insert"; - wx.request({ - url: url, - data: data, - method: 'post', - header: { - 'content-type': 'application/json' - }, // 设置请求的 header - success: function(res) { + getApp().request.json_post(url, json, + function (res) { th.setData({ is_sub: 0 }) if (res.data.code == 0) { th.setData({ - receiveState: '已领取' + receiveState: 1 }) getApp().my_warnning("领取成功", 1, th); } else { getApp().my_warnning(res.data.msg, 0, th); } + }, + function (res) { + } - }) + + ) + } }, //界面跳转 diff --git a/pages/giftpack/evaluategift/evaluategift.wxml b/pages/giftpack/evaluategift/evaluategift.wxml index 805a33c..68098bb 100644 --- a/pages/giftpack/evaluategift/evaluategift.wxml +++ b/pages/giftpack/evaluategift/evaluategift.wxml @@ -1,8 +1,8 @@ - - - - + + + + @@ -94,8 +94,13 @@ 分类限定 + + 包邮券 + + {{item.sum+"元券"}} {{"满"+item.buySum+"元可以用"}} + @@ -161,9 +166,16 @@ - - {{receiveState}} - + + + 已领取 + + + + + 一键领取 + + diff --git a/pages/giftpack/festival/festival.js b/pages/giftpack/festival/festival.js new file mode 100644 index 0000000..a6715f6 --- /dev/null +++ b/pages/giftpack/festival/festival.js @@ -0,0 +1,218 @@ +var i = require("../../../utils/util.js") +var e = getApp(), + a = e.globalData.setting, + os = a, + t = e.request, + d = e.globalData; +Page({ + data: { + url: a.url, //接口网址 + iurl: a.imghost, //图片前缀网址 + itemShow: false, //项目栏目是否显示 + cardShow: false, //代金券栏目是否显示 + packShow: false, //福利栏目是否显示 + textShow: false, //规则是否显示 + integralShow: true, //积分领取是否显示 + growUpShow: true, //成长值领取是否显示 + itemButton: '', + cardButton: '', + getActId: '', + getActType: '', + giftID: '', + receiveState: '一键全部领取', + textTitle: '', + getUrl: '', + noShow: false, + cards: [], //礼包内容--礼券 + itemWare: [], //礼包内容--服务项目 + integralTitle: "", + growUpTitle: "", + is_sub: 0, //是否重复领取 + bimg: "", //评价有礼背景图片 + actFontColor: "", //字体颜色 + actBgColor: "", //背景颜色 + }, + GetList: function() { + var th = this; + wx.showLoading({ + title: '加载中', + }) + var url = "/api/weshop/marketing/giftbag/bound/get"; + getApp().request.promiseGet(url, { + data: { + "actId": th.data.getActId, //活动id + "actType": 3, //活动类型 1新人礼 2评价有礼 3节日营销 4生日营销 + "giftBagId": th.data.giftID, //礼包ID + "storeId": a.stoid, //商家ID + "userId": d.user_id //用户ID + } + }).then(res => { + wx.hideLoading(); + if (res.data.code == 0) { + if (res.data.data.lbCoupons != null && res.data.data.lbCoupons.length > 0) { + //礼包内容--礼券 + th.setData({ + cardShow: true, + cards: res.data.data.lbCoupons + }) + } + if (res.data.data.lbSM != null && res.data.data.lbSM.length > 0) { + //礼包内容--服务项目 + th.setData({ + itemShow: true, + itemWare: res.data.data.lbSM + }) + } + //礼包积分 + if (res.data.data.lbIntegral <= 0) { + if (res.data.data.lbGrowthValue <= 0) { + th.setData({ + packShow: false + }) + } else { + th.setData({ + packShow: false, + integralShow: false, + growUpShow: true + }) + } + + } else { + if (res.data.data.lbGrowthValue > 0) { + th.setData({ + packShow: true + }) + } else { + th.setData({ + packShow: true, + integralShow: true, + growUpShow: false + }) + } + } + th.setData({ + integralTitle: '价值' + res.data.data.lbIntegral + '积分', + growUpTitle: '价值' + res.data.data.lbGrowthValue + '成长值' + }) + if (res.data.data.receiveState == 0) { + th.setData({ + receiveState: '一键全部领取' + }) + } else { + th.setData({ + receiveState: '已领取' + }) + } + + if (res.data.data.actIntro != '') { + th.setData({ + textShow: true, + textTitle: res.data.data.actIntro + }) + } + } else { + getApp().my_warnning(res.data.msg, 0, th); + return false; + } + }) + }, + + onLoad: function(options) { + var th = this; + th.setData({ + getActId: options.actId, + giftID: options.giftBagId + }) + th.is_festival(); + th.GetList(); + }, + onShow: function() { + var th = this; + var textTitle = th.data.textTitle.replace(/ { + if (res.data.code == 0) { + th.setData({ + bimg: res.data.data.actBoundImg, + actFontColor: res.data.data.actFontColor, //字体颜色 + actBgColor: res.data.data.actBgColor, //背景颜色 + + }) + } + }) + }, + //界面跳转 + goto: function(e) { + var url = e.currentTarget.dataset.url; + getApp().goto(url); + }, + //图片失败,默认图片 + bind_bnerr1: function(e) { + var th = this; + var _errImg = e.target.dataset.errorimg; + var _Img = e.target.dataset.img; + if (_Img != undefined) { + var _errObj = {}; + _errObj[_errImg] = "/miniapp/images/giftbag/gift02.png"; + th.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + } + }, +}); \ No newline at end of file diff --git a/pages/giftpack/festival/festival.json b/pages/giftpack/festival/festival.json new file mode 100644 index 0000000..3e38fd3 --- /dev/null +++ b/pages/giftpack/festival/festival.json @@ -0,0 +1,7 @@ +{ + "navigationBarTitleText": "节日有礼", + "usingComponents": { + "warn": "/components/long_warn/long_warn", + "my_confirm": "/components/my_confirm/my_confirm" + } +} \ No newline at end of file diff --git a/pages/giftpack/festival/festival.wxml b/pages/giftpack/festival/festival.wxml new file mode 100644 index 0000000..304a288 --- /dev/null +++ b/pages/giftpack/festival/festival.wxml @@ -0,0 +1,171 @@ + + + + + + + + + ______ + + + 新人专享\n你的美丽我来缔造 + + + ______ + + + + + + + + + + + + + + + + + + 免费领取 + + + {{item.fromName}} + + + + + {{item.fromName}} + + + {{"新人可免费享受专业"+item.fromName+",可以享受"+item.num+"次。"}} + + + 数量: + {{item.num}} + + + + + + + + + + + + + + + + + + + ——— + + + 新人专享优惠券 + + + ——— + + + + + + + + + 全场通用 + + + 品牌限定 + + + 品类限定 + + + 用途限定 + + + 分类限定 + + + {{item.sum+"元券"}} + {{"满"+item.buySum+"元可以用"}} + + + + + + + + + + + + + + + + + + ——— + + + 新人专享福利 + + + ——— + + + + + + + + + + + + + + + + + + + + + + + + + 活动规则: + + + + + + + + + + + + 本活动最终解释权归公司所有,如果有问题请联系客服 + + + + + + {{receiveState}} + + + + + + \ No newline at end of file diff --git a/pages/giftpack/festival/festival.wxss b/pages/giftpack/festival/festival.wxss new file mode 100644 index 0000000..8fe8975 --- /dev/null +++ b/pages/giftpack/festival/festival.wxss @@ -0,0 +1,411 @@ +@charset "UTF-8"; + +/* Author XGQ + * 2019-10-27 + */ + +.image_box { + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; +} + +.image_box image { + width: 100%; + height: 690rpx; +} + +.top { + margin: -20rpx 28rpx 45rpx 28rpx; + padding: 10rpx 10rpx 70rpx 10rpx; + background-color: #fff; + border-radius: 0rpx 0rpx 15rpx 15rpx; +} + +.top_box { + display: -webkit-box; + display: -webkit-flex; + display: flex; + text-align: center; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; +} + +.top_box_text { + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + margin: 50rpx 15rpx 20rpx 15rpx; +} + +.top_box_text text { + color: #FFB72D; + font-size: 40rpx; +} + +.top_item { + display: -webkit-box; + display: -webkit-flex; + display: flex; + width: 100%; + margin: 60rpx 0 0 0; +} + +.top_item_img { + float: left; + width: 28%; + margin: 0rpx 10rpx 0rpx 20rpx; +} + +.top_item_img image { + width: 150rpx; + height: 150rpx; + border-radius: 50%; + border: #f96865 solid 3rpx; +} + +.top_item_center { + float: left; + width: 50%; +} + +.top_item_center_title { + font-size: 35rpx; + color: #FFB72D; + -webkit-box-pack: start; + -webkit-justify-content: flex-start; + justify-content: flex-start; + padding: 0 10rpx 15rpx 0rpx; + word-break: break-all; + /*属性规定自动换行的处理方法。normal(使用浏览器默认的换行规则。),break-all(允许在单词内换行。),keep-all(只能在半角空格或连字符处换行。)*/ + text-overflow: ellipsis; + display: -webkit-box; + /** 对象作为伸缩盒子模型显示 **/ + -webkit-box-orient: vertical; + /** 设置或检索伸缩盒对象的子元素的排列方式 **/ + -webkit-line-clamp: 2; + /** 显示的行数 **/ + overflow: hidden; + /** 隐藏超出的内容 **/ +} + +.top_item_center_ramke { + font-size: 25rpx; + -webkit-box-pack: start; + -webkit-justify-content: flex-start; + justify-content: flex-start; + line-height: 35rpx; + letter-spacing: 0.5rpx; + word-break: break-all; + /*属性规定自动换行的处理方法。normal(使用浏览器默认的换行规则。),break-all(允许在单词内换行。),keep-all(只能在半角空格或连字符处换行。)*/ + text-overflow: ellipsis; + display: -webkit-box; + /** 对象作为伸缩盒子模型显示 **/ + -webkit-box-orient: vertical; + /** 设置或检索伸缩盒对象的子元素的排列方式 **/ + -webkit-line-clamp: 2; + /** 显示的行数 **/ + overflow: hidden; + /** 隐藏超出的内容 **/ +} + +.top_item_button { + float: right; + width: 22%; + padding: 65rpx 20rpx 0 1rpx; +} + +.top_item_button button { + font-size: 25rpx; + background: #fd6969; + color: #fff; + border-radius: 50rpx; + height: 45rpx; + line-height: 45rpx; +} + +.top_card { + width: calc(50% - 30rpx); + display: inline-block; + margin: 15rpx; +} + +.top_card_box { + background-size: cover; + background-position: center; + background-repeat: no-repeat; + border-radius: 20rpx; + height: 250rpx; + margin: 5rpx; +} + +.img1 { + background-image: url(https://mshopimg.yolipai.net/miniapp/images/giftbag/vip01.png); +} + +.img2 { + background-image: url(https://mshopimg.yolipai.net/miniapp/images/giftbag/vip02.png); +} + +.img3 { + background-image: url(https://mshopimg.yolipai.net/miniapp/images/giftbag/vip03.png); +} + +.top_card_tite_box { + width: 100%; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-pack: end; + -webkit-justify-content: flex-end; + justify-content: flex-end; +} + +.top_card_tite_a { + padding: 5rpx 25rpx 5rpx 25rpx; + line-height: 29rpx; + font-size: 25rpx; + color: #fff; + background: #ffa7c0; + border-radius: 0rpx 20rpx 0rpx 6rpx; +} + +.top_card_tite_b { + padding: 5rpx 25rpx 5rpx 25rpx; + line-height: 29rpx; + font-size: 25rpx; + color: #fff; + background: #50dfdb; + border-radius: 0rpx 20rpx 0rpx 6rpx; +} + +.top_card_tite_c { + padding: 5rpx 25rpx 5rpx 25rpx; + line-height: 29rpx; + font-size: 25rpx; + color: #fff; + background: #92cbff; + border-radius: 0rpx 20rpx 0rpx 6rpx; +} + +.top_card_tite_d { + padding: 5rpx 25rpx 5rpx 25rpx; + line-height: 29rpx; + font-size: 25rpx; + color: #fff; + border-radius: 0rpx 20rpx 0rpx 6rpx; +} + +.top_card_counte { + padding: 40rpx 20rpx 0 0; + text-align: center; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; + color: #fff; + font-size: 40rpx; +} + +.top_card_remak { + padding: 20rpx 0 40rpx 0; + text-align: center; + display: -webkit-box; + display: -webkit-flex; + display: flex; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + -webkit-box-align: center; + -webkit-align-items: center; + align-items: center; + font-size: 20rpx; + color: #fff; +} + +.top_card_button_a button { + margin: 0 85rpx; + background: #ffa6bc; + border-radius: 50rpx; + line-height: 40rpx; + height: 40rpx; + color: white; + font-size: 25rpx; +} + +.top_card_button_b button { + margin: 0 85rpx; + background: #50dfdb; + border-radius: 50rpx; + line-height: 40rpx; + height: 40rpx; + color: white; + font-size: 25rpx; +} + +.top_card_button_c button { + margin: 0 85rpx; + background: #75bcfc; + border-radius: 50rpx; + line-height: 40rpx; + height: 40rpx; + color: white; + font-size: 25rpx; +} + +.top_card_button_d button { + margin: 0 85rpx; + border-radius: 50rpx; + line-height: 40rpx; + height: 40rpx; + color: white; + font-size: 25rpx; +} + +.top_box_image { + padding: 20rpx 20rpx 20rpx 20rpx; +} + +.top_box_image image { + height: 216rpx; + width: 100%; +} + +.top_box_image button { + margin: 15rpx 95rpx 0rpx 95rpx; + background: rgb(254,182,44); + border-radius: 50rpx; + line-height: 60rpx; + height: 60rpx; + color: white; + font-size: 30rpx; +} + +.foot_box { + margin: 0 30rpx 40rpx 30rpx; + background: #fff; + border-radius: 20rpx; +} + +.foot_box_title { + color: #000; + padding: 20rpx 30rpx 20rpx 30rpx; +} + +.foot_box_text { + font-size: 30rpx; + color: #000; + line-height: 48rpx; + padding: 20rpx 35rpx 50rpx 30rpx; +} + +.button_box { + margin: 50rpx 50rpx 50rpx 50rpx; + text-align: center; +} + +.button { + margin: 0 30rpx; + background: #FFDB97; + border-radius: 50rpx; + line-height: 80rpx; + height: 80rpx; + color: white; + font-size: 35rpx; +} + +.button_text { + padding-top: 20rpx; + font-size: 20rpx; + color: white; + height: 100rpx; +} + +.foot_empty { + height: 90rpx; +} + +.foot_button { + display: -webkit-box; + display: -webkit-flex; + display: flex; + margin: 20rpx 0rpx 0rpx 0rpx; + padding: 25rpx 0rpx; + background: #fff; + text-align: center; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + position: fixed; + bottom: 0; + left: 0; + width: 100%; + z-index: 10; +} + +.foot_button_buy { + background: #FFB72D; + color: #fff; + width: 400rpx; + height: 70rpx; + font-size: 28rpx; + line-height: 70rpx; + border-radius: 40rpx; +} + +.foot_button_notbuy { + background: #999; + color: #fff; + width: 400rpx; + height: 70rpx; + font-size: 28rpx; + line-height: 70rpx; + border-radius: 40rpx; +} + +/* page { + background-color: #FFB72D; +} */ + +button::after { + border: none; +} + +.foot_box_text ._img { + width: 100%; +} + +.foot_box_text .img { + line-height: 0; +} + +.image { + width: 400rpx; + height: 200rpx; +} + +.num { + color: #FFB72D; +} + +.lvip { + left: 30rpx; + bottom: -58rpx; + width: 20rpx; + height: 90rpx; + z-index: 5; +} + +.rvip { + right: 30rpx; + bottom: -58rpx; + width: 20rpx; + height: 90rpx; + z-index: 5; +} diff --git a/pages/user/assistance/giftpacklist.js b/pages/user/assistance/giftpacklist.js index f34d5e2..f20ad1e 100644 --- a/pages/user/assistance/giftpacklist.js +++ b/pages/user/assistance/giftpacklist.js @@ -228,7 +228,7 @@ Page({ }, function(res) { - }, "post" + } ) diff --git a/pages/user/assistance/giftpacklist.wxml b/pages/user/assistance/giftpacklist.wxml index c98a819..509fad8 100644 --- a/pages/user/assistance/giftpacklist.wxml +++ b/pages/user/assistance/giftpacklist.wxml @@ -119,7 +119,7 @@ 立即使用 - + 商品已核销 -- libgit2 0.21.4