Browse Source

保存合伙人信息

develop
lfs3 6 years ago
parent
commit
fed81e28dd
5 changed files with 967 additions and 907 deletions
  1. 10
      src/common/util.js
  2. 31
      src/view/choose-community.vue
  3. 96
      src/view/home.vue
  4. 487
      src/view/month-card.vue
  5. 1250
      src/view/order-check.vue

10
src/common/util.js

@ -57,7 +57,13 @@ export default {
return null
}
}
},
};
export function isEmpty(val) {
return (
val === undefined ||
val === null ||
val === "undefined" ||
val === "")
}

31
src/view/choose-community.vue

@ -33,7 +33,7 @@
<div class="title">
<span class="f-ml15 f-font-14 f-text-666">附近小区</span>
</div>
<div v-for="item in communityList" :key="item.housingEstateId" v-if="item.housingEstateId != estateId" class="f-flex f-flex-justify f-h60 f-ml15 f-mr15" style="border-bottom: 1px solid #f3f3f3;" @click="chooseCommunity(item)">
<div v-for="item in communityList" :key="item.housingEstateId" v-if="item.housingEstateId != estateId" class="f-flex f-flex-justify f-h60 f-ml15 f-mr15" style="border-bottom: 1px solid #f3f3f3;" @click="chooseCommunity(item)">
<div>
<div class="f-text-333 f-font-16">{{item.housingEstateName}}</div>
<div class="f-text-666 f-font-12">{{item.prefixAddress}}</div>
@ -42,7 +42,7 @@
</div>
</div>
<!-- 无限加载 -->
<div :class="loadMoreHide ? 'load-more-hide' : 'load-more-normal'" v-infinite-scroll="fetchCommunityList" infinite-scroll-disabled="busy" infinite-scroll-distance="10">
<div :class="loadMoreHide ? 'load-more-hide' : 'load-more-normal'" v-infinite-scroll="fetchCommunityList" infinite-scroll-disabled="busy" infinite-scroll-distance="10" >
<span class="load-more-tips f-flex f-flex-center" v-show="!noRecords && loadMoreTips" style="padding-top:4px">没有更多了</span>
</div>
</div>
@ -52,7 +52,7 @@
</div>
</template>
<script>
import myScroll from "@/utils/scroll";
import myScroll from '@/utils/scroll'
import chooseCommunityApi from "../models/choose-community";
import homeApi from "../models/home-model.js";
import { Alert, Toast, Loading } from "vux";
@ -97,9 +97,9 @@ export default {
showLoading: false
};
},
beforeRouteLeave(to, from, next) {
from.meta.keepAlive = false;
next();
beforeRouteLeave(to, from, next) {
from.meta.keepAlive = false
next()
},
mixins: [myScroll],
methods: {
@ -172,7 +172,7 @@ export default {
// localStorage.setItem("cityName", list);
this.show = false;
this.pageNum = 1;
this.communityName = "";
this.communityName ="";
this.fetchCommunityList();
},
@ -199,10 +199,10 @@ export default {
this.showFlag = false;
this.communityName = "";
this.busy = false;
this.pageNum++;
this.loadMoreHide = false;
this.loadMoreTips = false;
this.communityList = [];
this.pageNum++;
this.loadMoreHide = false;
this.loadMoreTips = false;
this.communityList = [];
this.fetchCommunityList();
},
searchByName(event) {
@ -218,7 +218,7 @@ export default {
}
this.isRequesting = true;
//this.busy = true;
var _this = this;
var _this = this
return new Promise((resolve, reject) => {
var params = {
pageNo: this.pageNum,
@ -235,7 +235,7 @@ export default {
if (res.code == 0) {
_this.communityList = _this.communityList.concat(res.dataList);
if (!_this.communityList.length) _this.noRecords = true;
if (_this.pageSize > res.dataList.length) {
_this.busy = true; //
_this.loadMoreHide = true;
@ -261,10 +261,7 @@ export default {
item.districtId + "&" + item.districtName + "&" + item.merchantNo
];
localStorage.setItem("cityName", addressValue.slice());
localStorage.setItem(
"estate",
item.housingEstateId + "&" + item.housingEstateName
);
localStorage.setItem("estate", item.housingEstateId + "&" + item.housingEstateName);
this.estateId = item.housingEstateId;
this.countPartner();
this.$router.push({

96
src/view/home.vue

@ -149,6 +149,7 @@ import chooseCommunityApi from "../models/choose-community";
import homeApi from "../models/home-model.js";
import configs from "../configs";
import { Alert, Toast, Loading } from "vux";
import {isEmpty} from "@/common/util";
import routerFooter from "../components/nav-bottom";
import popupPicker from "../components/popup-picker.vue";
import Qs from "qs";
@ -330,21 +331,54 @@ export default {
: "");
this.alertShow = true;
} else if (data.userAddress.type == 2) {
this.$vux.confirm.show({
title: "自动定位地址:",
content:
data.userAddress.cityName +
(data.userAddress.districtName
? data.userAddress.districtName
: ""),
cancelText: "切换地址",
onCancel: () => {
this.chooseCommunity();
},
onConfirm: () => {
this.defaultLocalEstate(data.estateInfo);
this.getGoodsList();
}
return new Promise((resolve, reject) => {
chooseCommunityApi
.getEstateList({
draw: 0,
lat: this.lat,
lng: this.lng,
num: 1
})
.then(res => {
//
if (res.dataList.length > 0) {
var addreRes = res.dataList[0];
this.$vux.confirm.show({
title: "自动定位小区:",
content:addreRes.housingEstateName,
cancelText: "切换地址",
onCancel: () => {
this.chooseCommunity();
},
onConfirm: () => {
this.defaultLocalEstate(addreRes);
this.getGoodsList();
}
});
}else{
this.$vux.confirm.show({
title: "自动定位地址:",
content:
data.userAddress.cityName +
(data.userAddress.districtName
? data.userAddress.districtName
: ""),
confirmText: "选择小区",
cancelText: "切换地址",
onCancel: () => {
this.chooseCommunity();
},
onConfirm: () => {
this.defaultLocalEstate(data.estateInfo);
this.chooseCommunity();
}
});
}
this.showLoading = false;
})
.catch(error => {
this.showLoading = false;
});
});
} else if (data.userAddress.type == 0) {
this.getGoodsList();
@ -414,14 +448,7 @@ export default {
this.getCity();
}
},
isEmpty(val) {
return (
typeof val === undefined ||
val === "undefined" ||
val === null ||
val === ""
);
},
getCity() {
let _this = this;
var geolocation = new BMap.Geolocation();
@ -499,21 +526,22 @@ export default {
this.defaultCommunity = estateRes.housingEstateName
? estateRes.housingEstateName
: this.defaultCommunity;
localStorage.setItem(
"estate",
this.estateId + "&" + this.defaultCommunity
);
if(!isEmpty(this.estateId)){
localStorage.setItem("estate",this.estateId + "&" + this.defaultCommunity);
}
}
},
mounted() {
mounted() {
//
// this.getdefaultAddress();
// this.getAddress();
// this.getLocation();
this.getId();
let eId = this.$route.query.estateId;
if (!this.isEmpty(eId)) {
if (!this.isEmpty(this.estateId)) {
if (!isEmpty(eId) ) {
if (!isEmpty(this.estateId)) {
this.showLoading = true;
return new Promise((resolve, reject) => {
chooseCommunityApi
@ -521,7 +549,7 @@ export default {
estateId: this.estateId ? this.estateId : ""
})
.then(res => {
if (this.isEmpty(res.response)) {
if (isEmpty(res.response)) {
//
this.estateId = eId;
this.getData();
@ -535,7 +563,7 @@ export default {
})
.then(res => {
this.showLoading = false;
if (this.isEmpty(res.response)) {
if (isEmpty(res.response)) {
//
this.defaultLocalEstate(loclEstate);
} else {
@ -543,7 +571,7 @@ export default {
var linkEstate = res.response;
this.$vux.confirm.show({
title: "切换小区",
content:linkEstate.housingEstateName,
content: linkEstate.housingEstateName,
confirmText: "不切换",
cancelText: "切换",
onCancel: () => {
@ -576,7 +604,7 @@ export default {
}
var uuniqueId = this.$route.query.uniqueId;
if (!this.isEmpty(uuniqueId)) {
if (!isEmpty(uuniqueId)) {
this.uniqueId = uuniqueId;
}
return new Promise((resolve, reject) => {

487
src/view/month-card.vue

@ -1,82 +1,84 @@
<template>
<div class="">
<div class="m-slider">
<img src="../assets/images/slider-img.png" width="100%" height="100%" alt="">
</div>
<div class="">
<div class="m-slider">
<img src="../assets/images/slider-img.png" width="100%" height="100%" alt="">
</div>
<div class="month-card-title f-text-center">
<h4 class="">{{getData.goodsName}}</h4>
<p class="f-mt5">{{getData.shortDesc}}</p>
<p class="f-price f-mt10 f-flex justify-center">
<span class="s-gray f-mr15">市场价 : &nbsp;<span class="line-through">{{getData.originalPrice | numFilter}}</span></span>
<span>券后价 : </span><span class="f-font-23 s-red">{{getData.couponPrice | numFilter}}</span>
</p>
</div>
<div class="month-card-title f-text-center">
<h4 class="">{{getData.goodsName}}</h4>
<p class="f-mt5">{{getData.shortDesc}}</p>
<p class="f-price f-mt10 f-flex justify-center">
<span class="s-gray f-mr15">市场价 : &nbsp;<span class="line-through">{{getData.originalPrice | numFilter}}</span></span>
<span>券后价 : </span><span class="f-font-23 s-red">{{getData.couponPrice | numFilter}}</span>
</p>
</div>
<div class="month-card-area">
<div class="month-card f-flex" style="margin-bottom: -35px;">
<div class="month-card-left" style="width: 76%;">
<div class="f-flex f-mt9">
<div class="f-mb20 f-mr10">
<p v-show="getData.type != 3" class="f-font-15" style="line-height:1;"></p>
<!-- 定额券 -->
<div v-show="getData.type == 1" class="f-bold f-font-45" style="text-shadow: 1px 1px #852B0E;">{{getData.amount | numFilter}}</div>
<!-- 满减券 -->
<div v-show="getData.type == 2" class="f-bold f-font-45" style="text-shadow: 1px 1px #852B0E;">{{getData.amount | numFilter}}</div>
<!-- 折扣 -->
<div v-show="getData.type == 3" class="f-bold f-font-45" style="text-shadow: 1px 1px #852B0E;">{{Number(getData.discount/10)}}</div>
<!-- 定额券 -->
<p v-show="getData.type != 2" class="f-font-12 f-mt5" style="margin-left: 6px;">{{couponType[getData.type]}}</p>
<!-- 满减券 -->
<p v-show="getData.type == 2" class="f-font-12 f-mt5" style="margin-left: 6px;">{{getData.fullAmount | numFilter}}可用</p>
</div>
<div class="f-mb20">
<p class="new-man">{{getData.batchName}}</p>
<p class="limit-buy">({{getData.goodsDesc}})</p>
<p class="end-date">{{getData.invalidTimeDesc}}</p>
</div>
</div>
</div>
<div class="month-card-right justify-center" style="margin-left:10px;">
<div v-show="getData.couponStatus == 0" class="f-mt-15 f-flex">
<img src="../assets/images/arrow-right_03.png" width="7" height="12" alt="" class="f-mr15">
<button class="get-btn" v-on:click="handleGetCoupon">点击领取</button>
</div>
<img v-show="getData.couponStatus > 0" src="../assets/images/get.png" width="60" height="60" alt="" class="f-mt-10">
</div>
</div>
<div class="f-mt10 f-text-center" v-show="getData.couponStatus > 0">
<div class="month-card-area">
<div class="month-card f-flex" style="margin-bottom: -35px;">
<div class="month-card-left" style="width: 76%;">
<div class="f-flex f-mt9">
<div class="f-mb20 f-mr10">
<p v-show="getData.type != 3" class="f-font-15" style="line-height:1;"></p>
<!-- 定额券 -->
<div v-show="getData.type == 1" class="f-bold f-font-45" style="text-shadow: 1px 1px #852B0E;">{{getData.amount | numFilter}}</div>
<!-- 满减券 -->
<div v-show="getData.type == 2" class="f-bold f-font-45" style="text-shadow: 1px 1px #852B0E;">{{getData.amount | numFilter}}</div>
<!-- 折扣 -->
<div v-show="getData.type == 3" class="f-bold f-font-45" style="text-shadow: 1px 1px #852B0E;">{{Number(getData.discount/10)}}</div>
<button style="background-color:#F45252" v-show="getData.couponStatus != 30" v-on:click="handleUseCoupon" class="btn-md bg-gray s-white f-font-18">立即使用</button>
<!-- 定额券 -->
<p v-show="getData.type != 2" class="f-font-12 f-mt5" style="margin-left: 6px;">{{couponType[getData.type]}}</p>
<button v-show="getData.couponStatus == 30" v-on:click="handleUseCoupon" class="btn-md bg-gray s-white f-font-18">已使用</button>
<!-- 满减券 -->
<p v-show="getData.type == 2" class="f-font-12 f-mt5" style="margin-left: 6px;">{{getData.fullAmount | numFilter}}可用</p>
</div>
<div style="padding: 0 10px 20px;">
<p class="s-gray-1 f-font-11 f-mt20" style="line-height: 18px;">使用范围{{getData.authAreaStr}}</p>
<p class="f-mt10 f-font-11 s-orange-2">
使用流程领券下单关注公众号预约服务
</p>
<div class="f-text-center">
<div class="qrcode-img">
<img src="../assets/images/qrcode.png" width='100%' height="100%" alt="">
</div>
<p class="f-font-11 f-mt5 s-black-1">预约服务请关注公众号</p>
</div>
<div class="f-mb20">
<p class="new-man">{{getData.batchName}}</p>
<p class="limit-buy">({{getData.goodsDesc}})</p>
<p class="end-date">{{getData.invalidTimeDesc}}</p>
</div>
</div>
</div>
<div class="month-card-right justify-center" style="margin-left:10px;">
<div v-show="getData.couponStatus == 0" class="f-mt-15 f-flex">
<img src="../assets/images/arrow-right_03.png" width="7" height="12" alt="" class="f-mr15">
<button class="get-btn" v-on:click="handleGetCoupon">点击领取</button>
</div>
<img v-show="getData.couponStatus > 0" src="../assets/images/get.png" width="60" height="60" alt="" class="f-mt-10">
</div>
</div>
<div class="f-mt10 f-text-center" v-show="getData.couponStatus > 0">
<button style="background-color:#F45252" v-show="getData.couponStatus != 30" v-on:click="handleUseCoupon" class="btn-md bg-gray s-white f-font-18">立即使用</button>
<button v-show="getData.couponStatus == 30" v-on:click="handleUseCoupon" class="btn-md bg-gray s-white f-font-18">已使用</button>
</div>
<div style="padding: 0 10px 20px;">
<p class="s-gray-1 f-font-11 f-mt20" style="line-height: 18px;">使用范围{{getData.authAreaStr}}</p>
<p class="f-mt10 f-font-11 s-orange-2">
使用流程领券下单关注公众号预约服务
</p>
<div class="f-text-center">
<div class="qrcode-img">
<img src="../assets/images/qrcode.png" width='100%' height="100%" alt="">
</div>
<p class="f-font-11 f-mt5 s-black-1">预约服务请关注公众号</p>
</div>
</div>
</div>
</div>
</template>
<script>
import couponModel from "../models/coupon-model";
import configs from "../configs";
import { Alert, Toast, Popup, Picker } from "vux";
import Qs from 'qs';
import Qs from "qs";
import homeApi from "../models/home-model.js";
import { isEmpty } from "@/common/util";
import chooseCommunityApi from "../models/choose-community";
var strCookie = document.cookie;
var cookieName = "1hjz_mall_login_access_token=";
@ -84,171 +86,224 @@ var token = strCookie.slice(cookieName.length);
var locationUrl = configs.locationUrl;
export default {
data() {
return {
uniqueId:this.$route.query.uniqueId,
loading: false,
getData: {},
couponType: {
"1": "定额券",
"2": "满减券",
"3": "折扣券"
},
batchNo: this.$route.query.batchNo
data() {
return {
uniqueId: this.$route.query.uniqueId,
loading: false,
getData: {},
couponType: {
"1": "定额券",
"2": "满减券",
"3": "折扣券"
},
batchNo: this.$route.query.batchNo
};
},
components: {
Toast,
Popup,
Picker
},
methods: {
//
handleInit() {
let that = this;
//
couponModel.getCouponInfo(that.batchNo, token).then(function(result) {
// console.log("xx",result.response);
that.loading = false;
if (result.code == 0) {
if (result.response.isLogin) {
that.sourceUser();
}
that.getData = result.response;
} else {
console.log(result.msg);
// alert(result.msg);
}
});
},
countExtend() {
return new Promise((resolve, reject) => {
var params = {
buryingPointType: 0,
salesmanUniqueIdentity: this.uniqueId,
timeStr: this.getTime(Date.now())
};
homeApi.countExtend(params).then(res => {
resolve();
});
});
},
components: {
Toast,
Popup,
Picker
getTime(time) {
let date = new Date(time);
let year = date.getFullYear();
let month = this.checkTime(date.getMonth() + 1);
let day = this.checkTime(date.getDate());
let str = year + "-" + month + "-" + day;
return str;
},
methods: {
//
handleInit() {
let that = this;
//
couponModel
.getCouponInfo(that.batchNo, token)
.then(function(result) {
// console.log("xx",result.response);
that.loading = false;
if (result.code == 0) {
if (result.response.isLogin) {
that.sourceUser();
}
that.getData = result.response;
} else {
console.log(result.msg);
// alert(result.msg);
}
});
},
countExtend() {
return new Promise((resolve, reject) => {
var params = {
buryingPointType: 0,
salesmanUniqueIdentity: this.uniqueId,
timeStr: this.getTime(Date.now())
};
homeApi.countExtend(params).then(res => {
resolve();
});
});
},
getTime(time) {
let date = new Date(time);
let year = date.getFullYear();
let month = this.checkTime(date.getMonth() + 1);
let day = this.checkTime(date.getDate());
let str =
year + "-" + month + "-" + day;
return str;
},
checkTime(i) {
if (i < 10) {
i = "0" + i;
}
return i;
},
// 使
handleUseCoupon() {
checkTime(i) {
if (i < 10) {
i = "0" + i;
}
return i;
},
// 使
handleUseCoupon() {
window.location.href =
locationUrl + "/mall/web/vgoods/detail/" + this.getData.goodsNo;
},
//
handleGetCoupon() {
let that = this;
this.loading = true;
let params = {
batchNo: that.batchNo
};
//
couponModel.giveCoupon(params, token).then(function(result) {
that.loading = false;
console.log("信息", result);
if (result.code === 0 || result.code === 3) {
that.$vux.toast.text("领取成功!", "middle");
that.handleInit();
} else if (result.code === 666) {
that.$vux.toast.text("您还没登录,请先登录!", "middle");
setTimeout(function() {
window.location.href =
locationUrl + "/mall/web/vgoods/detail/" + this.getData.goodsNo;
},
//
handleGetCoupon() {
let that = this;
this.loading = true;
let params = {
batchNo: that.batchNo
};
//
couponModel.giveCoupon(params, token).then(function(result) {
that.loading = false;
console.log("信息", result);
if (result.code === 0 || result.code === 3) {
that.$vux.toast.text("领取成功!", "middle");
that.handleInit();
} else if (result.code === 666) {
that.$vux.toast.text("您还没登录,请先登录!", "middle");
setTimeout(function() {
window.location.href =
locationUrl +
"/mall/web/user/login?callback=" +
encodeURIComponent(window.location.href);
}, 1000);
} else {
if (
result.msg === "" ||
result.msg === undefined ||
result.msg == null
) {
result.msg = "操作失败,请刷新重试";
}
alert(result.msg);
}
});
},
sourceUser() {
var sourceUserId = this.$route.query.sourceUserId;
if (sourceUserId) {
couponModel.sourceUser(sourceUserId).then(res => {});
}
locationUrl +
"/mall/web/user/login?callback=" +
encodeURIComponent(window.location.href);
}, 1000);
} else {
if (
result.msg === "" ||
result.msg === undefined ||
result.msg == null
) {
result.msg = "操作失败,请刷新重试";
}
alert(result.msg);
}
});
},
filters: {
numFilter(value) {
//
let transformVal = Number(value / 100).toFixed(1);
let realVal = transformVal.substring(0, transformVal.length - 1);
// num.toFixed(3)
return Number(realVal);
}
sourceUser() {
var sourceUserId = this.$route.query.sourceUserId;
if (sourceUserId) {
couponModel.sourceUser(sourceUserId).then(res => {});
}
},
mounted() {
// let uuniqueId = Qs.parse(location.search.substring(1)).uniqueId
var url = location.href.split('?')[0]
if(this.uniqueId === undefined || this.uniqueId === null || this.uniqueId === ""){
this.uniqueId = ''
}
//
this.handleInit();
// console.log('uniqueId:'+this.uniqueId)
return new Promise((resolve, reject) => {
var params = {
salesmanUniqueIdentity: this.uniqueId,
};
homeApi.updateUniqueId(params).then(res => {
this.showLoading = false;
if (res.code == 0) {
this.uniqueId=this.$cookies.get('1hjz_mall_unique_id')
if(this.uniqueId !== undefined && this.uniqueId !== null && this.uniqueId !== ""){
this.countExtend();
}
this.wxShare({
couponNo: this.batchNo,
source: 20,
url: encodeURIComponent(url)
});
} else {
this.$vux.toast.text(res.msg, "middle");
}
resolve();
});
});
defaultLocalEstate(estateRes) {
this.provinceId = estateRes.provinceId
? estateRes.provinceId
: this.provinceId;
this.cityId = estateRes.cityId ? estateRes.cityId : this.cityId;
this.districtId = estateRes.districtId
? estateRes.districtId
: this.districtId;
this.defaultCity = estateRes.districtName
? estateRes.districtName
: this.defaultCity;
this.merchantNo = estateRes.merchantNo;
this.addressValue = [
this.provinceId + "&" + estateRes.provinceName,
this.cityId + "&" + estateRes.cityName,
this.districtId +
"&" +
estateRes.districtName +
"&" +
estateRes.merchantNo
];
localStorage.setItem("cityName", this.addressValue.slice());
this.estateId = estateRes.housingEstateId
? estateRes.housingEstateId
: this.estateId;
this.defaultCommunity = estateRes.housingEstateName
? estateRes.housingEstateName
: this.defaultCommunity;
if (!isEmpty(this.estateId)) {
localStorage.setItem(
"estate",
this.estateId + "&" + this.defaultCommunity
);
}
}
},
filters: {
numFilter(value) {
//
let transformVal = Number(value / 100).toFixed(1);
let realVal = transformVal.substring(0, transformVal.length - 1);
// num.toFixed(3)
return Number(realVal);
}
},
mounted() {
// let uuniqueId = Qs.parse(location.search.substring(1)).uniqueId
var url = location.href.split("?")[0];
if (
this.uniqueId === undefined ||
this.uniqueId === null ||
this.uniqueId === ""
) {
this.uniqueId = "";
}
let eId = this.$route.query.estateId;
if (!isEmpty(eId)) {
return new Promise((resolve, reject) => {
chooseCommunityApi
.getEstateInfo({
estateId: eId
})
.then(res => {
if (isEmpty(res.response)) {
this.defaultLocalEstate(res.response);
}
})
.catch(error => {});
});
}
//
this.handleInit();
// console.log('uniqueId:'+this.uniqueId)
return new Promise((resolve, reject) => {
var params = {
salesmanUniqueIdentity: this.uniqueId
};
homeApi.updateUniqueId(params).then(res => {
this.showLoading = false;
if (res.code == 0) {
this.uniqueId = this.$cookies.get("1hjz_mall_unique_id");
if (
this.uniqueId !== undefined &&
this.uniqueId !== null &&
this.uniqueId !== ""
) {
this.countExtend();
}
this.wxShare({
couponNo: this.batchNo,
source: 20,
url: encodeURIComponent(url)
});
} else {
this.$vux.toast.text(res.msg, "middle");
}
resolve();
});
});
}
};
</script>
<style>
body {
background-color: #fff3e8;
background-color: #fff3e8;
}
</style>

1250
src/view/order-check.vue
File diff suppressed because it is too large
View File

Loading…
Cancel
Save