|
@@ -54,7 +54,7 @@
|
|
|
|
|
|
<view class="rright1">
|
|
|
<!-- <p>距离任务有效期还有<span style="color: #f70606;">1107</span>天</p> -->
|
|
|
- <p style="color:#c4c4c4 ;">总销量:{{product.sales_count}}</p>
|
|
|
+ <p style="color:#c4c4c4 ;">近30日销量:{{product.sales_count}}</p>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
@@ -177,9 +177,8 @@
|
|
|
|
|
|
<!-- 悬赏进度条 -->
|
|
|
<view style="display: flex; justify-content: space-between;">
|
|
|
- <!-- 假数据 -->
|
|
|
<view style="font-size:22rpx;line-height:44rpx;margin-left: 27rpx;margin-right: 3rpx;">
|
|
|
- <p>悬赏奖金池:剩余<span style="color: red;">{{selection.remain_reward_poll}}</span>¥</p>
|
|
|
+ <p>悬赏奖金池:剩余<span style="color: red;">{{selection.remain_poll}}</span>¥</p>
|
|
|
</view>
|
|
|
|
|
|
<view style="width: 55%;margin: auto;">
|
|
@@ -587,9 +586,13 @@
|
|
|
],
|
|
|
|
|
|
// 数据
|
|
|
+ suc_flag: 0, //0表示access_token失效
|
|
|
+ condition_flag: 0, //0表示未达到领样条件
|
|
|
+ kuaishouFansNum: 0, //判断是否满足领样条件时调用得到的粉丝数
|
|
|
+ saleNum_30: 0,
|
|
|
qrcode: '',
|
|
|
selectionId: '',
|
|
|
- productId: '',
|
|
|
+ kuaishou_productId: '',
|
|
|
talent: {},
|
|
|
account: [],
|
|
|
selection: {},
|
|
@@ -745,6 +748,11 @@
|
|
|
await this.getTalentAccountInfo();
|
|
|
if (this.account.length != 0) {
|
|
|
await this.isSignUp();
|
|
|
+ await this.checkToken()
|
|
|
+ //token没有过期
|
|
|
+ if (this.suc_flag == 1) {
|
|
|
+ await this.checkSampleCondition()
|
|
|
+ }
|
|
|
}
|
|
|
await this.handleButtonText();
|
|
|
this.loading = false;
|
|
@@ -773,8 +781,23 @@
|
|
|
this.init();
|
|
|
},
|
|
|
methods: {
|
|
|
+ //走到这一步的token必然有效
|
|
|
+ getFansNum() {
|
|
|
+ return this.$https.get('/youngee/c/t/g/get-kuaishou-fans-num')
|
|
|
+ .then(res => {
|
|
|
+ console.log("get-kuaishou-fans-num------", res); // 这行会输出响应对象到控制台
|
|
|
+ this.kuaishouFansNum = res.data.data.fan
|
|
|
+ })
|
|
|
+ },
|
|
|
+ get30daysSaleNum() {
|
|
|
+ return this.$https.get('/youngee/c/t/g/query-sales-for30-days')
|
|
|
+ .then(res => {
|
|
|
+ console.log("query-sales-for30-days------", res); // 这行会输出响应对象到控制台
|
|
|
+ this.saleNum_30 = res.data.data
|
|
|
+ })
|
|
|
+ },
|
|
|
handleButtonText() {
|
|
|
- console.log('into handleButtonText,,this.isSign--->', this.isSign)
|
|
|
+ console.log('into handleButtonText,this.isSign--->', this.isSign)
|
|
|
// 领样条件判断
|
|
|
if (this.selection.sample_mode === 3) {
|
|
|
// 未开放免费领样
|
|
@@ -791,22 +814,24 @@
|
|
|
this.buttonText = '免费领样';
|
|
|
this.isDisabled = true;
|
|
|
} else if (this.isSign === 1) {
|
|
|
- // 4. 若开放免费领样,但已经申请过,则按钮文字为“已申请”且置灰不可点击
|
|
|
+ //4. 若开放免费领样,但已经申请过,则按钮文字为“已申请”且置灰不可点击
|
|
|
+ //特殊情况:如果查到了数据,并且sectask的sample_mode也为1,说明是真申请过了
|
|
|
console.log("come in")
|
|
|
this.buttonText = '已申请';
|
|
|
this.isDisabled = true;
|
|
|
} else {
|
|
|
//不满足领取条件
|
|
|
//授权过期
|
|
|
- console.log("其他情况")
|
|
|
-
|
|
|
+ console.log("按钮可点击")
|
|
|
}
|
|
|
} else {
|
|
|
console.log("sample_mode不可为2")
|
|
|
}
|
|
|
},
|
|
|
getFansLabel(fansNum) {
|
|
|
+ //// 在 options 数组中查找 value 属性等于 fansNum.toString() 的对象 fansNum在表中为int类型
|
|
|
const option = this.options.find(o => o.value === fansNum.toString());
|
|
|
+ // 如果找到这样的对象,则返回其 label 属性值,否则返回 fansNum
|
|
|
return option ? option.label : fansNum;
|
|
|
},
|
|
|
handleCopy(content) {
|
|
@@ -891,7 +916,7 @@
|
|
|
).then(res => {
|
|
|
if (res.data.code === 0) {
|
|
|
this.selection = res.data.data
|
|
|
- console.log("this.selection---->",this.selection)
|
|
|
+ console.log("this.selection---->", this.selection)
|
|
|
this.product = this.selection.YounggeeProduct[0]
|
|
|
this.younggeeProductPhoto = this.selection.YounggeeProductPhoto
|
|
|
this.freeStrategy = this.selection.FreeStrategy
|
|
@@ -952,7 +977,8 @@
|
|
|
this.selection.sample_percent = (this.selection.remain_num / this.selection.sample_num) *
|
|
|
100
|
|
|
//悬赏进度
|
|
|
- this.selection.reward_percent = (this.selection.remain_reward_poll / this.rewardStrategy
|
|
|
+ this.selection.remain_poll=this.rewardStrategy.reward-this.selection.settlement_amount
|
|
|
+ this.selection.reward_percent = (this.selection.remain_poll / this.rewardStrategy
|
|
|
.reward) *
|
|
|
100
|
|
|
// this.selection.task_reward=this.selection.task_reward
|
|
@@ -985,20 +1011,17 @@
|
|
|
|
|
|
},
|
|
|
//账号信息
|
|
|
- // res 包含了从 /youngee/c/t/g/get-talent-account 路径获取的响应数据
|
|
|
getTalentAccountInfo() {
|
|
|
- console.log("into getTalentAccountInfo")
|
|
|
- return this.$https.get('/youngee/c/t/g/get-talent-account')
|
|
|
+ return this.$https.get('/youngee/c/t/g/get-talent-account-kuaishou')
|
|
|
.then(res => {
|
|
|
var accounts = res.data.data
|
|
|
this.account = []
|
|
|
// -3表示未绑定任何平台
|
|
|
if (res.data.code != -3) {
|
|
|
for (var i = 0; i < accounts.length; i++) {
|
|
|
- console.log("account数组——————: ", accounts[i])
|
|
|
+ console.log("kuaishouaccount数组——————: ", accounts[i])
|
|
|
// 此带货商品的平台与用户绑定的三方平台一致,才会加入到this.account中
|
|
|
if (this.selection.platform === accounts[i].platform_id) {
|
|
|
- accounts[i].show_fans_count = fansview(accounts[i].fans_count)
|
|
|
this.account.push(accounts[i])
|
|
|
}
|
|
|
}
|
|
@@ -1006,6 +1029,7 @@
|
|
|
})
|
|
|
// console.log("account数组——————: ",res)
|
|
|
},
|
|
|
+
|
|
|
isSignUp() {
|
|
|
console.log("into isSignUp")
|
|
|
return this.$https.get('/youngee/c/t/g/is-sign-up-sec-task' +
|
|
@@ -1026,6 +1050,18 @@
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ checkToken() {
|
|
|
+ //进入页面就发送一个请求,看是否过期
|
|
|
+ return this.$https.get('/youngee/c/t/g/check-token-exp')
|
|
|
+ .then(res => {
|
|
|
+ console.log("checkToken___", res)
|
|
|
+ if (res.data.code == -2) {
|
|
|
+ this.suc_flag = 0
|
|
|
+ } else {
|
|
|
+ this.suc_flag = 1
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
onPageScroll(res) {
|
|
|
uni.$emit('onPageScroll', res.scrollTop);
|
|
|
this.scrollTop = res.scrollTop;
|
|
@@ -1092,25 +1128,133 @@
|
|
|
// 添加橱窗
|
|
|
addwindow() {
|
|
|
console.log('ino addwindow')
|
|
|
+ let that = this
|
|
|
+ //1.账号绑定情况
|
|
|
+ if (that.account.length === 0) {
|
|
|
+ uni.showModal({
|
|
|
+ content: '您尚未绑定快手账号,请绑定快手账号后重试',
|
|
|
+ confirmText: '去绑定',
|
|
|
+ success: function(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ //绑定快手平台
|
|
|
+ if (that.selection.platform == 4) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/page_mycenter/bindaccounts/kuaishoubind'
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/page_mycenter/myinformation/bindaccount?platform_id=' +
|
|
|
+ that.selection.platform
|
|
|
+ });
|
|
|
+ };
|
|
|
+ } else if (res.cancel) {
|
|
|
+ console.log('用户点击取消');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else if (that.suc_flag == 0) {
|
|
|
+ //2.token无效情况
|
|
|
+ uni.showModal({
|
|
|
+ content: '您快手账号授权已过期,请刷新快手账号授权后重试',
|
|
|
+ confirmText: '去刷新',
|
|
|
+ success: function(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ //刷新快手平台
|
|
|
+ if (that.selection.platform == 4) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/page_mycenter/bindaccounts/kuaishoubind'
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/page_mycenter/myinformation/bindaccount?platform_id=' +
|
|
|
+ that.selection.platform
|
|
|
+ });
|
|
|
+ };
|
|
|
+ } else if (res.cancel) {
|
|
|
+ console.log('用户点击取消');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ //token有效
|
|
|
+ } else {
|
|
|
+ console.log("api----", this.product.kuaishou_product_id)
|
|
|
+ //调用加入橱窗api
|
|
|
+ this.$https.get('/youngee/c/t/g/add-window' +
|
|
|
+ "?" +
|
|
|
+ "product_id" +
|
|
|
+ "=" +
|
|
|
+ this.product.kuaishou_product_id
|
|
|
+ ).then(res => {
|
|
|
+ console.log("add window res****", res)
|
|
|
+ //未开通
|
|
|
+ let api_result = res.data.data.data[0]
|
|
|
+ if (api_result.result == 1800533) {
|
|
|
+ uni.showModal({
|
|
|
+ content: '选品不存在或已下线', // 这里设置弹窗的内容
|
|
|
+ showCancel: false, // 不显示取消按钮
|
|
|
+ confirmText: '知道了', // 设置确认按钮的文本
|
|
|
+ success: function(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ console.log('用户点击知道了');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else if (api_result.result == 1800550) {
|
|
|
+ uni.showModal({
|
|
|
+ content: '您未开通快手橱窗,请开通后重试', // 这里设置弹窗的内容
|
|
|
+ showCancel: false, // 不显示取消按钮
|
|
|
+ confirmText: '知道了', // 设置确认按钮的文本
|
|
|
+ success: function(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ console.log('用户点击知道了');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ uni.showModal({
|
|
|
+ content: '添加橱窗成功,已创建带货任务!', // 这里设置弹窗的内容
|
|
|
+ showCancel: false, // 不显示取消按钮
|
|
|
+ confirmText: '知道了', // 设置确认按钮的文本
|
|
|
+ success: function(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ console.log('用户点击知道了');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //添加到seltask带货任务中
|
|
|
+ console.log("提交报名")
|
|
|
+ // 直接报名
|
|
|
+ console.log("********", this.selection.product_id)
|
|
|
+ console.log("this.kuaishouFansNum********111", this.kuaishouFansNum)
|
|
|
+ console.log("this.saleNum_30********111", this.saleNum_30)
|
|
|
+ this.$https.post('/youngee/c/t/p/sign-up-sec-task-from-window', {
|
|
|
+ selection_id: this.selection.selection_id,
|
|
|
+ product_id: this.selection.product_id,
|
|
|
+ //新增
|
|
|
+ saleNum: this.saleNum_30,
|
|
|
+ fans: this.kuaishouFansNum,
|
|
|
+ }).then(res => {
|
|
|
+ console.log("addwindow succuss",res)
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
-
|
|
|
// 免费领样
|
|
|
submit(type) {
|
|
|
// this在页面刚展示时,已经被赋值了必要的信息
|
|
|
- let that = this
|
|
|
- //是否绑定收获地址
|
|
|
+ let that = this;
|
|
|
+ //绑定收获地址,这样详情页就不用考虑没有地址的情况了
|
|
|
if (that.talent.is_bind_location === 0) {
|
|
|
- // 前往个人信息绑定三合一界面。。
|
|
|
+ // 前往个人信息绑定三合一界面
|
|
|
uni.showModal({
|
|
|
content: '请先绑定个人信息',
|
|
|
success: function(res) {
|
|
|
if (res.confirm) {
|
|
|
if (that.account.length === 0) {
|
|
|
-
|
|
|
-
|
|
|
uni.navigateTo({
|
|
|
- url: '/page_tasksquare/bindinfo?platform_id=' +
|
|
|
- that
|
|
|
+ url: '/page_tasksquare/bindinfo?platform_id=' + that
|
|
|
.selection.platform
|
|
|
})
|
|
|
} else {
|
|
@@ -1128,42 +1272,113 @@
|
|
|
});
|
|
|
} else if (that.account.length === 0) {
|
|
|
uni.showModal({
|
|
|
- content: '您尚未绑定抖音账号,请绑定抖音账号后重试',
|
|
|
-
|
|
|
+ content: '您尚未绑定快手账号,请绑定快手账号后重试',
|
|
|
confirmText: '去绑定',
|
|
|
success: function(res) {
|
|
|
if (res.confirm) {
|
|
|
- //绑定抖音平台
|
|
|
- if (that.selection.platform == 2) {
|
|
|
+ // 绑定快手平台
|
|
|
+ if (that.selection.platform == 4) {
|
|
|
uni.navigateTo({
|
|
|
- url: '/page_mycenter/bindaccounts/douyinbind'
|
|
|
+ url: '/page_mycenter/bindaccounts/kuaishoubind'
|
|
|
});
|
|
|
} else {
|
|
|
uni.navigateTo({
|
|
|
url: '/page_mycenter/myinformation/bindaccount?platform_id=' +
|
|
|
that.selection.platform
|
|
|
});
|
|
|
- };
|
|
|
+ }
|
|
|
} else if (res.cancel) {
|
|
|
console.log('用户点击取消');
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
+ } else if (this.suc_flag == 0) {
|
|
|
+ // token无效情况
|
|
|
+ uni.showModal({
|
|
|
+ content: '您快手账号授权已过期,请刷新快手账号授权后重试',
|
|
|
+ confirmText: '去刷新',
|
|
|
+ success: function(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ // 刷新快手平台
|
|
|
+ if (that.selection.platform == 4) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/page_mycenter/bindaccounts/kuaishoubind'
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/page_mycenter/myinformation/bindaccount?platform_id=' +
|
|
|
+ that.selection.platform
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else if (res.cancel) {
|
|
|
+ console.log('用户点击取消');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //token有效
|
|
|
+ } else if (this.condition_flag == 0) {
|
|
|
+ // 未到达领样条件
|
|
|
+ uni.showModal({
|
|
|
+ content: '您的账号暂未达到领样要求,若在快手平台已达标,请刷新快手账号授权后重试', // 这里设置弹窗的内容
|
|
|
+ showCancel: false, // 不显示取消按钮
|
|
|
+ confirmText: '知道了', // 设置确认按钮的文本
|
|
|
+ success: function(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ console.log('用户点击知道了');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
} else {
|
|
|
+ // 达到领样条件 ,进入信息确认页
|
|
|
var data = {
|
|
|
selectionId: this.selectionId,
|
|
|
selection: this.selection,
|
|
|
youngTeamId: this.youngTeamId,
|
|
|
youngLeadTeamId: this.youngLeadTeamId,
|
|
|
- }
|
|
|
- data = JSON.stringify(data)
|
|
|
- console.log("data: ", data)
|
|
|
+ saleNum_30: this.saleNum_30,
|
|
|
+ fansNum: this.kuaishouFansNum,
|
|
|
+ };
|
|
|
+ data = JSON.stringify(data);
|
|
|
+ // console.log("此页面传递给信息确认页的信息: ", data);
|
|
|
uni.navigateTo({
|
|
|
url: '/page_selectionsquare/selectiondetail/information?textObj=' +
|
|
|
- encodeURIComponent(
|
|
|
- data)
|
|
|
- })
|
|
|
+ encodeURIComponent(data)
|
|
|
+ });
|
|
|
}
|
|
|
+
|
|
|
+ },
|
|
|
+ async checkSampleCondition() {
|
|
|
+ //获取粉丝数, 获取30天销量
|
|
|
+ await this.getFansNum()
|
|
|
+ await this.get30daysSaleNum()
|
|
|
+ console.log("get30daysSaleNum()", this.saleNum_30)
|
|
|
+ console.log("after this.getFansNum()", this.kuaishouFansNum)
|
|
|
+ // 将区间映射到最小粉丝数
|
|
|
+ //声明对象,声明键和值
|
|
|
+ const fansCountRanges = {
|
|
|
+ 1: 0,
|
|
|
+ 2: 0,
|
|
|
+ 3: 10000,
|
|
|
+ 4: 100000,
|
|
|
+ 5: 1000000,
|
|
|
+ 6: 5000000,
|
|
|
+ 7: 10000000 // 对于 1000w以上, 设置一个大的默认值,比如无穷大
|
|
|
+ };
|
|
|
+
|
|
|
+ for (let strategy of this.freeStrategy) {
|
|
|
+ console.log("strategy", strategy)
|
|
|
+ let requiredFans = fansCountRanges[strategy.fans_num];
|
|
|
+ console.log("this.kuaishouFansNum", this.kuaishouFansNum)
|
|
|
+ console.log("requiredFans", requiredFans)
|
|
|
+ console.log("this.saleNum_30", this.saleNum_30)
|
|
|
+ console.log("strategy.sale_num", strategy.sale_num)
|
|
|
+ if (this.kuaishouFansNum >= requiredFans && this.saleNum_30 >= strategy.sale_num) {
|
|
|
+ console.log("条件满足")
|
|
|
+ this.condition_flag = 1;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.condition_flag = 0;
|
|
|
},
|
|
|
// 下载视频
|
|
|
downloadVideo(url) {
|
|
@@ -1250,61 +1465,6 @@
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- //进入信息确认页面
|
|
|
- determine() {
|
|
|
- console.log(this.strategy_id)
|
|
|
- if (this.strategy_id === 0 || this.strategy === null) {
|
|
|
- this.showWarning = true;
|
|
|
- setTimeout(() => {
|
|
|
- this.showWarning = false;
|
|
|
- }, 2000)
|
|
|
- return
|
|
|
- }
|
|
|
- let index = 0;
|
|
|
- for (let i = 0; i < this.coop_choice.length; ++i) {
|
|
|
- if (this.strategy_id === this.coop_choice[i].strategy_id) {
|
|
|
- index = i
|
|
|
- }
|
|
|
- }
|
|
|
- if (this.account[0].fans_count < this.strategy.followers_low) {
|
|
|
- this.coop_choice[index].warningText = "粉丝量不符合报名条件"
|
|
|
- this.coop_choice[index].showWarning = true;
|
|
|
- this.hackReset = false;
|
|
|
- this.hackReset = true;
|
|
|
- setTimeout(() => {
|
|
|
- this.coop_choice[index].showWarning = false;
|
|
|
- this.hackReset = false;
|
|
|
- this.hackReset = true;
|
|
|
- }, 2000)
|
|
|
- } else if (this.strategy.fee_form === 3 && (this.strategy.offer === 0 || this.strategy
|
|
|
- .offer === null)) {
|
|
|
- this.coop_choice[index].warningText = "请填写自报价金额"
|
|
|
- this.coop_choice[index].showWarning = true;
|
|
|
- this.hackReset = false;
|
|
|
- this.hackReset = true;
|
|
|
- setTimeout(() => {
|
|
|
- this.coop_choice[index].showWarning = false;
|
|
|
- this.hackReset = false;
|
|
|
- this.hackReset = true;
|
|
|
- }, 2000)
|
|
|
- } else {
|
|
|
- this.$refs.popup.close()
|
|
|
- this.strategy.offer = parseInt(this.strategy.offer)
|
|
|
- this.strategy.showOffer = money(this.strategy.offer)
|
|
|
- var data = {
|
|
|
- projectid: this.projectid,
|
|
|
- information: this.information,
|
|
|
- account: this.account[0].account_id,
|
|
|
- strategy: this.strategy,
|
|
|
- },
|
|
|
- data = JSON.stringify(data)
|
|
|
- console.log("data")
|
|
|
- console.log(data)
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/tasksquare/information?textObj=' + encodeURIComponent(data)
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
beginCanvas() {
|
|
|
this.$refs.mosoweCanvasComponents.createCanvas();
|
|
|
},
|