123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <template>
- <view class="bind">
- <view class="bind-content">
- <view v-if="show_btn == 1" class="btn-list">
- <view @click="_getGift" class="btn">领取玩具</view>
- </view>
- <view v-if="show_btn == 2" class="btn-list">
- <view class="disabled">{{ error_msg }}</view>
- </view>
- <view class="tip">
- <view>领取规则:</view>
- <view style="margin-top: 10rpx">下单添加客服免费领取玩具,随刊赠送</view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- show_btn: 0,
- kailin_uid: null,
- work_userid: null,
- };
- },
- onLoad(param) {
- if (!this.$checkAccess.alterLogin()) {
- return;
- }
- this.kailin_uid = param.kailin_uid;
- this.work_userid = param.work_userid;
- if (param.kailin_uid && param.work_userid) {
- this.$http.request("api/work_bind/user", { work_userid: param.work_userid, kailin_uid: param.kailin_uid }).then((re) => {
- // 成功渲染数据
- console.log("api/work_bind/user", re);
- if (re.code == "success") {
- this.show_btn = 1;
- } else {
- this.show_btn = 2;
- this.error_msg = re.data.error || "登记失败,请联系客服";
- }
- });
- }
- },
- methods: {
- _getGift() {
- this.$http.request("api/orders_receive/receive").then((re) => {
- // 成功渲染数据
- console.log("api/work_bind/get_gift", re);
- if (re.code == "success") {
- console.log("领取成功");
- uni.showModal({
- content: "您已成功领取",
- showCancel: false,
- confirmText: "查看订单",
- success: () => {
- uni.redirectTo({
- url: "/pages/orders/index",
- });
- },
- });
- } else {
- console.log("领取失败");
- this.show_btn = 2;
- this.error_msg = re.msg;
- uni.showModal({
- content: re.msg,
- showCancel: false,
- confirmText: "回到首页",
- success: () => {
- uni.switchTab({
- url: "/pages/index/index",
- });
- },
- });
- }
- });
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .bind {
- width: 100vw;
- height: 100vh;
- position: relative;
- background-image: url("https://baokan-mp.oss-cn-shenzhen.aliyuncs.com/static/wanju_bgimg.png");
- background-size: 100% 100%;
- background-repeat: no-repeat;
- box-sizing: border-box;
- .bind-content {
- position: absolute;
- bottom: 50rpx;
- .btn-list {
- display: flex;
- flex-direction: column;
- gap: 30rpx;
- align-items: center;
- .btn {
- width: 300rpx;
- height: 80rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- box-sizing: border-box;
- background-color: #f46f2a;
- border-radius: 60rpx;
- color: #fff;
- font-weight: bold;
- font-size: 36rpx;
- }
- .disabled {
- color: #f46f2a;
- font-size: 36rpx;
- font-weight: bold;
- }
- }
- .tip {
- width: 100vw;
- box-sizing: border-box;
- padding: 0 80rpx;
- color: #f46f2a;
- margin-top: 40rpx;
- font-size: 30rpx;
- font-weight: bold;
- }
- }
- }
- </style>
|