You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
apply-assistant-v3/root/home/shareList.vue

265 lines
8.3 KiB
Vue

<template>
<view class="p-root-detail-apply g_w_all g_bg_f_5 g_kuaishou g_pt_10">
<view class="g_flex_row_between flex_center g_p_12 g_mb_12 g_bg_f" v-if="(userRole.recordStatus == 3 || userRole.recordStatus == 4 || userRole.recordStatus == 5) && from == '短链接'">
<view>关注该代理可查看其佣金, 点击直接关注</view>
<view>
<g-button type="primary" size="mini" fontSize="14" btnText="关注" @clickBtn="handleSubmit"></g-button>
</view>
</view>
<g-list-job from="shareList" class="g_flex_1" :recordStatus="userRole.recordStatus" :list="query.list" @clickCard="goDetail" :loading="loading" :speed="speed" :query="query" :isShowLoginBtn="isLogin ? false : true" />
<applyFlow ref="applyFlow" @updateInfo="updateInfo" :navNewPage="false" :userInfo="userInfo" :shareAgencyId="shareUserInfo.agencyId" :agencyInfo="agencyInfo"></applyFlow>
</view>
</template>
<script>
import applyFlow from "../components/applyFlow.vue";
export default {
components: {
applyFlow,
},
onReady() {
this.G.setNavStyle();
},
onShareAppMessage1() {
return this.G.shareFun();
},
data() {
return {
cdnBaseImg: this.G.store().cdnBaseImg,
agencyId: uni.getStorageSync("apply-agencyId"),
userInfo: uni.getStorageSync("apply-userinfo"),
isAdmin: uni.getStorageSync("apply-userinfo").admin,
agencyInfo: {},
userRole: {},
shareUserInfo: {},
isCreator: false, //管理人员判断
speed: -1,
query: {
page: 1,
size: 20,
list: [],
isFinish: -1,
ujc: 0, // 0 全部 1收藏
},
isLogin: true,
loading: false,
QRCodeId: null,
from: "",
};
},
onLoad(options) {
let that = this;
let val = uni.getLaunchOptionsSync();
console.log("value", val);
console.log("options", options);
if (val.scene == 1167 || val.scene == 1065) {
this.from = "短链接";
} else {
this.from = "其他";
}
if (options.scene) {
console.log("XXXXXXXXXXXX");
//扫小程序码携带参数
var sceneStr = decodeURIComponent(options.scene);
console.log(sceneStr);
var sceneJson = this.G.sceneToJson(sceneStr);
console.log("sceneJson===", sceneJson);
that.G.Get("/checkUserLogin", {}, (res) => {
console.log("checkUserLogin", res);
if (res) {
// 已登录状态
that.getAgencyInfo().then(() => {
if (sceneJson.i) {
that.sceneStoreJobId = sceneJson.i;
let u = sceneJson.u.split("_");
that.shareUserInfo = {
agencyId: u[0],
agencyUserId: u[1],
};
that.getUserRole().then(() => {
that.getList();
});
} else {
that.QRCodeId = sceneJson.id;
that.getId().then(() => {
that.getUserRole().then(() => {
that.getList();
});
});
}
});
} else {
uni.reLaunch({
url: `/root/person/loginIndex?type=shareList&path=/root/home/shareList&scene=${JSON.stringify(sceneJson)}`,
});
}
});
// this.sceneStoreJobId = sceneJson.i;
// let u = sceneJson.u.split("_");
// this.sceneStoreJobId = sceneJson.u;
uni.setStorageSync("AGENCY_USER_ID", sceneJson.u);
// app.globalData.sceneStoreJobId = sceneJson.ids
}
// if (uni.getStorageSync("apply-userinfo")) {
// this.isLogin = true;
// } else {
// this.isLogin = false;
// }
},
onShow() {},
methods: {
/**
* 获取登录人的团队信息
*/
getAgencyInfo() {
let that = this;
return new Promise((reso, reject) => {
that.G.Get(that.api.login_agencyInfo, {}, (aRes) => {
console.log("获取团队信息:", aRes);
if (aRes.agency) {
that.agencyInfo = { ...aRes.agency, fullName: aRes.agency.fullName ? aRes.agency.fullName : that.agencyInfo.fullName };
uni.setStorageSync("agencyInfo", aRes.agency);
}
setTimeout(() => {
reso();
}, 200);
});
});
},
// 组件关注后更新信息
updateInfo() {
let that = this;
that.getAgencyInfo().then(() => {
that.getUserRole().then(() => {
that.G.checkToken();
});
});
},
getUserRole() {
let that = this;
return new Promise((resolve, reject) => {
this.G.Get(this.api.order_getAgencyByIdForApply, { agencyId: that.shareUserInfo.agencyId, inviteUserId: this.shareUserInfo.agencyUserId }, (res) => {
console.log("resresresresresres++++++++++++++", res);
that.userRole = res;
resolve();
});
});
},
/**
* 获取二维码携带的信息
*/
getId() {
let that = this;
return new Promise((resolve, reject) => {
this.G.Get(this.api.common_getQRCode, { id: that.QRCodeId }, (res) => {
console.log("resresresresresres++++++++++++++", res);
let params = JSON.parse(res.params);
that.sceneStoreJobId = params.storeJobIds;
that.shareUserInfo = {
agencyId: params.agencyId,
agencyUserId: params.userId,
};
resolve();
});
});
},
getList($type = "init") {
let that = this;
that.G.Get(
that.api.get_sharejob_list,
{
storeJobIds: that.sceneStoreJobId,
},
(res) => {
console.log("一才职位列表:", res);
that.speed = res.list.length;
that.query.isFinish = res.list.length;
if (res.list && res.list.length > 0) {
res.list = that.G.toGetAddressv3(res.list);
res.list = that.G.toGetAge(res.list);
res.list = that.G.yijobCopy(res.list);
}
if ($type == "init") {
that.query.list = [];
that.query.list = res.list.map((item, index) => {
return {
...item,
title: item.jobName,
address: item.district + item.age,
price: item.salaryClassify != 7 ? that.G.getSalaryClassifyValue(item.salaryClassify, item.salaryClassifyValue) : that.G.getSalaryClassifyValue(item.salaryClassify, item.minMonthlyPay, item.maxMonthlyPay),
logo: item.agencyLogo,
time: that.G.setDeadLine(item.updateTime, "jiaofu"),
fuWuFei: that.G.setReturnFee(item.returnFee, item.returnFeeType),
gender: that.G.getGenderByMinAge(item),
leafCateId: item.id,
// serverPrice: that.tabInfo.list[that.tabInfo.active].tip == 2 ? that.G.setReturnFee(item.returnFee, item.returnFeeType) : that.G.setReturnFee(item.agencyReturnFee, item.agencyReturnFeeType),
serverPrice: that.G.setReturnFee(item.agencyReturnFee, item.agencyReturnFeeType),
recruitmentSwitch: item.recruitment == 1 ? true : false,
recruitmentImage: item.recruitment,
isToday: item.today == 0 ? false : true,
};
});
} else {
that.query.list = that.query.list.concat(
res.list.map((item, index) => {
return {
...item,
title: item.jobName,
address: item.district + item.age,
price: item.salaryClassify != 7 ? that.G.getSalaryClassifyValue(item.salaryClassify, item.salaryClassifyValue) : that.G.getSalaryClassifyValue(item.salaryClassify, item.minMonthlyPay, item.maxMonthlyPay),
logo: item.agencyLogo,
time: that.G.setDeadLine(item.updateTime, "jiaofu"),
fuWuFei: that.G.setReturnFee(item.returnFee, item.returnFeeType),
gender: that.G.getGenderByMinAge(item),
leafCateId: item.id,
// serverPrice: that.tabInfo.list[that.tabInfo.active].tip == 2 ? that.G.setReturnFee(item.returnFee, item.returnFeeType) : that.G.setReturnFee(item.agencyReturnFee, item.agencyReturnFeeType),
serverPrice: that.G.setReturnFee(item.agencyReturnFee, item.agencyReturnFeeType),
recruitmentSwitch: item.recruitment == 1 ? true : false,
recruitmentImage: item.recruitment,
isToday: item.today == 0 ? false : true,
};
})
);
}
}
);
},
goDetail($item) {
console.log("前往详情页", $item);
if (this.isLogin) {
uni.navigateTo({
// 职位id_职位创建方_分享人_分享人团队
url: `/root/detail/job?scene=id%3D${$item.id}_${$item.agencyId}_${this.shareUserInfo.agencyUserId}_${this.shareUserInfo.agencyId}`,
});
} else {
uni.navigateTo({
url: "/root/person/loginIndex",
});
}
},
handleSubmit() {
let that = this;
this.G.isLogin();
if (this.G.isLogin()) {
console.log("123123123213");
if (that.userInfo.agencyId) {
// that.submitConfirm = true;
that.$refs.applyFlow.applyFlowConfirm();
} else {
that.$refs.applyFlow.applyFlowWidthoutAgencyConfirm();
}
}
},
},
};
</script>
<style lang="scss">
.p-root-detail-apply {
min-height: 100%;
}
</style>