Authored by 邱骏

求购调价

... ... @@ -38,10 +38,14 @@ export default {
if (!setTitle) {
return this.title;
}
if (this.title) {
setTitle(this.title);
this.$xianyu.setXianyuTitle({ title: this.title });
}
setTimeout(() => {
if (this.title) {
setTitle(this.title);
this.$xianyu.setXianyuTitle({ title: this.title });
}
}, 100);
this.setTitle = setTitle;
},
computed: {
... ...
... ... @@ -9,7 +9,6 @@
@scroll="scrollHandler"
:options="options"
@pulling-up="onPullingUp"
@pulling-down="onPullingDown"
:data="productList.list">
<div class="channel-body" ref="body">
<div ref="topSource" class="channel-html">
... ... @@ -57,9 +56,9 @@ export default {
scrollbar: true,
pullUpLoad: true,
// pullDownRefresh: true,
pullDownRefresh: {
txt: '刷新成功',
}
// pullDownRefresh: {
// txt: '刷新成功',
// }
},
scrollEvents: ['scroll'],
scrollY: 0,
... ... @@ -217,12 +216,12 @@ export default {
}
},
onPullingDown() {
let params = this.searchParams;
// onPullingDown() {
// let params = this.searchParams;
params.isReset = true;
this.fetchList(params);
},
// params.isReset = true;
// this.fetchList(params);
// },
},
components: {
Swiper,
... ...
... ... @@ -7,10 +7,9 @@
@pulling-up="onPullingUp"
:data="newsList.list">
<div class="news-content">
<Tab
v-if="newsList.tabList.length > 0" :list="newsList.tabList"></Tab>
<List v-if="newsList.list.length > 0" :list="newsList && newsList.list || []"></List>
<UfoNoItem v-else :tip="`暂无数据`" style="margin-6op: 50px"></UfoNoItem>
<Tab v-if="newsList.tabList.length > 0" :list="newsList.tabList || []"></Tab>
<List v-if="newsList.list && newsList.list.length > 0" :list="newsList.list || []"></List>
<UfoNoItem v-else :tip="`暂无数据`" style="margin-top: 60px"></UfoNoItem>
</div>
</Scroll>
</div>
... ... @@ -30,38 +29,74 @@ export default {
props: ['hideHeader'],
data() {
return {
msg: '消息',
options: {
pullUpLoad: true
pullUpLoad: true,
// pullUpLoad: {
// threshold: 100,
// txt: {
// txt: '加载中...',
// noMore: '~ 已经到底啦 ~',
// visible: false,
// }
// }
},
newsList: {
list: [],
tabList: [],
page: 0,
totalPage: 0,
isMoreData: true,
},
params: {
type: '',
isResetPage: true,
page: 1,
limit: 10,
},
msg: '消息',
};
},
computed: {
...mapState(['newsList']),
},
activated() {
let params = {
type: '',
isPage: true
};
this.fetchNewsList(params);
this.fetchNewsTabList();
this.fetchList();
this.fetchTabList();
},
mounted() {
},
created() {
},
methods: {
...mapActions(['fetchNewsList', 'fetchNewsTabList']),
async fetchList() {
let result = await this.fetchNewsList({ ...this.params });
if (result.code && result.code == 200) {
if (!this.newsList.isMoreData) return;
this.newsList.list = this.newsList.list.concat(result.data.list);
this.params.page = this.params.page + 1;
this.newsList.page = result.data.page;
this.newsList.totalPage = result.data.totalPage;
if (this.newsList.page < this.newsList.totalPage) {
this.newsList.isMoreData = true;
} else {
this.newsList.isMoreData = false;
}
}
},
async fetchTabList() {
let result = await this.fetchNewsTabList();
if (result.code && result.code == 200) {
this.newsList.tabList = result.data;
}
},
async onPullingUp() {
if (!this.newsList.isMoreData) {
this.$refs.scroll.forceUpdate();
return false
this.$refs.scroll.forceUpdate()
return;
}
let params = {
type: '',
isPage: false
};
await this.fetchNewsList(params);
this.fetchList(this.params);
this.$refs.scroll.forceUpdate();
},
},
... ...
... ... @@ -5,10 +5,10 @@
ref="scroll"
:options="options"
@pulling-up="onPullingUp"
:data="newsDeatilList.list">
:data="newsList.list">
<div class="news-content">
<Title :title="title"></Title>
<List v-if="newsDeatilList.list && newsDeatilList.list.length > 0" :list="newsDeatilList && newsDeatilList.list || []" :isTitle="false"></List>
<List v-if="newsList.list && newsList.list.length > 0" :list="newsList.list || []"></List>
<UfoNoItem v-else :tip="`暂无数据`" style="margin-top: 60px"></UfoNoItem>
</div>
</Scroll>
... ... @@ -28,38 +28,68 @@ export default {
data() {
return {
options: {
pullUpLoad: true
pullUpLoad: true,
// pullUpLoad: {
// threshold: 100,
// txt: {
// more: '加载中...',
// noMore: '~ 已经到底啦 ~'
// }
// }
},
title: '',
type: '',
newsList: {
list: [],
tabList: [],
page: 0,
totalPage: 0,
isMoreData: true,
},
params: {
type: '',
isResetPage: true,
page: 1,
limit: 10,
},
}
},
computed: {
...mapState(['newsList','newsDeatilList']),
},
activated() {
let params = {
type: this.type,
isPage: true
}
this.fetchNewsList(params);
this.fetchList(this.params);
},
created() {
// this.fetchList(this.params);
this.title = this.$route.query.description;
this.type = this.$route.query.type;
this.params.type = this.$route.query.type;
},
methods: {
...mapActions(['fetchNewsList']),
async fetchList() {
let result = await this.fetchNewsList({ ...this.params });
if (result.code && result.code == 200) {
if (!this.newsList.isMoreData) return;
this.newsList.list = result.data.totalPage == 0 ? this.newsList.list : this.newsList.list.concat(result.data.list);
this.params.page = this.params.page + 1;
this.newsList.page = result.data.page;
this.newsList.totalPage = result.data.totalPage;
if (this.newsList.page < this.newsList.totalPage) {
this.newsList.isMoreData = true;
} else {
this.newsList.isMoreData = false;
}
}
},
async onPullingUp() {
if (!this.newsDeatilList.isMoreData ) {
this.$refs.scroll.forceUpdate();
return false
};
let params = {
type: this.type,
isPage: false
}
await this.fetchNewsList(params);
if (!this.newsList.isMoreData) {
this.$refs.scroll.forceUpdate()
return;
}
this.fetchList(this.params);
this.$refs.scroll.forceUpdate();
}
},
... ...
... ... @@ -65,20 +65,11 @@ export default {
};
},
activated() {
let params = this.$route.query;
let params = {...this.$route.query};
if (this.yoho.direction === 'forword') {
Object.assign(this.$data, this.$options.data());
}
if (Object.keys(params).length && params.listType) {
this.listType = params.listType;
delete params.listType;
}
if (Object.keys(params).length && params.type) {
this.type = params.type;
} else {
params.type = 6;
}
!params.order && (params.order = 'sale_desc');
this.fetchData(params);
},
... ... @@ -124,9 +115,11 @@ export default {
},
submit() {
let routeParams = this.$route.query;
this.copyFilterParams = {...this.filterParams};
let params = {
sort: this.filterParams.sort.join(','),
sort: this.filterParams.sort.join(',') || routeParams.sort,
brand: this.filterParams.brand.join(','), // 品牌id
gender: this.filterParams.gender.join(','), // 性别
size: this.filterParams.size.join(','), // 尺码id
... ... @@ -139,6 +132,7 @@ export default {
});
params.isReset = true;
this.$parent.fetchList(params);
this.$parent.$refs.scroll.scrollTo(0, 0, 300)
this.hide();
},
... ...
... ... @@ -18,7 +18,7 @@
<div class="search-img" @click="goSearch()"></div>
</div>
</div>
<Scroll class="product-list" v-show="!productList.isEmpty"
<Scroll ref="scroll" class="product-list" v-show="!productList.isEmpty"
:options="scrollOptions"
:data="productList.list"
@pulling-up="onPullingUp">
... ... @@ -57,11 +57,9 @@ export default {
pullUpLoad: true
},
fixed: false,
selectedType: 2,
selectedType: 2, // tab类型高亮
priceDesc: true,
arrowImage: '',
listType: 1,
type: 6,
title: '',
productList: {
showErrorPage: false,
... ... @@ -98,7 +96,7 @@ export default {
Object.assign(this.$data, this.$options.data());
}
this.changeArrow();
let params = this.$route.query;
let params = {...this.$route.query};
if (params.title) {
this.title = params.title;
... ... @@ -106,13 +104,6 @@ export default {
} else {
this.title = '商品列表';
}
if (Object.keys(params).length && params.listType) {
this.listType = params.listType;
delete params.listType;
}
if (Object.keys(params).length && params.type) {
this.type = params.type;
}
!params.order && (params.order = 'sale_desc');
this.fetchList({...params, isReset: true});
},
... ... @@ -183,38 +174,34 @@ export default {
}
},
// 点击tab type, 0: 推荐, 1: 价格, 2: 人气, 3: 新品
pressType(type) {
if (type === this.selectedType && type !== 1) {
// 点击tab flag, 0: 推荐, 1: 价格, 2: 人气, 3: 新品
pressType(flag) {
if (flag === this.selectedType && flag !== 1) {
return;
}
let filterParams = this.$refs.filtrate.getParams();
let {sort} = this.searchParams;
let params = {
type: this.type,
sort: filterParams.sort.join(','),
sort: filterParams.sort.join(',') || sort,
brand: filterParams.brand.join(','), // 品牌id
gender: filterParams.gender.join(','), // 性别
size: filterParams.size.join(','), // 尺码id
};
if (this.listType === 4) {
delete params.type;
}
this.selectedType = type;
if (type === 1) {
this.selectedType = flag;
if (flag === 1) {
this.priceDesc = !this.priceDesc;
params.order = this.priceDesc ? 'p_desc' : 'p_asc';
} else if (type === 2) {
} else if (flag === 2) {
this.priceDesc = true;
params.order = 'sale_desc';
} else if (type === 3) {
} else if (flag === 3) {
this.priceDesc = true;
params.order = 'st_desc';
}
params.listType = this.listType;
params.isReset = true;
this.fetchList(params);
this.$refs.scroll.scrollTo(0, 0, 300)
this.changeArrow();
},
goSearch() {
... ...
... ... @@ -28,10 +28,17 @@ export default {
default() {
return false;
}
},
url: {
type: String,
default: ''
}
},
methods: {
onClick() {
if (this.url) {
this.$xianyu.goXianyuNewPage({url: this.url});
}
}
}
};
... ...
... ... @@ -185,7 +185,7 @@ export default {
// footer高度120px
padding: 0 40px;
-webkit-box-orient: vertical;
height: calc(100vh - 210px);
height: calc(100vh - 120px);
overflow-x: hidden;
overflow-y: auto;
font-size: 24px;
... ...
... ... @@ -36,25 +36,29 @@ export default {
components: {
Scroll
},
props: {
status: {
type: Number
},
owner: {
type: String
}
},
computed: {
...mapState(["currentStatus", "routeParamStatus"]),
...mapState(["routeParamStatus"]),
statusList: function() {
const { owner } = this.$route.params;
return owner === ownType.BUY
return this.owner === ownType.BUY
? buyerOrderStatusList
: sellerOrderStatusList;
},
status() {
return this.currentStatus || this.routeParamStatus;
}
},
methods: {
...mapMutations(["setOrderStatus", "resetPartialData"]),
...mapActions(["fetchOrderList"]),
onHandleClick(status) {
this.setOrderStatus(status);
this.$emit("change", status);
this.resetPartialData();
const { owner } = this.$route.params;
const { owner } = this;
this.fetchOrderList({ owner, status });
}
}
... ...
... ... @@ -122,7 +122,7 @@ export default {
}
},
mounted() {
// this.showPlayer();
this.showPlayer();
},
beforeDestroy() {
if (this.player) {
... ... @@ -131,9 +131,7 @@ export default {
},
methods: {
async parentHandleclick() {
this.showPlayer();
await this.delay(1000);
// await this.delay(1000);
this.player.play();
const timeId = setTimeout(() => {
... ...
... ... @@ -71,7 +71,12 @@ export default {
options: function() {
return {
pullUpLoad: this.pullUpLoad,
pullDownRefresh: true
pullDownRefresh: this.isShowEmpty
? false
: {
txt: "更新成功"
},
bounce: this.isShowEmpty ? false : true
};
},
isFetchEntryOrder() {
... ...
<template>
<layout-app :title="$route.params.owner === 'sell' ? '我的出售' : '我的订单'">
<status-nav />
<status-nav @change="change" :owner="owner" :status="currentStatus" />
<div class="content-wrapper">
<scroll
@pulling-up="fetchData"
... ... @@ -87,29 +87,40 @@ export default {
CountDown,
VideoPlayer
},
data() {
const { status = 1, owner } = this.$route.params;
return {
currentStatus: +status,
owner
};
},
computed: {
...mapState(["orderList", "pullUpLoad", "isShowEmpty"]),
options: function() {
return {
pullUpLoad: this.pullUpLoad,
pullDownRefresh: true
bounce: this.isShowEmpty ? false : true,
pullDownRefresh: this.isShowEmpty
? false
: {
txt: "更新成功"
}
};
}
},
// 获取订单数据
asyncData({ store, router }) {
const { status } = router.params;
store.commit(`${STORE_PATH}/resetData`);
store.commit(`${STORE_PATH}/setRouteParamStatus`, status);
return store.dispatch(`${STORE_PATH}/fetchOrderList`, router.params);
activated() {
this.resetData();
this.fetchData();
},
methods: {
...mapActions(["fetchOrderList", "confirmReceipt"]),
...mapMutations(["resetData"]),
change(status) {
this.currentStatus = status;
},
fetchData() {
this.fetchOrderList(this.$route.params);
const { owner, currentStatus: status } = this;
this.fetchOrderList({ owner, status });
},
onRefresh() {
this.resetData();
... ...
... ... @@ -10,7 +10,7 @@
</span>
<span class="wordText">{{price}}</span>
</div>
<OrderMargin class="order-item order-margin" :data="computeTip" :hiddenIcon="hiddenIcon"></OrderMargin>
<OrderMargin class="order-item order-margin" :data="computeTip" :url="url" :superSell="isEntry" ></OrderMargin>
<OrderFee class="order-item" :data="computeTip"></OrderFee>
<AddressInfo :data="addressInfo" class="order-item"></AddressInfo>
</div>
... ... @@ -32,7 +32,7 @@ import TitleComp from './components/confirm/title';
import OrderMargin from './components/confirm/order-margin';
import OrderFee from './components/confirm/order-fee';
import OrderAgree from './components/confirm/agree';
import {get} from 'lodash'
import {get} from 'lodash';
import { createNamespacedHelpers} from 'vuex';
const { mapState, mapActions, mapMutations, mapGetters} = createNamespacedHelpers(
... ... @@ -61,7 +61,7 @@ export default {
isAgreeTerms: false,
hiddenIcon: true,
agreeDesc: '有货卖家协议',
url: `http://m.yohobuy.com/activity/student/detail/renzhen?openby:yohobuy={\"action\":\"go.h5\",\"params\":{\"url\":\"https://activity.yoho.cn/feature/3187.html?title=卖家协议\"}}`,
url: 'http://m.yohobuy.com/activity/student/detail/renzhen?openby:yohobuy={\"action\":\"go.h5\",\"params\":{\"url\":\"https://activity.yoho.cn/feature/3187.html?title=卖家协议\"}}',
isEntry: false,
};
},
... ... @@ -84,14 +84,14 @@ export default {
},
mounted() {
this.isEntry = false
this.isEntry = false;
this.fetchSellerEntryStatus({})
.then((res)=> {
console.log(res)
console.log(res);
if (res) {
this.isEntry = get(res, 'entrySellerType', 0) !== 0
this.isEntry = get(res, 'entrySellerType', 0) !== 0;
}
})
});
this.fetchSellerOrderCount({tabType: 'sell'});// 19268
this.sellerCompute({price: this.price, skup: this.skup});
... ... @@ -101,7 +101,7 @@ export default {
isShowTip(val) {
if (val) {
this.showToast()
this.showToast();
}
}
},
... ... @@ -123,7 +123,7 @@ export default {
this.$createDialog({
type: 'confirm',
title: '',
content: `确定以${this.price}出售此商品`,
content: `确定以¥${this.price}立即出售此商品`,
confirmBtn: {
text: '确定出售',
active: true,
... ... @@ -138,14 +138,25 @@ export default {
},
onConfirm: () => {
this.sellerPublish({price: this.price, skup: this.skup, address_id: this.addressInfo.address_id})
.then(() => {
this.$createToast({
time: 1000,
type: 'txt',
txt: '出售成功'
}).show();
.then((res) => {
if (res && res.code && res.code == 200) {
this.$createToast({
time: 1000,
type: 'txt',
txt: '出售成功'
}).show();
this.$router.go(-1);
} else {
this.$createToast({
time: 1000,
type: 'txt',
txt: res.message
}).show();
}
this.$router.go(-1);
});
},
onCancel: () => {
... ... @@ -188,7 +199,7 @@ export default {
},
showToast() {
this.SELLER_ASK_SET_IS_SHOWTOAST(false)
this.SELLER_ASK_SET_IS_SHOWTOAST(false);
this.$createToast({
time: 1000,
type: 'txt',
... ...
... ... @@ -57,7 +57,6 @@ export default function() {
console.log("resultresultresult");
if (result.code === 200) {
commit(Types.FETCH_CHANNEL, { list: result.data });
return result.data;
}
}
... ...
... ... @@ -31,18 +31,16 @@ export default function() {
},
[Types.FETCH_NEWSDETAIL_LIST](state, { list }) {
console.log(list.page);
console.log("list.page");
state.newsDeatilList.list = list.page > 1 ? state.newsDeatilList.list.concat(list.list) : list.list;
state.newsDeatilList.page = list.page;
state.newsDeatilList.totalPage = list.totalPage;
list.page < list.totalPage ? state.newsDeatilList.isMoreData = true : state.newsDeatilList.isMoreData = false;
},
resPages(state, {page, isMoreData}) {
state.newsDeatilList.page = page;
state.newsDeatilList.isMoreData = isMoreData;
},
// resPages(state, {page, isMoreData}) {
// state.newsDeatilList.page = page;
// state.newsDeatilList.isMoreData = isMoreData;
// },
[Types.FETCH_NEWS_TAB_LIST](state, { list }) {
state.newsList.tabList = list;
... ... @@ -50,16 +48,8 @@ export default function() {
},
actions: {
async fetchNewsList({ commit, state }, obj) {
console.log(obj)
console.log("objobj")
let type = obj && obj.type;
let page = type ? state.newsDeatilList.page + 1 : state.newsList.page + 1;
let limit = state.newsList.limit;
let isPage = obj && obj.isPage;
if (isPage) {
page = 1;
}
console.log(obj);
let { isResetPage, limit, page, totalPage, type } = obj;
const result = await this.$api.post('/api/ufo/home/newsList', {
page, type: type || '', limit
});
... ... @@ -68,19 +58,19 @@ export default function() {
result.data.list && result.data.list.map((res) => {
res.createTime = moment(new Date(res.createTime * 1000)).format('YYYY.MM.DD HH:mm');
});
if (type) {
console.log('1');
commit(Types.FETCH_NEWSDETAIL_LIST, {list: result.data});
} else {
console.log('2');
commit(Types.FETCH_NEWS_LIST, {list: result.data});
}
// if (type) {
// commit(Types.FETCH_NEWSDETAIL_LIST, {list: result.data});
// } else {
// commit(Types.FETCH_NEWS_LIST, {list: result.data});
// }
return result;
}
},
async fetchNewsTabList({ commit }) {
const result = await this.$api.post('/api/ufo/home/newsListTab', {});
if (result.code === 200) {
commit(Types.FETCH_NEWS_TAB_LIST, {list: result.data});
return result;
}
},
},
... ...
... ... @@ -5,10 +5,6 @@ const initailData = () => ({
orderList: [], // 订单列表
// scroll 组件参数,是否触发上拉事件
pullUpLoad: true,
// 当前查询订单状态
currentStatus: null,
routeParamStatus: null,
isShowEmpty: false,
});
... ... @@ -37,12 +33,6 @@ export default function() {
);
state.isShowEmpty = state.orderList.length === 0;
},
setOrderStatus(state, currentStatus) {
state.currentStatus = +currentStatus;
},
setRouteParamStatus(state, status = 1) {
state.routeParamStatus = +status;
},
resetPartialData(state) {
state.page = 1;
state.orderList = [];
... ... @@ -51,14 +41,10 @@ export default function() {
},
resetData(state) {
const s = initailData();
const keyList = Object.keys(s);
const keyBlackList = ['currentStatus', 'routeParamStatus'];
for (const key of keyList) {
if (!keyBlackList.includes(key)) {
state[key] = s[key];
}
}
Object.keys(s).forEach(key => {
state[key] = s[key];
});
},
},
actions: {
... ... @@ -74,14 +60,14 @@ export default function() {
async fetchOrderList(
{
commit,
state: { page, currentStatus, routeParamStatus },
state: { page },
},
param = {},
) {
const { owner } = param;
const { owner, status } = param;
const res = await this.$api.get('/api/order/list', {
tabType: owner,
type: currentStatus || routeParamStatus || 1,
type: status || 1, // 1表示我的订单全部
page,
});
... ... @@ -182,7 +168,7 @@ export default function() {
console.log(res);
if (res.code === 200) {
return { errMsg: '', isOk: true };
return { errMsg: '', isOk: true , bidData: res.data};
} else {
return { errMsg: res.message, isOk: false };
}
... ...
... ... @@ -210,9 +210,14 @@ export default function() {
} else {
commit(SELLER_ASK_PUBLISH_FAILURE, result.message);
}
return result;
}, error => {
console.log(error);
commit(SELLER_ASK_PUBLISH_FAILURE, TIP);
return {
code: 400,
message: TIP
};
});
}
},
... ...
{
"name": "xianyu-ufo-app-web",
"version": "0.0.2-beta-25",
"version": "0.0.2-beta-26",
"private": true,
"description": "Xianyu Project With Express",
"repository": {
... ...