Authored by bevishuang

Merge branch 'develop' of http://git.yoho.cn/fe/xianyu-ufo-app-web into develop

... ... @@ -54,9 +54,6 @@ export default {
data() {
return {
options: {
// bounce: {
// top: false
// },
scrollbar: true,
pullUpLoad: true,
pullDownRefresh: true,
... ... @@ -90,7 +87,7 @@ export default {
searchParams: {
type: 0, // type:0,推荐;1,热销;2,即将发售; 3,品类; 4,品牌;5,系列;6,搜索 7, 收藏
order: '', // 指定排序
productPool: null, // 商品池id
productPool: null, // 商品池idfetchList
sort: null, // 品类id
brand: null, // 品牌id
series: null, // 系列id
... ... @@ -178,7 +175,7 @@ export default {
return;
}
if (typeof params === 'object' && Object.keys(params)) {
searchParams ={...params};
searchParams = {...params};
this.searchParams = searchParams;
}
... ... @@ -198,7 +195,7 @@ export default {
if (result.code === 200) {
data.endReached = (data.page === data.page_total) && (data.page_size !== 1);
data.endReached = (data.page === data.page_total) && (data.page_size !== 1) || !data.page_total;
}
if (typeof data === 'object' && Object.keys(data).length) {
... ...
... ... @@ -10,14 +10,9 @@
</template>
<script>
import Vue from 'vue'
import { Style, ScrollNavBar } from 'cube-ui';
import { createNamespacedHelpers } from 'vuex';
import queryString from 'query-string';
// const { mapState, mapActions } = createNamespacedHelpers('list/channel');
const {mapState, mapActions} = createNamespacedHelpers('list');
export default {
name: 'slide',
props: {
... ... @@ -28,39 +23,38 @@ export default {
current: {
type: Number,
default: true
}
},
},
data() {
return {
index: 0,
// current: this.list[0].title,
labels: [],
}
};
},
components: {
Style,
ScrollNavBar
},
computed: {
...mapState(['productList']),
},
mounted() {
this.list.map((res) => { this.labels.push(res.title) });
this.list.map((res) => {
this.labels.push(res.title);
});
},
created() {
},
methods: {
...mapActions(['fetchProductList']),
changeHandler(cur) {
let index = this.$refs[`getindex${cur}`].innerText;
let url = this.list[index].url.split("?");
let url = this.list[index].url.split('?');
let urlParams = queryString.parse(url[1]);
let params = urlParams;
params.isReset = true;
this.fetchProductList(params);
this.$emit('transfer',index);
console.log(params)
console.log(this.$parent);
this.$parent.$parent.$parent.fetchList && this.$parent.$parent.$parent.fetchList(params);
this.$emit('transfer', index);
}
}
};
... ...
... ... @@ -54,7 +54,10 @@ export default {
methods: {
...mapActions(['fetchNewsList', 'fetchNewsTabList']),
async onPullingUp() {
if (!this.newsList.isMoreData ) return false;
if (!this.newsList.isMoreData) {
this.$refs.scroll.forceUpdate();
return false
}
let params = {
type: '',
isPage: false
... ...
... ... @@ -52,12 +52,16 @@ export default {
methods: {
...mapActions(['fetchNewsList']),
async onPullingUp() {
if (!this.newsDeatilList.isMoreData ) return false;
if (!this.newsDeatilList.isMoreData ) {
this.$refs.scroll.forceUpdate();
return false
};
let params = {
type: this.type,
isPage: false
}
await this.fetchNewsList(params);
this.$refs.scroll.forceUpdate();
}
},
components: {
... ...
... ... @@ -156,7 +156,7 @@ export default {
if (result.code === 200) {
data.endReached = (data.page === data.page_total) && (data.page_size !== 1);
data.endReached = (data.page === data.page_total) && (data.page_size !== 1) || !data.page_total;
}
if (typeof data === 'object' && Object.keys(data).length) {
... ...
... ... @@ -14,8 +14,14 @@
<div class="productPrice">
<span class="size">{{sizeInfo}}</span>
<div class="pricedetail">
<span class="priceTitle">最低售价: </span>
<span class="price">{{originProductData.least_price || '-'}}</span>
<div>
<span class="priceTitle">最低售价: </span>
<span class="price">{{originProductData.least_price || '-'}}</span>
</div>
<div>
<span class="priceTitle">最高求购价: </span>
<span class="price">{{originProductData.bid_moster_price || '-'}}</span>
</div>
</div>
</div>
</div>
... ... @@ -97,7 +103,7 @@ export default {
return {
inputPrice: '',
isAgreeTerms: false,
url: `http://m.yohobuy.com/activity/student/detail/renzhen?openby:yohobuy={\"action\":\"go.h5\",\"params\":{\"url\":\"https://activity.yoho.cn/feature/3189.html?title=买家协议&promiseV="}}`,
url: 'http://m.yohobuy.com/activity/student/detail/renzhen?openby:yohobuy={\"action\":\"go.h5\",\"params\":{\"url\":\"https://activity.yoho.cn/feature/3189.html?title=买家协议&promiseV="}}',
agreeDesc: '有货买家协议'
};
},
... ... @@ -123,19 +129,29 @@ export default {
sizeInfo: {
get() {
return this.originProductData.colorName + ', ' + this.originProductData.sizeName + '码';// '黑色, 48码';
}
}
},
},
beforeRouteEnter (to, from, next) {
next(vm => {
// 通过 `vm` 访问组件实例
vm.inputPrice = '';
vm.BUYER_ASK_RESET_DATA();
});
},
mounted() {
this.BUYER_ASK_RESET_DATA();
this.BUYER_ASK_SET_STORAGEID(this.storageId);
this.fetchBuyerOrderCount({ tabType: 'buy'});
this.fetchConfig();
this.$on("addressinfo", function (address) {
console.log(address)
})
this.$on('addressinfo', function(address) {
console.log(address);
});
},
watch: {
... ... @@ -150,6 +166,14 @@ export default {
if (val) {
this.showDialog();
}
},
addressInfo(val) {
if (this.inputPrice && val) {
this.computePrice();
}
}
},
... ... @@ -173,7 +197,7 @@ export default {
if (this.originProductData.least_price && this.originProductData.skup && this.originProductData.least_price <= this.inputPrice) {
this.showBuyDialog();
} else {
this.buyerCompute({price: this.inputPrice, storage_id: this.storageId });
this.computePrice();
}
}, 500, {leading: false, trailing: true}),
... ... @@ -214,7 +238,7 @@ export default {
});
},
onCancel: () => {
this.buyerCompute({price: this.inputPrice, storage_id: this.storageId });
this.computePrice();
}
}).show();
},
... ... @@ -241,7 +265,7 @@ export default {
},
onConfirm: () => {
this.publishProduct()
this.publishProduct();
},
onCancel: () => {
... ... @@ -250,23 +274,32 @@ export default {
}).show();
} else {
this.publishProduct()
this.publishProduct();
}
},
submitClick() {
this.buyerPrePublish({price: this.inputPrice, storage_id: this.storageId, address_id: this.addressInfo.address_id});
this.buyerPrePublish({price: this.inputPrice, storage_id: this.storageId, address_id: this.addressInfo.address_id});
},
publishProduct() {
this.buyerPublish({price: this.inputPrice, storage_id: this.storageId, address_id: this.addressInfo.address_id, time_limit_id: this.chooseDayId}).then(() => {
this.buyerPublish({price: this.inputPrice, storage_id: this.storageId, address_id: this.addressInfo.address_id, time_limit_id: this.chooseDayId}).then(() => {
this.payOrder();
});
},
computePrice() {
if (!this.inputPrice) {
console.log('inputPrice is null')
return;
}
this.buyerCompute({price: this.inputPrice, storage_id: this.storageId, address_id: this.addressInfo.address_id || '' });
},
payOrder() {
let vm = this;
this.$createOrderPayType({
price: get(this.publishresult, 'depositAmount', ''),
desc: '保证金',
... ... @@ -372,11 +405,8 @@ export default {
}
.pricedetail {
display: flex;
flex-direction: row;
height: 30*2px;
margin-top: 5*2px;
align-items: flex-end;
}
.priceTitle {
... ...
... ... @@ -5,7 +5,7 @@
<div class="product-price">
<div class="product-price-wrapper">
<div class="price">{{data.colorName}},{{data.sizeName}}</div>
<div class="tip">最低售价:<span class="price2">¥{{data.goodPrice}}</span></div>
<div class="tip">{{ priceType || '最低售价:'}} <span class="price2">¥{{data.goodPrice}}</span></div>
</div>
</div>
</div>
... ... @@ -20,6 +20,9 @@ export default {
default() {
return {};
}
},
priceType: {
type: String,
}
}
};
... ...
... ... @@ -55,6 +55,7 @@
v-for="(imgUrl, i) in miniFaultConfirm.imageUrls"
:key="i"
>
<ImageFormat
:data-secc="imgUrl"
:src="imgUrl"
... ...
... ... @@ -3,7 +3,7 @@
<LayoutApp :show-back="true">
<div class="body">
<TitleComp txt="变现"></TitleComp>
<ProductInfo :data="originProductData" class="product-info"></ProductInfo>
<ProductInfo :data="originProductData" class="product-info" :priceType="'最高求购价'"></ProductInfo>
<div class="inputView">
<span class="inputViewIcon">
¥
... ...
... ... @@ -73,6 +73,7 @@ export default {
this.$emit('hidden');
},
shown() {
this.$emit('shown');
if (this._shownCallback) {
this.$nextTick(() => {
this._shownCallback();
... ...
... ... @@ -3,7 +3,7 @@
<div class="activity-sheet">
<h3>活动详情</h3>
<div class="list" >
<cube-scroll ref="activityListScroll">
<cube-scroll ref="activityListScroll" :data="list">
<ul>
<li v-for="(item, idx) in list" :key="idx">
<div><span>{{item.promotionTypeStr}}</span> {{item.activityName}}</div>
... ...
<template>
<action-sheet @hidden="onHidden" position="right" ref="popup"
<action-sheet position="right" ref="popup"
@hidden="onHidden"
@shown="onShown"
:panelStyle="{background: 'transparent', paddingLeft: '20%'}"
:hasBorderRadius="false"
:emulateMask="true">
... ... @@ -14,7 +16,7 @@
<div>{{productDetail.product_name}} {{goodsName}}</div>
</div>
<div class="size-list">
<cube-scroll>
<cube-scroll ref="scroll" :data="sizeViewList">
<ul>
<li :class="['size-item', item.available ? '': 'disable']" v-for="(item, idx) in sizeViewList" :key="idx" @click="buy(item)">
<div class="size"><span>{{item.name}}</span><span v-if="item.subName">{{item.subName}}</span></div>
... ... @@ -74,6 +76,7 @@ export default {
available: info.storage_num > 0 && price !== '-',
skup: info.skup,
least_price: info.least_price,
bid_moster_price: info.bid_moster_price,
};
});
},
... ... @@ -95,6 +98,12 @@ export default {
onHidden() {
this.$emit('hidden');
},
onShown() {
// refresh list
if (this.$refs.scroll) {
this.$refs.scroll.refresh();
}
},
buy(product) {
this.$yoho.auth()
.then(() => {
... ... @@ -111,6 +120,7 @@ export default {
* storageId: number
*/
this.$store.commit('order/buyerAskOrder/BUYER_ASK_SET_PRODUCTINFO', {
bid_moster_price: get(product, 'bid_moster_price', '-'),
least_price: get(product, 'least_price', '-'),
sizeName: product.name,
sizeId: get(data, 'sizeId', ''),
... ...
<template>
<div class="size-list">
<cube-scroll ref="sizeselectScroll">
<cube-scroll ref="sizeselectScroll" :data="viewList">
<ul>
<li v-for="(info, idx) in viewList"
:key="idx"
... ... @@ -34,7 +34,7 @@ export default {
name: 'size-list',
props: {
list: {
type: Array,
type: [Array, null],
required: true,
},
addSize: {
... ... @@ -82,13 +82,6 @@ export default {
return this.list.map(this.simplePriceMap);
},
},
mounted() {
this.$watch('list', () => {
this.refreshScroll();
}, {
immediate: true,
});
},
methods: {
priceMap(info) {
let price;
... ...
<template>
<action-sheet @hidden="onHidden" position="right" ref="popup">
<action-sheet @hidden="onHidden" @shown="onShown" position="right" ref="popup">
<div class="buy-sheet">
<div class="header">
<div class="back-wrapper flex" @touchend="onBack">
... ... @@ -10,7 +10,8 @@
<h1>添加尺码</h1>
<h3>请选择希望添加的尺码</h3>
</div>
<size-list :list="unusedSizeList"
<size-list ref="sizeList"
:list="unusedSizeList"
:multiple="true"
:simple-price="true"
:selected="selected"
... ... @@ -71,6 +72,11 @@ export default {
onHidden() {
this.$emit('hidden');
},
onShown() {
if (this.$refs.sizeList) {
this.$refs.sizeList.refreshScroll();
}
},
_requestSize() {
const sizeIds = this.selected.map(item => item.size_id).join(',');
... ...
<template>
<action-sheet @hidden="onHidden" ref="popup">
<action-sheet @hidden="onHidden" @shown="onShown" ref="popup">
<div class="size-select-sheet">
<div class="select-size">
<div class="title" @click="hide">{{config.title}}<i class="cubeic-close"></i></div>
... ... @@ -19,7 +19,8 @@
</div>
</div>
</div>
<size-list class="select-content size-list" :list="list"
<size-list class="select-content size-list" ref="sizeList"
:list="list"
:addSize="canAddSize"
:selected="selectedSize"
:config="config"
... ... @@ -146,6 +147,11 @@ export default {
onHidden() {
this.$emit('hidden');
},
onShown() {
if (this.$refs.sizeList) {
this.$refs.sizeList.refreshScroll();
}
},
onSelectSize({selected: sizeInfo}) {
this.updateTradeInfo({
productId: this.product.product_id,
... ... @@ -186,8 +192,9 @@ export default {
goodImg: get(this.product, 'goods_list[0].image_list[0].image_url', ''),
colorName: get(this.product, 'goods_list[0].color_name', ''),
sizeName: this.sizeName,
goodPrice: get(this.productDetail, 'least_price', 0),
productId: this.product.product_id
goodPrice: get(this.selectedSize, 'bid_moster_price', ''),
productId: this.product.product_id,
bid_moster_price: get(this.selectedSize, 'bid_moster_price', ''),
});
// 跳转变现
this.$router.push({
... ...
... ... @@ -6,10 +6,9 @@
</transition>
</LayoutHeader>
<div class="layout-context fixscroll">
<cube-scroll
<cube-scroll :data="imageList"
:scroll-events="['scroll']"
@scroll="handleScroll">
<div class="slide">
<cube-slide ref="slide" :data="imageList">
<cube-slide-item v-for="(item, index) in imageList" :key="index">
... ... @@ -21,7 +20,7 @@
<span class="dot" :class="{active: props.current === index}" v-for="(item, index) in props.dots">{{index + 1}}</span>
</template>
</cube-slide>
<div class="qiugou" @click="qiugou"></div>
<div class="qiugou" v-if="isQiugouEnabled" @click="qiugou"></div>
</div>
<div class="info">
... ... @@ -95,7 +94,7 @@
<script>
import { Button, Slide, Scroll, Popup } from 'cube-ui';
import { get } from 'lodash';
import { createNamespacedHelpers } from 'vuex';
import { createNamespacedHelpers, mapGetters } from 'vuex';
import ImgSize from '../../components/img-size';
import { getImgUrl } from '../../common/utils';
... ... @@ -152,6 +151,7 @@ export default {
};
},
computed: {
...mapGetters(['isQiugouEnabled']),
productDec() {
const goods = get(this.productDetail, 'goods_list[0]', {});
... ... @@ -194,7 +194,9 @@ export default {
},
mounted() {
this.imageHideThreadhold = -window.innerWidth * 0.693;
if (this.isQiugouEnabled === null) {
this.$store.dispatch('getSysConfigQiugou');
}
},
activated() {
if (this.productId !== this.productDetail.product_id) {
... ... @@ -292,11 +294,13 @@ export default {
type: 5,
};
if (this.productDetail.seriesId) {
if (this.productDetail.seriesId && this.productDetail.series_name) {
query.series = this.productDetail.seriesId;
query.title = this.productDetail.series_name;
} else {
query.type = 4;
query.brand = this.productDetail.brandId;
query.title = this.productDetail.brand_name;
}
this.$router.push({
... ...
... ... @@ -339,12 +339,13 @@ export default function() {
});
},
buyerCompute({commit}, {price = 0, storage_id = 0, uid} = {}) {
buyerCompute({commit}, {price = 0, storage_id = 0, uid, address_id = ''} = {}) {
commit(BUYER_ASK_COMPUTE_REQUEST);
this.$api.get('/api/order/buyeraskcompute', {
uid,
price,
storage_id,
address_id,
}).then(result => {
if (result.code === 200) {
... ...
... ... @@ -39,6 +39,11 @@ export default function(mergeState = {}) {
direction: 'forword',
homePage: true,
user: {},
// 系统配置
sysConfig: {
enableQiugou: null, // 是否启用求购,默认不启用, null: 初始状态标识,需要请求api, false: 不启用, true: 启用
}
},
mergeState,
),
... ... @@ -133,11 +138,17 @@ export default function(mergeState = {}) {
[Types.SET_USER_SELLER_INFO](state, sellerInfo) {
state.user.sellerInfo = sellerInfo || {};
},
[Types.UPDATE_SYSTEM_CONFIG_QIUGOU](state, { enabled }) {
state.sysConfig.enableQiugou = enabled;
},
},
getters: {
getLogin(state) {
return state.context.isLogin;
},
isQiugouEnabled(state) {
return state.sysConfig.enableQiugou;
},
},
actions: {
async fetchUserProfile({ commit }) {
... ... @@ -216,6 +227,26 @@ export default function(mergeState = {}) {
// pass
}
},
async getSysConfigQiugou({ commit, state }) {
// /ufo-gateway/?method=ufo.resource.getConfigTypeContent&code=bid_switch_h5
// {"alg":"SALT_MD5","code":200,"data":"1","md5":"c13a1ace2c5883be18643551bd17ebcd","message":"操作成功"}
// H5是否打开求购 1代表打开
let isEnabled = !!state.sysConfig.enableQiugou;
if (state.sysConfig.enableQiugou === null) {
const resp = await this.$api.get('/api/sys/config', {
code: 'bid_switch_h5',
});
if (resp.code === 200) {
isEnabled = resp.data === '1';
}
commit(Types.UPDATE_SYSTEM_CONFIG_QIUGOU, { enabled: isEnabled});
}
return isEnabled;
},
},
};
}
... ...
... ... @@ -15,5 +15,7 @@ export const SET_STATUS_BAR_HEIGHT = 'SET_STATUS_BAR_HEIGHT';
export const SET_STATUS_BAR_COLOR = 'SET_STATUS_BAR_COLOR';
export const SET_ACTION_BAR_HEIGHT = 'SET_ACTION_BAR_HEIGHT';
export const UPDATE_SYSTEM_CONFIG_QIUGOU = 'UPDATE_SYSTEM_CONFIG_QIUGOU';
export const FETCH_USER_INFO_FAILD = 'FETCH_USER_INFO_FAILD';
export const FETCH_USER_INFO_SUCCESS = 'FETCH_USER_INFO_SUCCESS';
... ...
... ... @@ -8,6 +8,7 @@ const buyerAskApi = require('./buyerask-api-map')
const orderListApi = require('./order-api-map');
const categoryApi = require('./category-api-map');
const sellerAskApi = require('./sellerask-api-map');
const systemApi = require('./system-api-map');
module.exports = {
...orderApi,
... ... @@ -20,4 +21,5 @@ module.exports = {
...orderListApi,
...categoryApi,
...sellerAskApi,
...systemApi,
};
... ...
module.exports = {
// 系统配置
// /ufo-gateway/?method=ufo.resource.getConfigTypeContent&code=bid_switch_h5
'/api/sys/config': {
ufo: true,
auth: false,
api: 'ufo.resource.getConfigTypeContent',
params: {
code: {type: String} // bid_switch_h5 是否启用求购
},
}
};
... ...