Authored by 邱骏

update

... ... @@ -40,7 +40,7 @@ export default {
watch: {
'yoho.context.needLogin': function(newVal) {
if (newVal) {
this.$sdk.goLogin();
this.$yoho.auth({ needLogin: newVal });
}
},
}
... ...
... ... @@ -94,8 +94,9 @@ const xianyu = {
arr.push(pageParams[key]);
}
pageParams = JSON.parse(arr[0]).params;
pageParams.owner = pageParams.logisticsType;
pageParams.code = pageParams.ordercode;
}
// console.log(JSON.parse(arr[0]).params);
if (pageParams.pagename) {
switch (pageParams.pagename) {
case 'productList':
... ... @@ -107,13 +108,13 @@ const xianyu = {
case 'logisticsInfo':
pageName = 'orderLogisticsInfo';
break;
case 'productListNew':
pageName = 'List';
break;
default:
break;
}
delete pageParams.pagename;
pageParams.owner = pageParams.logisticsType;
pageParams.code = pageParams.ordercode;
console.log(pageParams);
}
} catch (error) {
console.log(error);
... ...
<template><!--求购用调价对话框-->
<template>
<!--求购用调价对话框-->
<div class="dialog-wrapper" :class="[visible ? 'show' : '']">
<div :class="['change-bid-price-wrapper', visible ? 'anim' : '']">
<div class="change-bid-price-container">
... ... @@ -6,7 +7,7 @@
<span>我的求购价:</span>
<span>¥{{ goodsInfo.goodPrice }}</span>
</p>
<p class="price-item">
<p v-if="goodsInfo.bidHighestPrice" class="price-item">
<span>现货最高求购价:</span>
<span>¥{{ goodsInfo.bidHighestPrice.toFixed(2) }}</span>
</p>
... ... @@ -18,7 +19,10 @@
type="number"
placeholder="定价需以9结尾 例如1999"
:maxlength="8"
:class="[errorTip ? 'ipt-number show-error' : 'ipt-number', 'ufo-font']"
:class="[
errorTip ? 'ipt-number show-error' : 'ipt-number',
'ufo-font'
]"
v-model="chgPrice"
>
<span class="prepend" slot="prepend">¥</span>
... ... @@ -26,10 +30,10 @@
<p class="error-tip">{{ errorTip }}</p>
<p
:class="
i === computePriceList.length - 1
? 'promotion-list-item last'
: 'promotion-list-item'
"
i === computePriceList.length - 1
? 'promotion-list-item last'
: 'promotion-list-item'
"
v-for="(priceInfo, i) in computePriceList"
:key="i"
>
... ... @@ -45,18 +49,17 @@
</div>
</div>
</div>
</template>
<script>
import { createNamespacedHelpers } from 'vuex';
import InputUfo from './input-ufo';
import { debounce } from 'lodash';
import { createNamespacedHelpers } from "vuex";
import InputUfo from "./input-ufo";
import { debounce } from "lodash";
const { mapActions } = createNamespacedHelpers('order/orderList');
const { mapActions } = createNamespacedHelpers("order/orderList");
export default {
name: 'change-bid-price-dialog',
name: "change-bid-price-dialog",
components: { InputUfo },
props: {
computePriceInfo: {
... ... @@ -75,8 +78,8 @@ export default {
data() {
return {
visible: false,
chgPrice: '',
errorTip: '',
chgPrice: "",
errorTip: "",
computePrice: null,
calced: false
};
... ... @@ -97,18 +100,19 @@ export default {
},
methods: {
...mapActions(["computeChangePrice"]),
async onChange(price) { // 预先算费
async onChange(price) {
// 预先算费
if (this.checkPrice(price)) {
const res = await this.computeChangePrice({
const { code, message, data } = await this.computeChangePrice({
price,
orderCode: this.orderCode
});
if (typeof res === 'string') {
this.errorTip = res;
if (code !== 200) {
this.errorTip = message;
this.calced = false;
} else {
this.computePrice = res;
this.computePrice = data;
this.calced = true;
}
}
... ... @@ -125,16 +129,16 @@ export default {
let valid = false;
if (!price) {
this.errorTip = '没有价格';
this.errorTip = "没有价格";
return false;
} else if (!/^\d+$/.test(price)) {
this.errorTip = '价格只能为正整数';
this.errorTip = "价格只能为正整数";
} else if (!/9$/.test(price)) {
this.errorTip = '出售价格必须以9结尾';
this.errorTip = "出售价格必须以9结尾";
} else if (+price === +this.goodsInfo.goodPrice) {
this.errorTip = '前后价格没有变化';
this.errorTip = "前后价格没有变化";
} else {
this.errorTip = '';
this.errorTip = "";
valid = true;
}
return valid;
... ... @@ -142,7 +146,7 @@ export default {
closeAction() {
this.hide();
this.clearData();
this.$emit('closeAction');
this.$emit("closeAction");
},
confirmAction() {
if (this.calced) {
... ... @@ -150,17 +154,14 @@ export default {
this.hide();
this.clearData();
this.$emit('confirmAction', price);
this.$emit("confirmAction", price);
}
},
clearData() {
this.chgPrice = '';
this.errorTip = '',
this.computePrice = null;
this.chgPrice = "";
(this.errorTip = ""), (this.computePrice = null);
this.calced = false;
}
},
watch: {
chgPrice(newVal) {
... ... @@ -172,114 +173,114 @@ export default {
</script>
<style lang="scss" scoped>
.dialog-wrapper {
position: fixed;
width: 100%;
height: 100%;
left: 0;
top: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 99;
display: none;
align-items: center;
justify-content: center;
.dialog-wrapper {
position: fixed;
width: 100%;
height: 100%;
left: 0;
top: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 99;
display: none;
align-items: center;
justify-content: center;
&.show {
display: flex;
}
&.show {
display: flex;
}
}
.change-bid-price-wrapper {
position: absolute;
width: 600px;
background-color: #fff;
transform: scale(0.9);
.change-bid-price-wrapper {
position: absolute;
width: 600px;
background-color: #fff;
transform: scale(0.9);
&.anim {
animation: animateDialog 0.5s cubic-bezier(0.03, 1.58, 0.79, 0.96) forwards;
}
}
}
.change-bid-price-container {
background-color: #fff;
font-size: 24px;
color: #000;
padding: 60px 38px 0 38px;
letter-spacing: 0;
.price-item {
font-size: 24px;
line-height: 34px;
margin-bottom: 10px;
}
.change-bid-price-container {
background-color: #fff;
font-size: 24px;
color: #000;
padding: 60px 38px 0 38px;
letter-spacing: 0;
.ipt-number {
margin: 30px 0;
.price-item {
font-size: 24px;
line-height: 34px;
margin-bottom: 10px;
}
/deep/ .prepend {
width: 40px;
margin-left: 20px;
text-align: left;
}
.ipt-number {
margin: 30px 0;
&.show-error {
margin-bottom: 0;
}
/deep/ .prepend {
width: 40px;
margin-left: 20px;
text-align: left;
}
.error-tip {
color: #d0021b;
margin-bottom: 10px;
&.show-error {
margin-bottom: 0;
}
}
.promotion-list-item {
display: flex;
justify-content: space-between;
align-items: center;
color: #999;
margin-bottom: 10px;
font-size: 24px;
.error-tip {
color: #d0021b;
margin-bottom: 10px;
}
&.last {
color: #000;
}
}
.promotion-list-item {
display: flex;
justify-content: space-between;
align-items: center;
color: #999;
margin-bottom: 10px;
font-size: 24px;
.tip {
color: #999;
margin: 40px auto;
font-size: 24px;
&.last {
color: #000;
}
}
.buttons-container {
width: 100%;
height: 100px;
display: flex;
border-top: 1px solid #f0f0f0;
.tip {
color: #999;
margin: 40px auto;
font-size: 24px;
}
}
button {
width: 100%;
height: 100%;
text-align: center;
line-height: 100px;
font-size: 32px;
border: none;
background-color: #fff;
}
.buttons-container {
width: 100%;
height: 100px;
display: flex;
border-top: 1px solid #f0f0f0;
button + button {
border-left: 1px solid #f0f0f0;
}
button {
width: 100%;
height: 100%;
text-align: center;
line-height: 100px;
font-size: 32px;
border: none;
background-color: #fff;
}
@keyframes animateDialog {
0% {
transform: scale(0.9);
}
button + button {
border-left: 1px solid #f0f0f0;
}
}
100% {
transform: scale(1);
}
@keyframes animateDialog {
0% {
transform: scale(0.9);
}
100% {
transform: scale(1);
}
}
</style>
... ...
... ... @@ -78,6 +78,21 @@ export function orderStatusKey(type, status) {
return `${type}-${status}`;
}
/**
* 根据owner计算status状态,如果status未设置,取对应订单类型的第一个状态
* @param owner
* @param status
* @returns {number}
*/
export function getOrderStatus(owner, status) {
status = parseInt(status, 10);
if (isNaN(status)) {
status = (owner === 'buy' ? buyerOrderStatusList : sellerOrderStatusList)[0].value;
}
return status;
}
// 订单操作
// ts IOrderAction[]
export const orderActionsMap = {
... ...
... ... @@ -80,9 +80,14 @@ xianyu.$router = router;
yoho.auth = async (args) => {
let {
refer,
loginUrl
loginUrl,
needLogin
} = args || {};
let user = await sdk.getUser(true);
let user;
if (!needLogin) {
user = await sdk.getUser(true);
}
if (user && user.uid) {
return user;
... ...
... ... @@ -17,7 +17,7 @@
<input class="search-input" type="search" disabled="true" placeholder="搜索商品名称或货号"/>
</div>
<template v-for="(item, index) in channelList.list">
<Swiper :list="item.data" :key="index" v-if="item.template_name == 'threePicture'"/>
<Swiper @click="getParams" :list="item.data" :key="index" v-if="item.template_name == 'threePicture'"/>
<Hot :list="item.data" :key="index" v-if="item.template_name == 'image_list'"/>
<Banner :list="item.data" :key="index" v-if="item.template_name == 'single_image'"/>
<TwoBanner :list="item.data" :key="index" v-if="item.template_name == 'twoPicture'"/>
... ... @@ -57,7 +57,6 @@ export default {
data() {
return {
options: {
scrollbar: true,
pullUpLoad: true,
// pullDownRefresh: true,
// pullDownRefresh: {
... ... @@ -224,6 +223,10 @@ export default {
this.$router.push({
name: 'Search',
});
},
getParams() {
console.log("2222");
}
// onPullingDown() {
// let params = this.searchParams;
... ...
... ... @@ -60,18 +60,17 @@ export default {
text-align: center;
margin-top: 20px;
.hot-image {
width: 150px;
width: 100px;
height: 100px;
overflow: hidden;
margin: 0 auto;
img {
width: 100%;
height: 100%;
display: block;
}
}
.hot-name {
margin-top: 20px;
// margin-top: 20px;
font-size: 24px;
color: #555;
}
... ... @@ -86,7 +85,7 @@ export default {
margin-top: 25px;
}
.hot-name {
margin-top: 38px;
margin-top: 20px;
}
}
}
... ...
<template>
<div v-if="list.length" class="swiper">
<div class="swiper-item swiper-item-left">
<LayoutLink :href="list[0].url" class="img-link">
<LayoutLink :href="list[0].url" :report="reportParams" class="img-link">
<ImageFormat :lazy="false" class="item-imge" :src="list[0].src" :width="310" :height="402"></ImageFormat>
</LayoutLink>
</div>
... ... @@ -24,6 +24,20 @@ export default {
type: Array,
default: []
},
},
data() {
return {
reportParams: {
P_NAME: 'XY_UFOHome',
P_PARAM: 'f788335b57b67c1711f255648c744dab',
PAGE_URL: '当前页面URL',
F_ID: '楼层唯一id',
F_NAME: '楼层名称',
F_INDEX: '楼层顺序号',
I_INDEX: '楼层内部顺序号,从1开始,所有more按钮传0',
ACTION_URL: '跳转URL',
},
}
}
};
</script>
... ...
... ... @@ -330,9 +330,11 @@ export default {
}
},
forward: {
name: 'SellPayOk',
query: {
orderCode: get(this.publishresult, 'orderCode', ''),
type: 'buy',
name: 'buyOrderDetail',
params: {
code: get(this.publishresult, 'orderCode', ''),
owner: 'buy',
}
}
}),
... ...
... ... @@ -40,7 +40,9 @@ export default {
name: 'BuyOrderConfirm',
props: ['productId', 'storageId'],
data() {
return {};
return {
isActive: false
};
},
components: {
ProductInfo,
... ... @@ -54,6 +56,10 @@ export default {
},
activated() {
this.init();
this.isActive = true;
},
deactivated() {
this.isActive = false;
},
beforeRouteLeave(to, from, next) {
if (to.name !== 'address') {
... ... @@ -85,7 +91,9 @@ export default {
watch: {
address: {
handler() {
this.compute();
if (this.isActive) {
this.compute();
}
},
deep: true
}
... ...
... ... @@ -7,7 +7,7 @@
</div>
<div class="num-wrapper" v-if="superSell">
<i class="iconfont iconplus-minus icon-class" @click="onMinus"></i>
<span class="icon-class count">{{count}}</span>
<span class="icon-class count">{{num}}</span>
<i class="iconfont iconi-add icon-class" @click="onAdd"></i>
</div>
</div>
... ... @@ -32,8 +32,7 @@ export default {
},
data() {
return {
val: this.value,
count: this.num
val: this.value
};
},
methods: {
... ... @@ -44,20 +43,22 @@ export default {
this.$emit('input', this.$refs.input.value);
},
onMinus() {
if (this.count > 1) {
this.count -= 1;
this.$emit('on-num-change', this.count);
if (this.num > 1) {
const count = this.num - 1;
this.$emit('on-num-change', { count, type: 'minus' });
}
},
onAdd() {
this.count += 1;
this.$emit('on-num-change', this.count);
const count = this.num + 1;
this.$emit('on-num-change', { count, type: 'add' });
}
},
watch: {
value(newVal) {
this.val = newVal;
}
},
}
};
</script>
... ...
... ... @@ -5,7 +5,8 @@
<div class="product-price">
<div class="product-price-wrapper">
<div class="price">{{data.colorName}},{{data.sizeName}}</div>
<div class="tip">{{ data.priceType || '最低售价:'}} <span class="price2">{{data.goodPrice || '-'}}</span></div>
<div class="tip">{{ data.priceType}} <span class="price2">{{data.goodPrice}}</span></div>
<div v-if="data.priceBidType" class="tip">{{ data.priceBidType}} <span class="price2">{{data.goodBidPrice}}</span></div>
</div>
</div>
</div>
... ... @@ -20,9 +21,6 @@ export default {
default() {
return {};
}
},
priceType: {
type: String,
}
}
};
... ... @@ -39,24 +37,25 @@ export default {
vertical-align: top;
height: 100%;
margin-left: 20px;
padding-top: 10%;
padding-top: 3%;
}
.price {
font-weight: bold;
font-size: 24px;
color: #999;
margin-bottom: 20px;
}
.tip {
font-size: 28px;
margin-top: 24px;
margin-bottom: 10px;
}
.price2 {
font-size: 40px;
font-size: 28px;
font-weight: bold;
line-height: 40px;
line-height: 28px;
}
</style>
... ...
<template>
<div class="change-bid-price-wrapper">
<p class="price-item">
<span>我的求购价:</span>
<span>¥{{ goodsInfo.goodPrice }}</span>
</p>
<p class="price-item">
<span>当前最高求购价:</span>
<span>¥{{ goodsInfo.bidHighestPrice }}</span>
</p>
<p v-if="goodsInfo.leastPrice" class="price-item">
<span>最低现货价:</span>
<span>¥{{ goodsInfo.leastPrice }}</span>
</p>
<InputUfo
type="number"
placeholder="定价需以9结尾 例如1999"
:maxlength="8"
:class="errorTip ? 'ipt-number show-error' : 'ipt-number'"
v-model="chgPrice"
>
<span class="prepend" slot="prepend">¥</span>
</InputUfo>
<p class="error-tip">{{ errorTip }}</p>
<p
:class="
i === computePriceList.length - 1
? 'promotion-list-item last'
: 'promotion-list-item'
"
v-for="(priceInfo, i) in computePriceList"
:key="i"
>
<span>{{ priceInfo.promotion }}:</span>
<span>{{ priceInfo.promotionAmount }}</span>
</p>
<p class="tip">Tip: 调整求购价成功后,当前的求购将被关闭</p>
</div>
</template>
<script>
import { createNamespacedHelpers } from "vuex";
import InputUfo from "../price-change/components/input-ufo";
import { debounce } from "lodash";
const { mapActions } = createNamespacedHelpers("order/orderList");
export default {
components: { InputUfo },
props: {
computePriceInfo: {
type: Object,
default: () => ({})
},
goodsInfo: {
type: Object,
default: () => ({})
},
orderCode: {
type: Number,
default: 0
},
onChangePrice: {
type: Function,
default: () => {}
}
},
data() {
return {
chgPrice: "",
errorTip: "",
computePrice: null
};
},
computed: {
computePriceList() {
const priceInfo = this.computePrice || this.computePriceInfo;
return priceInfo.promotionFormulaList.filter(
({ promotion }) => promotion === "运费" || promotion === "实付金额"
);
}
},
mounted() {
// debounce防抖动,输入数字后延迟500毫秒提交
this.inputChange = debounce(this.onChange.bind(this), 500);
},
methods: {
...mapActions(["computeChangePrice"]),
async onChange(price) {
if (this.checkPrice(price)) {
const res = await this.computeChangePrice({
price,
orderCode: this.orderCode
});
if (typeof res === "string") {
this.errorTip = res;
this.onChangePrice(0);
} else {
this.computePrice = res;
this.onChangePrice(price);
}
} else {
this.onChangePrice(0);
}
},
checkPrice(price) {
let valid = false;
if (!price) {
this.errorTip = "没有价格";
return false;
} else if (!/^\d+$/.test(price)) {
this.errorTip = "价格只能为正整数";
} else if (!/9$/.test(price)) {
this.errorTip = "出售价格必须以9结尾";
} else if (+price === +this.goodsInfo.goodPrice) {
this.errorTip = "前后价格没有变化";
} else {
this.errorTip = "";
valid = true;
}
return valid;
}
},
watch: {
chgPrice(newVal) {
this.inputChange(newVal);
}
}
};
</script>
<style lang="scss" scoped>
.change-bid-price-wrapper {
font-size: 12*2px;
color: #000;
padding: 0 38px;
letter-spacing: 0;
.ipt-number {
margin: 30px 0;
&.show-error {
margin-bottom: 0;
}
}
.error-tip {
color: #d0021b;
}
.promotion-list-item {
display: flex;
justify-content: space-between;
align-items: center;
color: #999;
&.last {
color: #000;
}
}
.tip {
color: #999;
margin-top: 40px;
}
}
</style>
... ... @@ -3,7 +3,6 @@
import { orderActionsMap, ownType } from 'constants/order-constants';
import { createNamespacedHelpers } from 'vuex';
import DialogConfirmInfo from '../components/dialog-confirm-info';
import DialogChangeBidPrice from '../components/dialog-change-bid-price';
const { mapActions, mapMutations } = createNamespacedHelpers('order/orderList');
... ... @@ -88,7 +87,7 @@ export default {
if (isDetail) {
this.fetchOrderDetail(this.$route.params);
} else {
this.resetData();
this.resetData(this.$route.params);
this.fetchData(this.$route.params);
}
}
... ... @@ -166,7 +165,7 @@ export default {
if (isDetail) {
this.fetchOrderDetail(this.$route.params);
} else {
this.resetData();
this.resetData(this.$route.params);
this.fetchData(this.$route.params);
}
}
... ... @@ -176,44 +175,45 @@ export default {
}
case orderActionsMap.CHANGE_BID_PRICE.name: {
console.log(goodsInfo);
const { goodPrice } = goodsInfo;
const computePriceInfo = await this.computeChangePrice({
const { code, message, data } = await this.computeChangePrice({
orderCode,
price: goodPrice,
});
let isStr = false;
if (typeof computePriceInfo === 'string') {
if (code !== 200) {
isStr = true;
this.$createToast({
type: 'alert',
txt: computePriceInfo,
txt: message,
mask: true,
}).show();
// return;
// 有未完成调价
if (code === 401) {
return;
}
}
let that = this;
this.$createChangeBidPriceDialog({
computePriceInfo: isStr ? {"promotionFormulaList":[]} : computePriceInfo,
computePriceInfo: isStr ? { promotionFormulaList: [] } : data,
goodsInfo,
orderCode,
onCloseAction() {
},
onConfirmAction: async(price) => {
onCloseAction() {},
onConfirmAction: async price => {
const { isOk, errMsg = '' } = await that.confirmChangePrice({
price: price,
orderCode,
});
if (isOk) {
if (isDetail) {
that.$router.back();
// that.fetchOrderDetail(this.$route.params);
} else {
that.resetData();
that.resetData(this.$route.params);
that.fetchData(this.$route.params);
}
} else {
... ... @@ -224,7 +224,7 @@ export default {
});
}
}
}
},
}).show();
break;
}
... ...
... ... @@ -96,7 +96,7 @@ export default {
...mapActions(["fetchEntryOrderList", "fetchNotEntryOrderList"]),
...mapMutations(["resetData"]),
onRefresh() {
this.resetData();
this.resetData(this.$route.params);
this.fetchData();
},
fetchData() {
... ...
import {
buyerOrderStatusList,
sellerOrderStatusList,
getOrderStatus,
} from "constants/order-constants";
const routers = [
... ... @@ -14,12 +13,7 @@ const routers = [
props({params}) {
let { owner, status } = params;
status = parseInt(status, 10);
if (isNaN(status)) {
// 取对应订单类型的第一个状态
status = (owner === 'buy' ? buyerOrderStatusList : sellerOrderStatusList)[0].value;
}
status = getOrderStatus(owner, status);
return {
owner,
status,
... ...
<template>
<layout-app :title="$route.params.owner === 'sell' ? '我的出售' : '我的订单'"
class="list-page">
<status-nav :status="status" :owner="owner" @select="onStatusChange"/>
<layout-app
:title="$route.params.owner === 'sell' ? '我的出售' : '我的订单'"
class="list-page"
>
<status-nav :status="status" :owner="owner" @select="onStatusChange" />
<div class="content-wrapper">
<scroll
@pulling-up="fetchData"
... ... @@ -67,7 +69,7 @@ import CountDown from "../components/count-down";
import orderActionMixin from "../mixin/order-action";
import orderInSaleActionMixin from "../mixin/order-in-sale-action";
import {orderStatusKey} from "constants/order-constants";
import { orderStatusKey, getOrderStatus } from "constants/order-constants";
const STORE_PATH = "order/orderList";
... ... @@ -90,10 +92,10 @@ export default {
},
props: {
owner: String,
status: Number,
status: Number
},
computed: {
...mapState(['orderListByType']),
...mapState(["orderListByType"]),
orderStatus() {
return this.orderListByType[orderStatusKey(this.owner, this.status)];
},
... ... @@ -103,12 +105,13 @@ export default {
options() {
const options = {
pullUpLoad: this.orderStatus.pullUpLoad,
bounce: !this.orderStatus.isShowEmpty,
bounce: !this.orderStatus.isShowEmpty
};
if (this.$refs.scroll && this.$refs.scroll.scroll) {
options.pullDownRefresh = this.isShowEmpty ? false : {txt: '更新成功'};
}
// if (this.$refs.scroll && this.$refs.scroll.scroll) {
options.pullDownRefresh = this.orderStatus.isShowEmpty
? false
: { txt: "更新成功" };
// }
return options;
}
... ... @@ -116,10 +119,12 @@ export default {
// 获取订单数据
asyncData({ store, router }) {
const {owner, status} = router.params;
let { owner, status } = router.params;
store.commit(`${STORE_PATH}/resetData`, {owner, status});
return store.dispatch(`${STORE_PATH}/fetchOrderList`, {owner, status});
status = getOrderStatus(owner, status);
store.commit(`${STORE_PATH}/resetData`, { owner, status });
return store.dispatch(`${STORE_PATH}/fetchOrderList`, { owner, status });
},
methods: {
...mapActions(["fetchOrderList", "confirmReceipt"]),
... ... @@ -127,13 +132,13 @@ export default {
fetchData() {
this.fetchOrderList({
owner: this.owner,
status: this.status,
status: this.status
});
},
onRefresh() {
this.resetData({
owner: this.owner,
status: this.status,
status: this.status
});
this.fetchData();
},
... ... @@ -152,11 +157,11 @@ export default {
name: this.$route.name,
params: {
owner: this.owner,
status,
},
status
}
});
},
},
}
}
};
</script>
<style lang="scss" scoped>
... ...
... ... @@ -56,6 +56,7 @@ export default {
agreeDesc: '有货卖家协议',
url: 'https://activity.yoho.cn/feature/6773.html?share_id=9479&title=%E9%97%B2%E9%B1%BC%E6%BD%AE%E5%8D%96%E5%AE%B6%E5%8D%8F%E8%AE%AE',
superSell: false,
addNumError: false
};
},
activated() {
... ... @@ -82,13 +83,16 @@ export default {
const storageNum = get(state.product.selectedProductInfo, 'size.storage_num', 0);
const suggestHighPrice = get(state.product.selectedProductInfo, 'size.suggest_high_price', 0);
const suggestLowPrice = get(state.product.selectedProductInfo, 'size.suggest_low_price', 0);
const bidPrice = get(state.product.selectedProductInfo, 'size.bid_moster_price', 0);
let priceType = '最低售价';
let priceType = '最低现货价:';
let goodPrice = '';
let priceBidType = '最高求购价:';
let goodBidPrice = '¥-';
if (!storageNum) {
if (suggestHighPrice && suggestLowPrice) {
priceType = '建议';
priceType = '建议售价:';
goodPrice = `¥${suggestLowPrice}-¥${suggestHighPrice}`;
} else {
goodPrice = '¥-';
... ... @@ -97,16 +101,26 @@ export default {
goodPrice = `¥${leastPrice}`;
}
if (leastPrice > 0) {
if (bidPrice) {
goodBidPrice = `¥${bidPrice}`;
}
}
return {
goodImg: get(state.product.selectedProductInfo, 'product.goods_list[0].image_list[0].image_url', ''),
productName: get(state.product.selectedProductInfo, 'product.product_name', ''),
colorName: get(state.product.selectedProductInfo, 'product.goods_list[0].color_name', ''),
sizeName: get(state.product.selectedProductInfo, 'size.size_name', ''),
skup: get(state.product.selectedProductInfo, 'size.skup', ''),
goodPrice,
priceType,
goodBidPrice,
priceBidType,
isSuggest: suggestHighPrice && suggestLowPrice,
suggestHighPrice,
suggestLowPrice
suggestLowPrice,
bidPrice
};
}
})
... ... @@ -119,6 +133,34 @@ export default {
this.submit();
},
compute() {
if (this.productDetail.bidPrice && (Number(this.price) >= this.productDetail.bidPrice)) {
this.$createDialog({
type: 'confirm',
title: `最高求购价${this.productDetail.bidPrice}`,
content: '已有求购高于您的出价,可直接变现',
confirmBtn: {
text: '我再想想',
active: true,
disabled: false,
},
cancelBtn: {
text: '确定变现',
active: false,
disabled: false
},
onCancel: () => {
this.$router.replace({
name: 'sellAskOrder',
query: {
skup: this.productDetail.skup,
price: this.productDetail.bidPrice
}
});
}
}).show();
return;
}
return this.fetchOrderPrice({
address_id: this.address?.address_id,
num: this.num,
... ... @@ -127,14 +169,21 @@ export default {
}).then(result => {
if (result.error) {
this.error = result.error;
this.$createToast({
time: 1500,
txt: result.error,
type: 'txt'
}).show();
if (result.code === 438) {
this.addNumError = true;
}
return;
}
this.error = false;
this.addNumError = false;
});
},
changePrice(val) {
... ... @@ -265,7 +314,12 @@ export default {
}
});
},
onNumChange(count) {
onNumChange({ count, type }) {
console.log(count, type, this.addNumError);
if (type === 'add' && this.addNumError) {
return;
}
this[Types.CHANGE_SELL_NUM](count);
this.compute();
},
... ...
... ... @@ -124,8 +124,14 @@ export default {
this.uploading = true;
},
successHandler(file) {
if (get(file, 'response.code') === 200 && this.uploadCallback) {
this.uploadCallback(get(file, 'response.data.imagesList[0]'), file.url);
if (get(file, 'response.code') === 200) {
this.uploadCallback && this.uploadCallback(get(file, 'response.data.imagesList[0]'), file.url);
} else {
this.$createToast && this.$createToast({
txt: res.message || '上传失败',
type: 'txt',
time: 1000
}).show();
}
this.uploading = false;
... ...
... ... @@ -105,37 +105,41 @@ export default {
},
buy(product) {
this.$yoho.auth()
.then(() => {
this.hide();
this.updateTradeInfo({
productId: this.productDetail.product_id,
sizeInfo: product,
}).then((data) => {
/**
* 跳转到求购确认页面
* data:
* productId: number
* sizeId: number
* 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', ''),
colorName: get(this.productDetail, 'goods_list[0].color_name', ''),
product_name: this.goodsName,
productId: get(data, 'productId', ''),
image: this.imageUrl,
skup: product.skup,
})
this.$router.push({
name: 'buyerAskOrder',
query: {
storageId: data.storageId || ''
},
.then((res) => {
if (res) {
this.hide();
this.updateTradeInfo({
productId: this.productDetail.product_id,
sizeInfo: product,
}).then((data) => {
/**
* 跳转到求购确认页面
* data:
* productId: number
* sizeId: number
* 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', ''),
colorName: get(this.productDetail, 'goods_list[0].color_name', ''),
product_name: this.goodsName,
productId: get(data, 'productId', ''),
image: this.imageUrl,
skup: product.skup,
})
this.$router.push({
name: 'buyerAskOrder',
query: {
storageId: data.storageId || ''
},
});
});
});
}
})
},
... ...
... ... @@ -29,7 +29,7 @@
<transition name="slide-up">
<div class="footer" v-if="isAvailable">
<cube-button v-if="isQiugouEnabled && isMarketable" @click="convertToCash" :class="{active: isMarketable}">变现<span> <i>¥</i>{{cashPrice}}</span></cube-button>
<cube-button v-if="isMarketable" @click="convertToCash" :class="{active: isMarketable}">变现<span> <i>¥</i>{{cashPrice}}</span></cube-button>
<cube-button @click="select" :class="{active: isTradable}">{{config.title}}</cube-button>
</div>
</transition>
... ... @@ -41,7 +41,7 @@
<script>
import { Scroll, Button } from 'cube-ui';
import { get } from 'lodash';
import { createNamespacedHelpers, mapActions, mapGetters } from 'vuex';
import { createNamespacedHelpers, mapActions } from 'vuex';
import ActionSheet from './action-sheet';
import SizeList from './size-list';
... ... @@ -83,7 +83,6 @@ export default {
},
computed: {
...mapState(['selectedProductInfo']),
...mapGetters(['isQiugouEnabled']),
selectedSize() {
if (this.selectedProductInfo.productId === this.product.product_id) {
return this.selectedProductInfo.size;
... ... @@ -188,24 +187,27 @@ export default {
}
this.$yoho.auth()
.then(() => {
this.$store.commit('order/sellerAskOrder/SELLER_ASK_SET_PRODUCTINFO', {
goodImg: get(this.product, 'goods_list[0].image_list[0].image_url', ''),
colorName: get(this.product, 'goods_list[0].color_name', ''),
sizeName: get(this.selectedSize, 'size_name', '') ? get(this.selectedSize, 'size_name', '') + '码' : '',
goodPrice: get(this.selectedSize, 'bid_moster_price', ''),
productId: this.product.product_id,
bid_moster_price: get(this.selectedSize, 'bid_moster_price', ''),
});
// 跳转变现
this.$router.push({
name: 'sellAskOrder',
query: {
skup: get(this.selectedSize, 'bid_skup', 0),
price: get(this.selectedSize, 'bid_moster_price', 0),
}
});
.then((res) => {
if (res) {
this.$store.commit('order/sellerAskOrder/SELLER_ASK_SET_PRODUCTINFO', {
goodImg: get(this.product, 'goods_list[0].image_list[0].image_url', ''),
colorName: get(this.product, 'goods_list[0].color_name', ''),
sizeName: get(this.selectedSize, 'size_name', '') ? get(this.selectedSize, 'size_name', '') + '码' : '',
goodPrice: get(this.selectedSize, 'bid_moster_price', ''),
productId: this.product.product_id,
bid_moster_price: get(this.selectedSize, 'bid_moster_price', ''),
});
// 跳转变现
this.$router.push({
name: 'sellAskOrder',
query: {
skup: get(this.selectedSize, 'bid_skup', 0),
price: get(this.selectedSize, 'bid_moster_price', 0),
}
});
}
});
},
... ...
... ... @@ -185,6 +185,13 @@ export default {
activated() {
this.loadData(this.productId);
},
beforeRouteLeave(to, from, next) {
if (this.showSizeRequestSheet) {
this.onSizeRequestHidden();
return next(false);
}
next();
},
methods: {
...mapActions(['fetchProductInfo', 'fetchTop3', 'fetchFav', 'toggleFav', 'updateTradeInfo', 'getSelectedTradeProduct', 'payment', 'resetSelectedSize']),
refresh() {
... ...
... ... @@ -31,6 +31,7 @@ export default function() {
return {
namespaced: true,
state: {
buyAddress: null,
address: null,
fee: {
income: '',
... ... @@ -200,6 +201,7 @@ export default function() {
if (order.code !== 200) {
return {
code: order.code,
error: order.message
};
}
... ...
... ... @@ -3,7 +3,7 @@ import {
sellerOrderStatusList,
orderStatusKey,
ownType,
} from "constants/order-constants";
} from 'constants/order-constants';
function initialOrderState() {
return {
... ... @@ -20,7 +20,10 @@ function initialOrderState() {
const initialState = () => {
const orderListByType = {};
[[ownType.BUY, buyerOrderStatusList], [ownType.SELL, sellerOrderStatusList]].forEach(statusInfo => {
[
[ownType.BUY, buyerOrderStatusList],
[ownType.SELL, sellerOrderStatusList],
].forEach(statusInfo => {
statusInfo[1].forEach(orderStatus => {
const key = orderStatusKey(statusInfo[0], orderStatus.value);
... ... @@ -30,10 +33,6 @@ const initialState = () => {
return {
orderListByType,
// 当前查询订单状态
currentStatus: null,
routeParamStatus: null,
};
};
... ... @@ -42,7 +41,7 @@ export default function() {
namespaced: true,
state: initialState,
mutations: {
setOrderList(state, {res, owner, status}) {
setOrderList(state, { res, owner, status }) {
let { page, pagetotal, data = [] } = res;
const orderState = state.orderListByType[orderStatusKey(owner, status)];
... ... @@ -56,7 +55,7 @@ export default function() {
orderState.pullUpLoad = false;
}
},
filterOrderList(state, {orderCode, owner, status}) {
filterOrderList(state, { orderCode, owner, status }) {
const orderState = state.orderListByType[orderStatusKey(owner, status)];
orderState.orderList = orderState.orderList.filter(
... ... @@ -64,21 +63,7 @@ export default function() {
);
orderState.isShowEmpty = orderState.orderList.length === 0;
},
setOrderStatus(state, currentStatus) {
state.currentStatus = +currentStatus;
},
setRouteParamStatus(state, status = 1) {
state.routeParamStatus = +status;
},
resetPartialData(state, {owner, status}) {
Object.assign(state.orderListByType[orderStatusKey(owner, status)], {
page: 1,
orderList: [],
pagetotal: 0,
pullUpLoad: true,
});
},
resetData(state, {owner, status}) {
resetData(state, { owner, status } = {}) {
const orderListState = initialOrderState();
state.orderListByType[orderStatusKey(owner, status)] = orderListState;
... ... @@ -94,7 +79,7 @@ export default function() {
* }
* r
*/
async fetchOrderList({commit, state}, { owner, status }) {
async fetchOrderList({ commit, state }, { owner, status }) {
const { page } = state.orderListByType[orderStatusKey(owner, status)];
const res = await this.$api.get('/api/order/list', {
... ... @@ -104,7 +89,7 @@ export default function() {
});
if (res.code === 200) {
commit('setOrderList', { res: res.data, owner, status});
commit('setOrderList', { res: res.data, owner, status });
}
},
... ... @@ -125,7 +110,7 @@ export default function() {
// data 为true时删除成功
if (code === 200) {
if (data) {
commit('filterOrderList', {orderCode, owner, status});
commit('filterOrderList', { orderCode, owner, status });
}
}
return data;
... ... @@ -188,7 +173,9 @@ export default function() {
},
);
return res.code === 200 ? res.data : res.message || '';
const { code, message } = res;
return code === 200 ? res : { code, message };
},
// 买家调价
... ... @@ -199,7 +186,7 @@ export default function() {
});
if (res.code === 200) {
return { errMsg: '', isOk: true , bidData: res.data};
return { errMsg: '', isOk: true, bidData: res.data };
} else {
return { errMsg: res.message, isOk: false };
}
... ...
... ... @@ -43,6 +43,7 @@ const TEST_PRODUCT_INFO = {
colorName: '黑色',
sizeName: '42码',
goodPrice: 1119.00,
priceType: '现货最高求购价:',
};
export default function() {
... ... @@ -72,6 +73,9 @@ export default function() {
[SELLER_ASK_SET_PRODUCTINFO](state, payload) {
state.originProductData = payload;
if (state.originProductData) {
state.originProductData.priceType = '现货最高求购价:';
}
},
[SELLER_ORDERCOUNT_SUCCESS](state, payload) {
... ...
... ... @@ -200,29 +200,27 @@ export default function(mergeState = {}) {
},
) {
try {
document.addEventListener('deviceready', () => {
setTimeout(() => {
if (window._yas && window._yas.sendAppLogs) {
param = param || {};
setTimeout(() => {
if (window._yas && window._yas.sendAppLogs) {
param = param || {};
if (!param.C_ID) {
const channel = {
men: 1,
women: 2,
}[cookie.get('_Channel') || 'men'];
if (!param.C_ID) {
const channel = {
men: 1,
women: 2,
}[cookie.get('_Channel') || 'men'];
param.C_ID = channel;
}
window._yas.sendAppLogs(
{
appop,
param: param ? JSON.stringify(param) : '{}',
},
asyncindx,
);
param.C_ID = channel;
}
}, 300);
});
window._yas.sendAppLogs(
{
appop,
param: param ? JSON.stringify(param) : '{}',
},
asyncindx,
);
}
}, 300);
} catch (e) {
// pass
}
... ...
{
"name": "xianyu-ufo-app-web",
"version": "0.0.2-beta-30",
"version": "0.0.2-beta-31",
"private": true,
"description": "Xianyu Project With Express",
"repository": {
... ...