Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
xianyu-ufo-app-web
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
lea guo
5 years ago
Commit
7c42d4ed7b52417f6c77bcc9ad6c42b97fa31ed9
1 parent
6864e46d
求购
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
24 deletions
apps/pages/order/components/dialog-change-bid-price.vue
apps/pages/order/order-list/mixins/order-action.js
apps/store/order/order-list.js
apps/pages/order/components/dialog-change-bid-price.vue
View file @
7c42d4e
...
...
@@ -16,12 +16,12 @@
type="number"
placeholder="定价需以9结尾 例如1999"
:maxlength="8"
class="ipt-number
"
:class="errorTip ? 'ipt-number show-error' : 'ipt-number'
"
v-model="chgPrice"
>
<span class="prepend" slot="prepend">¥</span>
</InputUfo>
<p class="error-tip">{{
this.
errorTip }}</p>
<p class="error-tip">{{ errorTip }}</p>
<p
:class="
i === computePriceList.length - 1
...
...
@@ -43,7 +43,7 @@ import { createNamespacedHelpers } from "vuex";
import InputUfo from "../price-change/components/input-ufo";
import { debounce } from "lodash";
const { mapActions } = createNamespacedHelpers("order/orderList");
const { mapActions
, mapMutations
} = createNamespacedHelpers("order/orderList");
export default {
components: { InputUfo },
props: {
...
...
@@ -54,18 +54,24 @@ export default {
goodsInfo: {
type: Object,
default: () => ({})
},
orderCode: {
type: Number,
default: 0
}
},
data() {
return {
chgPrice: "",
errorTip: ""
errorTip: "",
computePrice: null
};
},
computed: {
computePriceList() {
return this.computePriceInfo.promotionFormulaList.filter(
const priceInfo = this.computePrice || this.computePriceInfo;
return priceInfo.promotionFormulaList.filter(
({ promotion }) => promotion === "运费" || promotion === "实付金额"
);
}
...
...
@@ -76,9 +82,22 @@ export default {
},
methods: {
...mapActions(["computeChangePrice", "changePrice"]),
onChange(price) {
...mapMutations(["setChangePrice"]),
async onChange(price) {
if (this.checkPrice(price)) {
this.computeChangePrice(price);
const res = await this.computeChangePrice({
price,
orderCode: this.orderCode
});
if (typeof res === "string") {
this.errorTip = res;
this.setChangePrice(0);
} else {
this.computePrice = res;
this.setChangePrice(price);
}
} else {
this.setChangePrice(0);
}
},
checkPrice(price) {
...
...
@@ -91,19 +110,8 @@ export default {
this.errorTip = "价格只能为正整数";
} else if (!/9$/.test(price)) {
this.errorTip = "出售价格必须以9结尾";
} else if (
this.goodsInfo.bidHighestPrice &&
price > this.goodsInfo.bidHighestPrice
) {
this.errorTip = "您的出价格过高";
} else if (+price === this.goodsInfo.goodPrice) {
} else if (+price === +this.goodsInfo.goodPrice) {
this.errorTip = "前后价格没有变化";
} else if (
this.goodsInfo.leastPrice &&
price > this.goodsInfo.leastPrice
) {
this.errorTip = "您的出价高于最低售价";
valid = true;
} else {
this.errorTip = "";
valid = true;
...
...
@@ -128,6 +136,10 @@ export default {
.ipt-number {
margin: 30px 0;
&.show-error {
margin-bottom: 0;
}
}
.error-tip {
...
...
apps/pages/order/order-list/mixins/order-action.js
View file @
7c42d4e
...
...
@@ -5,19 +5,24 @@ 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'
);
const
{
mapActions
,
mapMutations
,
mapState
}
=
createNamespacedHelpers
(
'order/orderList'
,
);
const
{
mapMutations
:
inSaleMapMutations
}
=
createNamespacedHelpers
(
'order/inSaleOrderList'
,
);
export
default
{
computed
:
{
...
mapState
([
'changePrice'
]),
},
methods
:
{
...
mapActions
([
'cancelTradeConfirmInfo'
,
'cancelTrade'
,
'deleteOrder'
,
'computeChangePrice'
,
'changePrice'
,
'c
onfirmC
hangePrice'
,
]),
...
mapMutations
([
'filterOrderList'
,
'resetData'
]),
...
inSaleMapMutations
([
'filterInSaleOrderList'
]),
...
...
@@ -158,16 +163,43 @@ export default {
price
:
goodPrice
,
});
if
(
typeof
computePriceInfo
===
'string'
)
{
this
.
$createToast
({
type
:
'alert'
,
txt
:
computePriceInfo
,
mask
:
true
,
}).
show
();
return
;
}
this
.
$createDialog
(
{
type
:
'prompt'
,
confirmBtn
:
{
text
:
'调整求购价'
},
cancelBtn
:
{
active
:
true
},
onConfirm
:
async
()
=>
{
if
(
!
this
.
changePrice
)
{
return
;
}
const
isOk
=
await
this
.
confirmChangePrice
({
price
:
this
.
changePrice
,
orderCode
,
});
if
(
isOk
)
{
this
.
resetData
();
this
.
fetchData
(
this
.
$route
.
params
);
}
},
},
createElement
=>
{
return
[
createElement
(
DialogChangeBidPrice
,
{
props
:
{
computePriceInfo
,
goodsInfo
},
props
:
{
computePriceInfo
,
goodsInfo
,
orderCode
,
},
slot
:
'content'
,
}),
];
...
...
apps/store/order/order-list.js
View file @
7c42d4e
...
...
@@ -10,6 +10,9 @@ const initailData = () => ({
currentStatus
:
null
,
routeParamStatus
:
null
,
isShowEmpty
:
false
,
// 求购调价
changePrice
:
0
,
});
export
default
function
()
{
...
...
@@ -49,6 +52,9 @@ export default function() {
state
.
pagetotal
=
0
;
state
.
pullUpLoad
=
true
;
},
setChangePrice
(
state
,
price
)
{
state
.
changePrice
=
price
;
},
resetData
(
state
)
{
const
s
=
initailData
();
...
...
@@ -168,16 +174,19 @@ export default function() {
},
);
return
res
.
code
===
200
?
res
.
data
:
null
;
return
res
.
code
===
200
?
res
.
data
:
res
.
message
||
''
;
},
// 买家调价
async
c
hangePrice
(
_
,
{
orderCode
,
price
})
{
async
c
onfirmChangePrice
({
commit
}
,
{
orderCode
,
price
})
{
const
res
=
await
this
.
$api
.
post
(
'/api/order/buyerask/changeprice'
,
{
orderCode
:
`
$
{
orderCode
}
`
,
price
:
+
price
,
});
if
(
res
.
code
)
{
commit
(
'setChangePrice'
,
0
);
}
return
res
.
code
===
200
?
res
.
data
:
null
;
},
},
...
...
Please
register
or
login
to post a comment