Browse Source

加入推广人员

feature/3.0.0-推广员
lfs3 6 years ago
parent
commit
80373704d5
11 changed files with 93 additions and 19 deletions
  1. 7
      package.json
  2. 9
      src/api/home.js
  3. 1
      src/common/util.js
  4. 4
      src/components/nav-bottom.vue
  5. 5
      src/main.js
  6. 8
      src/models/home-model.js
  7. 6
      src/models/wxShare.js
  8. 2
      src/router/index.js
  9. 67
      src/view/home.vue
  10. 1
      src/view/order-check.vue
  11. 2
      src/view/order-detail.vue

7
package.json

@ -11,12 +11,12 @@
}, },
"dependencies": { "dependencies": {
"axios": "^0.16.2", "axios": "^0.16.2",
"babel-polyfill": "^6.26.0",
"echarts": "^3.7.1", "echarts": "^3.7.1",
"element-ui": "^2.4.6", "element-ui": "^2.4.6",
"lodash": "^4.17.4", "lodash": "^4.17.4",
"vue": "^2.5.9", "vue": "^2.5.9",
"vue-awesome-swiper": "^3.1.3", "vue-awesome-swiper": "^3.1.3",
"vue-cookies": "^1.5.13",
"vue-router": "^2.8.1", "vue-router": "^2.8.1",
"vue-template-compiler": "^2.5.9", "vue-template-compiler": "^2.5.9",
"vue-weui": "^0.3.2", "vue-weui": "^0.3.2",
@ -26,8 +26,9 @@
"devDependencies": { "devDependencies": {
"autoprefixer": "^6.7.2", "autoprefixer": "^6.7.2",
"babel-core": "^6.26.0", "babel-core": "^6.26.0",
"babel-loader": "^6.2.10",
"babel-loader": "^6.4.1",
"babel-plugin-transform-runtime": "^6.22.0", "babel-plugin-transform-runtime": "^6.22.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.0", "babel-preset-env": "^1.6.0",
"babel-preset-stage-2": "^6.24.1", "babel-preset-stage-2": "^6.24.1",
"babel-register": "^6.26.0", "babel-register": "^6.26.0",
@ -47,7 +48,7 @@
"jquery": "^3.3.1", "jquery": "^3.3.1",
"less": "^2.7.1", "less": "^2.7.1",
"less-loader": "^2.2.3", "less-loader": "^2.2.3",
"node-sass": "^4.9.0",
"node-sass": "^4.12.0",
"opn": "^4.0.2", "opn": "^4.0.2",
"optimize-css-assets-webpack-plugin": "^1.3.2", "optimize-css-assets-webpack-plugin": "^1.3.2",
"ora": "^1.3.0", "ora": "^1.3.0",

9
src/api/home.js

@ -18,6 +18,13 @@ export default {
getLocation:{ getLocation:{
method:"get", method:"get",
url:"/mall/web/addressInfo" url:"/mall/web/addressInfo"
},
countExtend:{
method:"POST",
url:"/mall/web/center/insert/data"
},
updateUniqueId:{
method:"get",
url:"/mall/web/center/update/uniqueId"
} }
} }

1
src/common/util.js

@ -60,3 +60,4 @@ export default {
} }
} }

4
src/components/nav-bottom.vue

@ -5,11 +5,11 @@
<img v-else src="../assets/images/icon/home-s.png"> <img v-else src="../assets/images/icon/home-s.png">
<span>首页</span> <span>首页</span>
</router-link> </router-link>
<a class="service" href="/mall/web/appoint_index">
<a class="service" href="http://192.168.31.52:8080/mall/web/appoint_index">
<img src="../assets/images/icon/server.png" /> <img src="../assets/images/icon/server.png" />
<span>服务</span> <span>服务</span>
</a> </a>
<a class="user-center" href="/mall/web/owner">
<a class="user-center" href="http://192.168.31.52:8080/mall/web/owner">
<img src="../assets/images/icon/my.png" /> <img src="../assets/images/icon/my.png" />
<span>我的</span> <span>我的</span>
</a> </a>

5
src/main.js

