|
@@ -190,8 +190,14 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { userUpdateLoginTime} from "../../requests/user";
|
|
|
-import { couponReceiveFirst, couponReceiveFirstID, outputCoupon, couponReceive, outCardCoupon } from "../../requests/coupons";
|
|
|
+import { userUpdateLoginTime } from "../../requests/user";
|
|
|
+import {
|
|
|
+ couponReceiveFirst,
|
|
|
+ couponReceiveFirstID,
|
|
|
+ outputCoupon,
|
|
|
+ couponReceive,
|
|
|
+ outCardCoupon,
|
|
|
+} from "../../requests/coupons";
|
|
|
import Toast from "../../../static/vant/toast/toast";
|
|
|
import { reload_userinfo } from "../../utils/user";
|
|
|
import { timestampTwoNum } from "../../utils/index";
|
|
@@ -213,14 +219,14 @@ export default {
|
|
|
// 外发
|
|
|
output: false,
|
|
|
is_outShow: false,
|
|
|
- outCouponData:{
|
|
|
- type:Number,
|
|
|
- validity_time:{
|
|
|
- type:Number
|
|
|
+ outCouponData: {
|
|
|
+ type: Number,
|
|
|
+ validity_time: {
|
|
|
+ type: Number,
|
|
|
+ },
|
|
|
+ discount: {
|
|
|
+ type: Number,
|
|
|
},
|
|
|
- discount:{
|
|
|
- type:Number
|
|
|
- }
|
|
|
},
|
|
|
// gift_time: Number
|
|
|
};
|
|
@@ -260,29 +266,31 @@ export default {
|
|
|
// }
|
|
|
// },
|
|
|
//领取外发卡券
|
|
|
- get_coupon(){
|
|
|
- wx.setStorageSync("is_out", false);
|
|
|
- couponReceive($this.outCouponData).then((res) => {
|
|
|
- let $res = res.data;
|
|
|
- if ($res.code == 0) {
|
|
|
- Toast.success({
|
|
|
- message: $res.errmsg,
|
|
|
- duration:800,
|
|
|
- onClose() {
|
|
|
- reload_userinfo($this);
|
|
|
- }
|
|
|
- })
|
|
|
- $this.is_outShow = false
|
|
|
- } else {
|
|
|
- Toast.fail({
|
|
|
- message: $res.errmsg,
|
|
|
- duration:800,
|
|
|
- })
|
|
|
- $this.is_outShow = false
|
|
|
- }
|
|
|
- }).catch((err)=>{
|
|
|
- console.log("错误",err)
|
|
|
- })
|
|
|
+ get_coupon() {
|
|
|
+ wx.setStorageSync("is_out", false);
|
|
|
+ couponReceive($this.outCouponData)
|
|
|
+ .then((res) => {
|
|
|
+ let $res = res.data;
|
|
|
+ if ($res.code == 0) {
|
|
|
+ Toast.success({
|
|
|
+ message: $res.errmsg,
|
|
|
+ duration: 800,
|
|
|
+ onClose() {
|
|
|
+ reload_userinfo($this);
|
|
|
+ },
|
|
|
+ });
|
|
|
+ $this.is_outShow = false;
|
|
|
+ } else {
|
|
|
+ Toast.fail({
|
|
|
+ message: $res.errmsg,
|
|
|
+ duration: 800,
|
|
|
+ });
|
|
|
+ $this.is_outShow = false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.log("错误", err);
|
|
|
+ });
|
|
|
},
|
|
|
//修改第一次登录状态
|
|
|
close_pop() {
|
|
@@ -308,51 +316,54 @@ export default {
|
|
|
change_login_status() {
|
|
|
$this.$emit("change_login_status");
|
|
|
},
|
|
|
+ // 外发通用数据处理
|
|
|
+ handle_coupon_data(res) {
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ let $newData = res.data.data;
|
|
|
+ $newData.validity_time["start_time_format"] = timestampTwoNum(
|
|
|
+ $newData.validity_time["start_time"]
|
|
|
+ );
|
|
|
+ $newData.validity_time["end_time_format"] = timestampTwoNum(
|
|
|
+ $newData.validity_time["end_time"]
|
|
|
+ );
|
|
|
+ $newData.validity_time["time_format"] = timestampTwoNum(
|
|
|
+ $newData.validity_time["time"]
|
|
|
+ );
|
|
|
+
|
|
|
+ $this.outCouponData = $newData;
|
|
|
+ console.log("外发数据:", $this.outCouponData);
|
|
|
+ $this.is_outShow = true;
|
|
|
+ } else {
|
|
|
+ wx.setStorageSync("is_out", false);
|
|
|
+ $this.output = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 获取不同外发券
|
|
|
+ check_output_coupon() {
|
|
|
+ //外发
|
|
|
+ $this.output = wx.getStorageSync("is_out");
|
|
|
+ reload_userinfo($this);
|
|
|
+
|
|
|
+ //获取外发数据
|
|
|
+ if ($this.output == true) {
|
|
|
+ // 判断外发哪种券
|
|
|
+ if (wx.getStorageSync("is_other") == false) {
|
|
|
+ outputCoupon().then((res) => {
|
|
|
+ handle_coupon_data(res)
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ outCardCoupon().then((res) => {
|
|
|
+ handle_coupon_data(res)
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
$this.first = wx.getStorageSync("is_first");
|
|
|
$this.invite_code = wx.getStorageSync("code");
|
|
|
- //外发
|
|
|
- $this.output = wx.getStorageSync("is_out");
|
|
|
- reload_userinfo($this);
|
|
|
-
|
|
|
- //获取外发数据
|
|
|
- if($this.output == true){
|
|
|
- // 判断外发哪种券
|
|
|
- if(wx.getStorageSync("is_other") == false){
|
|
|
- outputCoupon().then((res)=>{
|
|
|
- if(res.data.code == 0){
|
|
|
- let $newData = res.data.data
|
|
|
- $newData.validity_time['start_time_format'] = timestampTwoNum($newData.validity_time['start_time'])
|
|
|
- $newData.validity_time['end_time_format'] = timestampTwoNum($newData.validity_time['end_time'])
|
|
|
- $newData.validity_time['time_format'] = timestampTwoNum($newData.validity_time['time'])
|
|
|
-
|
|
|
- $this.outCouponData = $newData
|
|
|
- console.log('外发数据:',$this.outCouponData)
|
|
|
- $this.is_outShow = true
|
|
|
- }else{
|
|
|
- wx.setStorageSync("is_out", false);
|
|
|
- $this.output = false
|
|
|
- }
|
|
|
- })
|
|
|
- }else{
|
|
|
- outCardCoupon().then((res)=>{
|
|
|
- if(res.data.code == 0){
|
|
|
- let $newData = res.data.data
|
|
|
- $newData.validity_time['start_time_format'] = timestampTwoNum($newData.validity_time['start_time'])
|
|
|
- $newData.validity_time['end_time_format'] = timestampTwoNum($newData.validity_time['end_time'])
|
|
|
- $newData.validity_time['time_format'] = timestampTwoNum($newData.validity_time['time'])
|
|
|
|
|
|
- $this.outCouponData = $newData
|
|
|
- console.log('外发数据:',$this.outCouponData)
|
|
|
- $this.is_outShow = true
|
|
|
- }else{
|
|
|
- wx.setStorageSync("is_out", false);
|
|
|
- $this.output = false
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
+ $this.check_output_coupon();
|
|
|
|
|
|
//判断是否每月20号
|
|
|
// let day = new Date().getDate();
|
|
@@ -369,48 +380,7 @@ export default {
|
|
|
// console.log("可以领注册体验券吗", $this.first & $this.twenty);
|
|
|
},
|
|
|
onShow() {
|
|
|
- //外发
|
|
|
- $this.output = wx.getStorageSync("is_out");
|
|
|
-
|
|
|
- reload_userinfo($this);
|
|
|
-
|
|
|
- // 获取外发信息
|
|
|
- if($this.output == true){
|
|
|
- // 判断外发哪种券
|
|
|
- if(wx.getStorageSync("is_other") == false){
|
|
|
- outputCoupon().then((res)=>{
|
|
|
- if(res.data.code == 0){
|
|
|
- let $newData = res.data.data
|
|
|
- $newData.validity_time['start_time_format'] = timestampTwoNum($newData.validity_time['start_time'])
|
|
|
- $newData.validity_time['end_time_format'] = timestampTwoNum($newData.validity_time['end_time'])
|
|
|
- $newData.validity_time['time_format'] = timestampTwoNum($newData.validity_time['time'])
|
|
|
-
|
|
|
- $this.outCouponData = $newData
|
|
|
- console.log('外发数据:',$this.outCouponData)
|
|
|
- $this.is_outShow = true
|
|
|
- }else{
|
|
|
- wx.setStorageSync("is_out", false);
|
|
|
- $this.output = false
|
|
|
- }
|
|
|
- })
|
|
|
- }else{
|
|
|
- outCardCoupon().then((res)=>{
|
|
|
- if(res.data.code == 0){
|
|
|
- let $newData = res.data.data
|
|
|
- $newData.validity_time['start_time_format'] = timestampTwoNum($newData.validity_time['start_time'])
|
|
|
- $newData.validity_time['end_time_format'] = timestampTwoNum($newData.validity_time['end_time'])
|
|
|
- $newData.validity_time['time_format'] = timestampTwoNum($newData.validity_time['time'])
|
|
|
-
|
|
|
- $this.outCouponData = $newData
|
|
|
- console.log('外发数据:',$this.outCouponData)
|
|
|
- $this.is_outShow = true
|
|
|
- }else{
|
|
|
- wx.setStorageSync("is_out", false);
|
|
|
- $this.output = false
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
+ $this.check_output_coupon();
|
|
|
},
|
|
|
created() {
|
|
|
$this = this;
|
|
@@ -469,16 +439,16 @@ export default {
|
|
|
background-size: 100% 100%;
|
|
|
width: 270px;
|
|
|
height: 235px;
|
|
|
- padding-left: 5px
|
|
|
+ padding-left: 5px;
|
|
|
}
|
|
|
-.quan_container_lil{
|
|
|
+.quan_container_lil {
|
|
|
background-image: url("https://img.shuimuai.com/pic_getCouponlil.png");
|
|
|
background-position: center;
|
|
|
background-size: 100% 100%;
|
|
|
width: 185px;
|
|
|
height: 56px;
|
|
|
display: flex;
|
|
|
- align-items: center
|
|
|
+ align-items: center;
|
|
|
}
|
|
|
/*标题*/
|
|
|
.quan_container .title {
|
|
@@ -500,29 +470,31 @@ export default {
|
|
|
/*分钟数*/
|
|
|
.quan_container .time {
|
|
|
font-weight: bold;
|
|
|
- color: #6858C4;
|
|
|
+ color: #6858c4;
|
|
|
}
|
|
|
-.hexiao,.discount,.experience{
|
|
|
+.hexiao,
|
|
|
+.discount,
|
|
|
+.experience {
|
|
|
font-size: 36px;
|
|
|
}
|
|
|
-.random{
|
|
|
+.random {
|
|
|
font-size: 19px;
|
|
|
}
|
|
|
-.manjian{
|
|
|
+.manjian {
|
|
|
font-size: 24px;
|
|
|
}
|
|
|
/*分钟二字*/
|
|
|
.quan_container .time_text {
|
|
|
font-size: 12px;
|
|
|
font-weight: 400;
|
|
|
- color: #6858C4;
|
|
|
+ color: #6858c4;
|
|
|
}
|
|
|
|
|
|
/* 领取按钮 */
|
|
|
-.get_btn{
|
|
|
+.get_btn {
|
|
|
width: 119px;
|
|
|
height: 31px;
|
|
|
- background: #6858C4;
|
|
|
+ background: #6858c4;
|
|
|
border-radius: 15px;
|
|
|
}
|
|
|
/*弹窗模块*/
|