Authored by TaoHuang

Merge remote-tracking branch 'origin/develop' into develop

<template>
<CubeInput v-bind="$attrs" v-bind:value="value" v-on="inputListeners" :maxlength="8" class="input-number">
<CubeInput v-bind="$attrs" v-bind:value="value" v-bind:needBlur="needBlur" v-on="inputListeners" :maxlength="8" class="input-number">
<span slot="prepend">
<slot name="prepend"></slot>
</span>
... ... @@ -14,7 +14,7 @@ import {Input} from 'cube-ui';
export default {
name: 'InputUfo',
props: ['value'],
props: ['value', 'needBlur'],
computed: {
inputListeners() {
return Object.assign({},
... ... @@ -22,11 +22,21 @@ export default {
{
input: (value) => {
this.$emit('input', value);
},
blur: () => {
this.$emit('blur', this.value);
}
}
);
}
},
methods: {
onBlur() {
if (this.needBlur) {
}
}
},
components: {CubeInput: Input}
};
</script>
... ...
... ... @@ -10,8 +10,8 @@
</div>
<div class="modal-footer">
<slot name="footer">
<button class="btn" :class="{active: loading}" type="button" @click="onSure">{{sureText}}</button>
<button class="btn" type="button" @click="onCancel">{{cancelText}}</button>
<button class="btn" v-if="sureText" :class="{active: loading}" type="button" @click="onSure">{{sureText}}</button>
<button class="btn cancel-btn" v-if="cancelText" type="button" @click="onCancel">{{cancelText}}</button>
</slot>
</div>
</div>
... ... @@ -29,11 +29,11 @@ export default {
loading: Boolean,
sureText: {
type: String,
default: '确认'
default: ''
},
cancelText: {
type: String,
default: '取消'
default: ''
}
},
methods: {
... ... @@ -119,7 +119,7 @@ export default {
display: flex;
button {
width: 50%;
width: 100%;
overflow: hidden;
height: 100px;
background: none;
... ... @@ -129,6 +129,10 @@ export default {
color: #c94353;
font-weight: 500;
}
&.cancel-btn {
color: #000;
}
}
button + button {
... ...
... ... @@ -6,12 +6,12 @@
<ImgSize class="pro-img" :src="noEntryOrderInfo.goodsInfo.goodImg || ''" :width="200" :height="200"></ImgSize>
<div class="pro-info">
<p class="pro-name">{{noEntryOrderInfo.goodsInfo.colorName}}, {{noEntryOrderInfo.goodsInfo.sizeName}}码</p>
<p class="stock-info ufo-font">最低售价: ¥{{noEntryOrderInfo.goodsInfo.leastPrice}}</p>
<p class="stock-info ufo-font">最低售价: ¥{{noEntryOrderInfo.goodsInfo.leastPrice || noEntryOrderInfo.goodsInfo.price}}</p>
</div>
</div>
<div class="input-container">
<InputUfo type="number" placeholder="定价需以9结尾.例如1999"
:maxlength="8" class="ipt-number" v-model="chgPrice">
:maxlength="8" class="ipt-number ufo-font" v-model="chgPrice" @blur="onChange">
<span class="prepend" slot="prepend">¥</span>
</InputUfo>
</div>
... ... @@ -21,8 +21,8 @@
</div>
<div class="fee-container">
<div class="fee-line">
<p class="fee-title">平台费用:</p>
<p class="fee-price">{{platformFee}}</p>
<p class="fee-title">平台费用: <i class="iconfont iconquestion" @click="showFeeDetail"></i></p>
<p class="fee-price">{{platformFee.amount}}</p>
</div>
<div class="fee-line">
<p class="fee-title">银行转账费(1%):</p>
... ... @@ -47,8 +47,37 @@
</p>
</div>
</div>
</div>
<div class="submit-container">
<div class="agree-container">
<div class="checkbox">
<Checkbox :option="labelOption" shape="square" v-model="isAgree"></Checkbox>
</div>
<a @click="showAgreement">卖家协议</a>
</div>
<div :class="['submit-button', (isAgree && calced) ? 'active' : '']">
<button @click="changePrice">提交</button>
</div>
</div>
<Modal v-model="platformFeeModalVisible" :transfer="true" cancel-text="我知道了">
<div class="fee-dialog-container">
<p class="modal-title">平台费用</p>
<p class="fee-line">
<span class="fee-title">商品鉴定费:</span>
<span class="fee-price">{{platformFee.appraiseFee}}</span>
</p>
<p class="fee-line">
<span class="fee-title">商品包装费:</span>
<span class="fee-price">{{platformFee.packageFee}}</span>
</p>
<p class="fee-line total">
<span class="fee-title">平台服务费:</span>
<span class="fee-price">{{platformFee.serviceFee}}</span>
</p>
</div>
</Modal>
</LayoutApp>
</template>
... ... @@ -58,22 +87,35 @@ import ScrollView from '../../../components/layout/scroll-view';
import ImgSize from '../../../components/img-size';
import {createNamespacedHelpers} from 'vuex';
import InputUfo from './components/input-ufo';
import {Checkbox} from 'cube-ui';
import {get} from 'lodash';
import Modal from './components/modal';
const {mapState, mapActions, mapMutations} = createNamespacedHelpers('order/priceChange');
const {mapState, mapActions} = createNamespacedHelpers('order/priceChange');
export default {
name: 'noEntryDetail',
components: {InputUfo, ScrollView, LayoutApp, ImgSize},
components: {Modal, InputUfo, ScrollView, LayoutApp, ImgSize, Checkbox},
data() {
return {
title: '',
platformFee: '-¥0',
platformFeeModalVisible: false,
platformFee: {
amount: '-¥0',
appraiseFee: '¥0.00',
packageFee: '¥0.00',
serviceFee: '¥0.00'
},
bankTransferFee: '-¥0',
income: '¥0',
errorTip: '',
chgPrice: '',
calced: false,
earnestMoney: '¥0',
isAgree: false,
labelOption: {
label: '我已阅读并同意'
}
};
},
asyncData({store, router}) {
... ... @@ -81,12 +123,87 @@ export default {
},
mounted() {
// this.fetchOrder({orderCode: this.$route.params.orderCode});
// this.inputChange = debounce(this.onChange.bind(this), 500);
},
computed: {
...mapState(['noEntryOrderInfo']),
...mapState(['noEntryOrderInfo', 'fetching']),
postLoading() {
return this.fetchingChangePrice || !this.calced;
}
},
watch: {
chgPrice(newVal) {
this.calced = false;
this.platformFee = '-¥0';
this.bankTransferFee = '-¥0';
this.income = '¥0';
this.earnestMoney = '¥0';
}
},
methods: {
...mapActions(['fetchOrder'])
...mapActions(['fetchOrder', 'postNoEntryCalcPrice', 'postNoEntryChangePrice']),
showAgreement() {
console.log('showAgreement');
},
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 {
this.errorTip = '';
valid = true;
}
console.log(this.errorTip, valid);
return valid;
},
changePrice() {
},
async calcPrice(price) {
const result = await this.postNoEntryCalcPrice({
price: price,
skup: this.noEntryOrderInfo.goodsInfo.skup
});
console.log(result);
if (result && result.code === 200) {
this.platformFee = get(result, 'data.platformFee', '');
this.bankTransferFee = get(result, 'data.bankTransferFee', '');
this.income = '¥' + get(result, 'data.income', '');
this.earnestMoney = '¥' + get(result, 'data.earnestMoney', '');
this.calced = true;
} else {
if (result.message) {
this.errorTip = result.message;
}
this.calced = false;
this.$createToast({
txt: this.errorTip,
type: 'warn'
}).show();
}
},
onChange(price) { // 价格改变时(文本框离开焦点)
if (this.checkPrice(price)) {
this.calcPrice(price);
} else {
this.$createToast({
txt: this.errorTip,
type: 'warn'
}).show();
}
},
showFeeDetail() { // 显示平台费用详情
this.platformFeeModalVisible = true;
}
}
};
</script>
... ... @@ -221,6 +338,10 @@ export default {
color: #c94353;
}
}
.iconquestion {
font-size: 28px;
}
}
}
... ... @@ -229,7 +350,6 @@ export default {
width: 690px;
margin: 40px auto 20px auto;
overflow: hidden;
border-bottom: 1px solid #f0f0f0;
.icon-container {
position: absolute;
... ... @@ -250,6 +370,110 @@ export default {
.address-info {
overflow: hidden;
padding: 0 0 20px 100px;
.user-name {
font-size: 32px;
font-weight: 500;
line-height: 36px;
margin-bottom: 10px;
}
.user-address {
font-size: 24px;
color: #999;
line-height: 30px;
margin-bottom: 10px;
}
.user-phone {
font-size: 28px;
font-weight: bold;
line-height: 32px;
}
}
}
}
/deep/ .modal-content {
width: 570px;
}
.fee-dialog-container {
width: 100%;
.modal-title {
line-height: 120px;
text-align: center;
font-size: 28px;
}
.fee-line {
margin-bottom: 20px;
color: #000;
font-size: 28px;
display: flex;
.fee-title {
width: 50%;
}
.fee-price {
width: 50%;
text-align: right;
}
}
}
.submit-container {
width: 100%;
height: 180px;
position: fixed;
bottom: 0;
z-index: 9;
.agree-container {
width: 100%;
height: 80px;
border-top: 1px solid #f0f0f0;
background-color: #fff;
a {
display: inline-block;
text-decoration: underline;
color: #64ad88;
}
.checkbox {
display: inline-block;
}
/deep/ .cube-checkbox-wrap {
padding: 10px 0;
color: #999;
.cube-checkbox-label {
font-size: 0.6rem;
}
}
.cube-checkbox_checked .cube-checkbox-ui i {
color: #0c2b48;
}
}
.submit-button {
width: 100%;
height: 100px;
background-color: #ccc;
button {
width: 100%;
height: 100%;
color: #fff;
}
&.active {
background-color: #0c2b48;
}
}
}
... ...
... ... @@ -159,6 +159,12 @@ export default {
return result || {};
},
/**
* 入驻商家试算调价
* @param commit
* @param payload
* @returns {Promise<*|{}>}
*/
async postCalcPrice({commit}, payload) {
commit(Types.POST_CALCPRICE_REQUEST);
const result = await this.$api.get('/api/ufo/sellerOrder/computeAdjustPrice', payload);
... ... @@ -175,6 +181,28 @@ export default {
},
/**
* 未入驻商家试算调价
* @param commit
* @param payload
* @returns {Promise<{}>}
*/
async postNoEntryCalcPrice({commit}, payload) {
commit(Types.POST_NOENTRY_CALCPRICE_REQUEST);
const result = await this.$api.get('/api/ufo/notEntrySeller/computeChangePrice', payload);
if (result && result.code === 200) {
commit(Types.POST_NOENTRY_CALCPRICE_SUCCESS, {
order: result.data
});
} else {
commit(Types.POST_NOENTRY_CALCPRICE_FAILED);
}
return result || {};
},
/**
* 调价
* @param commit
* @param payload
... ... @@ -193,5 +221,26 @@ export default {
}
return result || {};
},
/**
* 未入驻商家调价
* @param commit
* @param payload
* @returns {Promise<*|{}>}
*/
async postNoEntryChangePrice({commit}, payload) {
commit(Types.POST_NOENTRY_CHANGE_PRICE_REQUEST);
const result = await this.$api.get('/api/ufo/notEntrySeller/changePrice', payload);
if (result && result.code === 200) {
commit(Types.POST_NOENTRY_CHANGE_PRICE_SUCCESS, {
order: result.data
});
} else {
commit(Types.POST_NOENTRY_CHANGE_PRICE_FAILED);
}
return result || {};
}
};
... ...
... ... @@ -87,5 +87,30 @@ export default {
[Types.POST_CALCPRICE_SUCCESS](state) {
state.fetchingCalcPrice = true;
},
[Types.POST_NOENTRY_CALCPRICE_REQUEST](state) {
state.fetchingCalcPrice = true;
},
[Types.POST_NOENTRY_CALCPRICE_FAILED](state) {
state.fetchingCalcPrice = false;
},
[Types.POST_NOENTRY_CALCPRICE_SUCCESS](state) {
state.fetchingCalcPrice = false;
},
[Types.POST_NOENTRY_CHANGE_PRICE_REQUEST](state) {
state.fetchingChangePrice = true;
},
[Types.POST_NOENTRY_CHANGE_PRICE_FAILED](state) {
state.fetchingChangePrice = false;
},
[Types.POST_NOENTRY_CHANGE_PRICE_SUCCESS](state) {
state.fetchingChangePrice = false;
}
};
... ...
... ... @@ -73,6 +73,33 @@ module.exports = {
},
},
// 未入驻商家试算价格
'/api/ufo/notEntrySeller/computeChangePrice': {
auth: true,
accessLog: true,
checkSign: true,
ufo: true,
api: 'ufo.notEntrySeller.computeChangePrice',
params: {
price: { type: Number },
skup: { type: Number }
},
},
// 未入驻商家调价
'/api/ufo/notEntrySeller/changePrice': {
auth: true,
accessLog: true,
checkSign: true,
ufo: true,
api: 'ufo.notEntrySeller.changePrice',
params: {
address_id: {type: Number},
price: { type: Number },
skup: { type: Number }
},
},
// 调价
'/api/ufo/sellerOrder/batchAdjustPrice': {
auth: true,
... ...
... ... @@ -46,8 +46,6 @@ module.exports = (req, res, next) => {
// Todo 删除 600032996
// req.user.uid = 600043484;
res.locals.isLogin = Boolean(req.user.uid); // 用户是否登录
if (_.get(req, 'user.appSessionType') === 'miniapp') {
// miniapp环境下调用接口使用web的version
... ...