Authored by Tao

modify news pages

... ... @@ -19,6 +19,8 @@
<div class="coupon-time">{{item.coupon_validity}}</div>
</div>
<Check class="check" :value="item.selected === 'Y'"></Check>
<div class="time-up" v-if="item.is_expired_soon === 'Y'"></div>
</div>
</div>
</slot>
... ... @@ -115,6 +117,7 @@ export default {
align-items: center;
background: url(~statics/image/order/bg@3x.png) no-repeat;
background-size: cover;
position: relative;
}
.check {
... ... @@ -179,4 +182,15 @@ export default {
font-size: 22px;
color: #999;
}
.time-up {
background: url(~statics/image/coupon/time-up@3x.png) no-repeat;
background-size: cover;
position: absolute;
top: 0;
right: 0;
width: 80px;
height: 80px;
}
</style>
... ...
... ... @@ -52,13 +52,14 @@ Vue.use(ConfirmDialog);
initClient(store);
xianyu.$router = router;
yoho.auth = async loginUrl => {
yoho.auth = async (args) => {
let { refer, loginUrl } = args || {};
let user = await sdk.getUser(true);
if (user && user.uid) {
return user;
} else {
cookie.set('third_backurl', location.href, {
cookie.set('third_backurl', refer || location.href, {
domain: '.yohobuy.com',
path: '/',
});
... ...
... ... @@ -27,9 +27,7 @@
:data-item="JSON.stringify(item)"
:data-add="0"
@click="toEditorPage"
>
编辑
</div>
>编辑</div>
</div>
<p class="address">{{ item.area }}{{ item.address }}</p>
</div>
... ... @@ -47,7 +45,10 @@
import Layout from "../../../components/layout/layout-app";
import { get } from "lodash";
import { Scroll, Loading } from "cube-ui";
import { SET_USER_ADDRESS_INFO } from "store/address/address/types";
import {
SET_USER_ADDRESS_INFO,
STORE_UPDATE_ADDRESS_INFO
} from "store/address/address/types";
import { createNamespacedHelpers } from "vuex";
const { mapState, mapMutations, mapActions } = createNamespacedHelpers(
... ... @@ -74,7 +75,7 @@ export default {
...mapState(["addressList"])
},
methods: {
...mapMutations({ SET_USER_ADDRESS_INFO }),
...mapMutations(["SET_USER_ADDRESS_INFO", "STORE_UPDATE_ADDRESS_INFO"]),
...mapActions(["fetchUserAddressList"]),
toOrderPage(item) {
this.SET_USER_ADDRESS_INFO(item);
... ... @@ -101,10 +102,10 @@ export default {
}
}
this.STORE_UPDATE_ADDRESS_INFO(item);
this.$router.push({
name: "addressEdit",
params: {
item: item,
update: !isAdd
}
});
... ...
... ... @@ -11,7 +11,12 @@
></CInput>
</FormItem>
<FormItem>
<CInput label="手机号" place-holder="请填写手机号" v-model="model.mobile" :textValue="model.mobile"></CInput>
<CInput
label="手机号"
place-holder="请填写手机号"
v-model="model.mobile"
:textValue="model.mobile"
></CInput>
</FormItem>
<template>
... ... @@ -62,7 +67,9 @@
checked="model.is_default"
v-model="model.is_default"
></Radio>
<div v-if="isUpdate" class="del-address" @click="delAddress">删除地址</div>
<div v-if="isUpdate" class="del-address" @click="delAddress">
删除地址
</div>
</div>
<div :class="submitClass" @touchend="onSubmit">确 认</div>
... ... @@ -129,7 +136,7 @@ export default {
}
},
computed: {
...mapState(["addressTags"]),
...mapState(["addressTags", "updateAddressInfo"]),
submitClass() {
return [
"sure-btn",
... ... @@ -294,7 +301,7 @@ export default {
},
activated() {
let { update, title, item, code } = this.$route.params;
let { update, item, code } = this.$route.params;
// 订单编辑 不查标签
if (!code) {
this.fetchAddressTags();
... ... @@ -302,17 +309,20 @@ export default {
this.isUpdate = update;
this.title = update ? "编辑地址" : "添加地址";
let addressInfo = this.updateAddressInfo;
if (update) {
item = JSON.parse(item || "{}");
this.updateMobileNum = item.mobile;
this.model.consignee = item.consignee;
this.model.address_id = item.address_id;
this.model.mobile = item.mobile;
this.model.area_code = item.area_code || item.areaCode;
this.model.area = item.area;
this.model.address = item.address;
this.model.tag_code = item.tag_code;
this.model.is_default = item.is_default === "Y" ? true : false;
addressInfo = JSON.parse(addressInfo || "{}");
this.updateMobileNum = addressInfo.mobile;
this.model.consignee = addressInfo.consignee;
this.model.address_id = addressInfo.address_id;
this.model.mobile = addressInfo.mobile;
this.model.area_code = addressInfo.area_code || addressInfo.areaCode;
this.model.area = addressInfo.area;
this.model.address = addressInfo.address;
this.model.tag_code = addressInfo.tag_code;
this.model.is_default = addressInfo.is_default === "Y" ? true : false;
} else {
this.model = {};
}
... ...
... ... @@ -33,7 +33,9 @@ export default {
break;
}
case 2: {
this.$yoho.auth().then((res) => {
this.$yoho.auth({
refer: '/xianyu/index/news'
}).then((res) => {
if(res) {
this.go('NewsPage');
}
... ... @@ -41,7 +43,9 @@ export default {
break;
}
case 3: {
this.$yoho.auth().then((res) => {
this.$yoho.auth({
refer: '/xianyu/index/mine'
}).then((res) => {
if(res) {
this.go('MinePage');
}
... ...
... ... @@ -143,7 +143,7 @@ export default {
compute() {
return this.computeOrder({
skup: this.productDetail.skup,
addressId: this.address.address_id,
addressId: this.address?.address_id,
couponCode: get(this.orderDetail, 'recommendedCouponInfo.coupon_code', ''),
promotionId: get(this.orderDetail, 'promotionTips.promotionIds', '')
}).then(result => {
... ...
... ... @@ -38,7 +38,7 @@ export default {
this.$router.push({
name: 'address',
query: {
address_id: this.data.address_id
address_id: this.data?.address_id
}
});
}
... ...
... ... @@ -82,7 +82,7 @@ export default {
},
compute() {
return this.fetchOrderPrice({
address_id: this.address.address_id,
address_id: this.address?.address_id,
num: this.num,
price: this.price,
storage_id: this.storageId,
... ...
/* eslint-disable no-unused-vars */
import * as Types from './types';
import {
get
} from 'lodash';
import { get } from 'lodash';
export default {
// 获取用户地址列表
async fetchUserAddressList({
commit
}) {
async fetchUserAddressList({ commit }) {
const result = await this.$api.get('/api/address/gethidden');
if (result.code === 200) {
commit(Types.FETCH_USER_ADDRESS_LIST, {
list: get(result, 'data', [])
list: get(result, 'data', []),
});
}
},
// 获取地址标签
async fetchAddressTags({
commit
}) {
async fetchAddressTags({ commit }) {
const result = await this.$api.get('/api/address/getTags');
if (result.code === 200) {
commit(Types.FETCH_ADDRESS_TAGS, {
list: get(result, 'data', [])
list: get(result, 'data', []),
});
}
},
async fetchAddressProvinces({
commit
}, id) {
async fetchAddressProvinces({ commit }, id) {
let result = {};
try {
... ... @@ -48,9 +40,7 @@ export default {
},
// 添加、更新、删除地址,post请求
async addUserAddress({
commit
}, data) {
async addUserAddress({ commit }, data) {
const result = await this.$api.post('/api/address/addAddress', {
address: data.address,
area_code: data.area_code,
... ... @@ -63,9 +53,7 @@ export default {
return result || {};
},
async updateUserAddress({
commit
}, data) {
async updateUserAddress({ commit }, data) {
const result = await this.$api.post('/api/address/updateAddress', {
id: data.id,
address: data.address,
... ... @@ -79,9 +67,7 @@ export default {
return result || {};
},
async deleteUserAddress({
commit
}, addressId) {
async deleteUserAddress({ commit }, addressId) {
const result = await this.$api.post('/api/address/delAddress', {
id: addressId,
});
... ... @@ -90,9 +76,7 @@ export default {
},
// 设置默认地址, post请求 ---- 暂时用不到这个
async setDefaultAddress({
commit
}) {
async setDefaultAddress({ commit }) {
const result = await this.$api.post('/api/address/setDefaultAddress');
if (result.code === 200) {
... ... @@ -101,4 +85,7 @@ export default {
return result || {};
},
// 订单更新收货地址
async updateReceiptAddressInOrder({ commit }) {},
};
... ...
... ... @@ -8,7 +8,8 @@ export default function () {
addressList: [],
addressTags: [],
provincesList: [],
addressInfo: {}
addressInfo: {},
updateAddressInfo: {}
},
actions,
mutations,
... ...
... ... @@ -23,5 +23,8 @@ export default {
this.state.order.orderConfirm.address = addressInfo;
this.state.order.buyerAskOrder.addressInfo = addressInfo;
this.state.order.sellerAskOrder.addressInfo = addressInfo;
},
[Types.STORE_UPDATE_ADDRESS_INFO](state, addressInfo) {
state.updateAddressInfo = addressInfo || {};
}
};
... ...
... ... @@ -9,3 +9,4 @@ export const DELETE_USER_ADDRESSINFO_SUCCESS = 'DELETE_USER_ADDRESSINFO_SUCCESS'
export const SET_DEFAULT_ADDRESS = 'SET_DEFAULT_ADDRESS';
export const SET_USER_ADDRESS_INFO = 'SET_USER_ADDRESS_INFO';
export const STORE_UPDATE_ADDRESS_INFO = 'STORE_UPDATE_ADDRESS_INFO';
... ...
... ... @@ -20,6 +20,10 @@ export const UserType = {
buy: 'buy'
};
const COUPON_TYPE = {
HUO_DONG: 100
};
export default function() {
return {
namespaced: true,
... ... @@ -97,6 +101,15 @@ export default function() {
state.orderDetail.recommendedCouponInfo.coupon_code =
filter(get(state.orderDetail, 'couponList', []), { selected: 'Y' }).map(i => i.coupon_code).join(',');
// 清除促消活动
if (item.coupon_type === COUPON_TYPE.HUO_DONG) {
get(state.orderDetail, 'promotionList', []).forEach(i => {
i.selected = 'N';
});
state.orderDetail.promotionTips.promotionIds = '';
}
}
},
[Types.CHANGE_SELECT_PROMOTION](state, { promotionId }) {
... ... @@ -117,6 +130,14 @@ export default function() {
});
item.selected = 'Y';
state.orderDetail.promotionTips.promotionIds = promotionId;
// 清除活动优惠券
get(state.orderDetail, 'couponList', []).filter(i => i.coupon_type === COUPON_TYPE.HUO_DONG).forEach(i => {
i.selected = 'N';
});
state.orderDetail.recommendedCouponInfo.coupon_code =
filter(get(state.orderDetail, 'couponList', []), { selected: 'Y' }).map(i => i.coupon_code).join(',');
}
}
... ...
... ... @@ -92,7 +92,7 @@ export default {
async getSelectedTradeProduct({ state, commit, dispatch }, { productId, storageId }) {
productId = parseInt(productId, 10);
storageId = parseInt(storageId, 10);
if (state.selectedProductInfo.productId !== productId && state.product.product_id !== productId) {
if (state.selectedProductInfo.productId !== productId && !state.products[productId]) {
await dispatch('fetchProductInfo', { productId });
}
... ...
... ... @@ -28,7 +28,7 @@ export default {
},
[Types.UPDATE_PRODUCT_DETAIL](state, payload) {
state.products = {...state.products, [payload.product_id]: payload};
ensureSelectedProduct(state, state.product.product_id);
ensureSelectedProduct(state, payload.product_id);
},
[Types.UPDATE_PRODUCT_TOP3](state, { productId, topList }) {
state.topLists = {...state.topLists, [productId]: topList};
... ...
... ... @@ -2,38 +2,49 @@ module.exports = {
'/api/address/gethidden': {
auth: true,
api: 'app.address.gethidden',
auth: true,
params: {}
params: {},
},
'/api/address/getTags': {
auth: true,
api: 'app.address.getTags',
params: {}
params: {},
},
'/api/address/getProvinces': {
auth: true,
api: 'app.address.provinces',
params: {}
params: {},
},
'/api/address/addAddress': {
auth: true,
api: 'app.address.add',
params: {}
params: {},
},
'/api/address/updateAddress': {
auth: true,
api: 'app.address.update',
params: {}
params: {},
},
'/api/address/delAddress': {
auth: true,
api: 'app.address.del',
params: {}
params: {},
},
'/api/address/setDefaultAddress': {
auth: true,
api: 'app.address.setdefault',
params: {}
params: {},
},
'ufo.buyer.modifyAddress': {
auth: true,
api: 'ufo.buyer.modifyAddress',
params: {
tabType: { type: String, require: true },
orderCode: { type: Number, require: true },
mobile: { type: String, require: true },
consignee: { type: String, require: true },
area: { type: Number, require: true },
areaCode: { type: String, require: true },
address: { type: String, require: true },
},
},
};
... ...
... ... @@ -45,7 +45,9 @@ module.exports = (req, res, next) => {
}
// Todo 删除 600032996 调价: 500031170 购买: 600043484
// req.user.uid = 600043484;
// 入住商家 50000638
// 梅 500031928
// req.user.uid = 600032996;
res.locals.isLogin = Boolean(req.user.uid); // 用户是否登录
if (_.get(req, 'user.appSessionType') === 'miniapp') {
... ...
... ... @@ -115,6 +115,8 @@ class passportModel extends global.yoho.BaseModel {
domain: 'yohobuy.com',
expires: new Date(Date.now() + 2592000000) // 有效期一年
});
}).catch(e => {
log.info(`[sync profile error] uid: ${uid} | err: ${JSON.stringify(e)}`);
});
}
sendTaobaoBindCode(mobile) {
... ...