@ -23,6 +23,7 @@ import "@/assets/styles/swiper.css";
//import wx from 'weixin-js-sdk' //import wx from 'weixin-js-sdk'
//import axios from 'axios' //import axios from 'axios'
import "@/models/wxShare.js"; import "@/models/wxShare.js";
import VueCookies from 'vue-cookies'
Vue.config.productionTip = false; Vue.config.productionTip = false;
Vue.use(WechatPlugin); Vue.use(WechatPlugin);
@ -30,6 +31,7 @@ Vue.use(ConfirmPlugin)
Vue.use(LoadingPlugin); Vue.use(LoadingPlugin);
Vue.use(ToastPlugin); Vue.use(ToastPlugin);
Vue.use(AlertPlugin); Vue.use(AlertPlugin);
Vue.use(VueCookies)
Vue.use(VueAwesomeSwiper); Vue.use(VueAwesomeSwiper);
Vue.mixin({ Vue.mixin({
@ -46,7 +48,8 @@ Vue.mixin({
setToken() { setToken() {
var strCookie = document.cookie; var strCookie = document.cookie;
var cookieName = "1hjz_mall_login_access_token="; var cookieName = "1hjz_mall_login_access_token=";
var token = strCookie.slice(cookieName.length);
// var token = strCookie.slice(cookieName.length);
var token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9'
sessionStorage.setItem("token", token); sessionStorage.setItem("token", token);
}, },
getParam(name) { getParam(name) {

8
src/models/home-model.js

@ -24,5 +24,13 @@ export default {
// headers: { // headers: {
// "x-forwarded-for": "113.65.207.218" // "x-forwarded-for": "113.65.207.218"
// } // }
}),
countExtend: params =>
utilsModel.config(homeApi.countExtend).request({
params: params
}),
updateUniqueId: params =>
utilsModel.config(homeApi.updateUniqueId).request({
params: params
}) })
}; };

6
src/models/wxShare.js

@ -11,9 +11,9 @@ Vue.prototype.wxShare = function(params) {
if (response.code != 0) { if (response.code != 0) {
return; return;
} }
var jsApiSignConfig = response.data.jsApiSignConfig;
var shareConfig = response.data.shareConfig;
var jsApiSignConfig = response.response.jsApiSignConfig;
var shareConfig = response.response.shareConfig;
wx.config({ wx.config({
debug: false, // 开启调试模式,开发时可以开启 debug: false, // 开启调试模式,开发时可以开启
appId: jsApiSignConfig.appId, // 必填,公众号的唯一标识 由接口返回 appId: jsApiSignConfig.appId, // 必填,公众号的唯一标识 由接口返回

2
src/router/index.js

@ -63,7 +63,7 @@ let router = new Router({
}, },
{ {
path: "/", path: "/",
redirect: "/home"
redirect: "/home/:uniqueId"
}, },
{ {
path: "/order-check", path: "/order-check",

67
src/view/home.vue

@ -65,9 +65,9 @@
</div> </div>
<ul class="card-list"> <ul class="card-list">
<li v-for="item1 in item.goodsList"> <li v-for="item1 in item.goodsList">
<a :href="'/mall/web/vgoods/detail/' + item1.goodsNo">
<a :href="'/mall/web/vgoods/detail/' + item1.goodsNo + '?uniqueId='+ uniqueId">
<div class="left"> <div class="left">
<a :href="'/mall/web/vgoods/detail/' + item1.goodsNo">
<a :href="'/mall/web/vgoods/detail/' + item1.goodsNo + '?uniqueId='+ uniqueId">
<img v-if="item1.goodsTitleImg!=''" :src=" imghost + item1.goodsTitleImg" /> <img v-if="item1.goodsTitleImg!=''" :src=" imghost + item1.goodsTitleImg" />
<img v-else-if="item1.showImg!=''" :src=" imghost + item1.showImg" /> <img v-else-if="item1.showImg!=''" :src=" imghost + item1.showImg" />
<img v-else :src=" imghost + item1.bannerImgs" /> <img v-else :src=" imghost + item1.bannerImgs" />
@ -86,7 +86,7 @@
<span class="price"> <em>{{item1.price ? item1.price/100:item1.originalPrice/100}}</em></span> <span class="price"> <em>{{item1.price ? item1.price/100:item1.originalPrice/100}}</em></span>
<span class="original-price" v-if="item1.price&&item1.price!=item1.originalPrice"><em>{{ item1.originalPrice/100}}</em></span> <span class="original-price" v-if="item1.price&&item1.price!=item1.originalPrice"><em>{{ item1.originalPrice/100}}</em></span>
</div> </div>
<a :href="'/mall/web/vgoods/detail/' + item1.goodsNo">立即购买</a>
<a :href="'/mall/web/vgoods/detail/' + item1.goodsNo + '?uniqueId='+ uniqueId">立即购买</a>
</div> </div>
</div> </div>
</a> </a>
@ -118,6 +118,8 @@ import configs from "../configs";
import { Alert, Toast, Loading } from "vux"; import { Alert, Toast, Loading } from "vux";
import routerFooter from "../components/nav-bottom"; import routerFooter from "../components/nav-bottom";
import popupPicker from "../components/popup-picker.vue"; import popupPicker from "../components/popup-picker.vue";
import Qs from 'qs';
var locationUrl = configs.locationUrl; var locationUrl = configs.locationUrl;
export default { export default {
@ -131,6 +133,7 @@ export default {
data() { data() {
return { return {
show: false, show: false,
uniqueId:Qs.parse(location.search.substring(1)).uniqueId,
defaultCity: "天河区", // defaultCity: "天河区", //
merchantNo: 2, // merchantNo: 2, //
districtId: "440106000", //id districtId: "440106000", //id
@ -245,10 +248,39 @@ export default {
var merchantNo = this.merchantNo; var merchantNo = this.merchantNo;
this.wxShare({ this.wxShare({
merchantNo: merchantNo, merchantNo: merchantNo,
uniqueId:this.uniqueId,
source: 0, source: 0,
url: encodeURIComponent(location.href) url: encodeURIComponent(location.href)
}); });
}, },
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;
},
// //
goods(c_no) { goods(c_no) {
this.$router.push({ this.$router.push({
@ -269,10 +301,10 @@ export default {
cityId: this.cityId ? this.cityId : "" cityId: this.cityId ? this.cityId : ""
}) })
.then(res => { .then(res => {
if (res.data.allAddress && res.data.userAddress) {
this.addressData = res.data.allAddress;
if (res.response.allAddress && res.response.userAddress) {
this.addressData = res.response.allAddress;
this.flag = true; this.flag = true;
let data = res.data;
let data = res.response;
if (data.userAddress.type == 1) { if (data.userAddress.type == 1) {
this.address = this.address =
data.userAddress.cityName + data.userAddress.cityName +
@ -380,7 +412,28 @@ export default {
// this.getAddress(); // this.getAddress();
// this.getLocation(); // this.getLocation();
this.getData(); this.getData();
this.ShareWenXin();
let uuniqueId = Qs.parse(location.search.substring(1)).uniqueId
if(uuniqueId !== undefined && uuniqueId !== null && uuniqueId !== ""){
this.countExtend();
uuniqueId = '';
}
return new Promise((resolve, reject) => {
var params = {
salesmanUniqueIdentity: uuniqueId,
};
homeApi.updateUniqueId(params).then(res => {
this.showLoading = false;
if (res.code == 0) {
this.uniqueId=this.$cookies.get('1hjz_mall_unique_id')
this.ShareWenXin();
} else {
this.$vux.toast.text(res.msg, "middle");
}
resolve();
});
});
} }
}; };
</script> </script>

1
src/view/order-check.vue

@ -249,6 +249,7 @@ export default {
goodsNo: goodsNo, goodsNo: goodsNo,
couponNo: couponNo, couponNo: couponNo,
goodsVersion: goodsVersion, goodsVersion: goodsVersion,
salesmanUniqueIdentity:this.$cookies.get('1hjz_mall_unique_id'),
remark: this.info.text remark: this.info.text
}) })
) )

2
src/view/order-detail.vue

@ -310,9 +310,9 @@ export default {
let promise = new Promise((resolve, reject) => { let promise = new Promise((resolve, reject) => {
orderApi orderApi
.addOrder({ .addOrder({
goodsNo: goodsNo,
goodsNo: goodsNo, goodsNo: goodsNo,
couponNo: couponNo, couponNo: couponNo,
salesmanUniqueIdentity: this.$cookies.get('1hjz_mall_unique_id'),
goodsVersion: this.info.goodsVersion goodsVersion: this.info.goodsVersion
}) })
.then(res => { .then(res => {

Loading…
Cancel
Save