Commit 74fc6ae4 by 胡悦

下单

1 parent ea4b3257
...@@ -179,5 +179,38 @@ module.exports = { ...@@ -179,5 +179,38 @@ module.exports = {
projectName: 'boutique', projectName: 'boutique',
...data ...data
}) })
} },
// 根据商户号获取可选商品列表
getSelectOrderGoodsList(data){
return http.post({
method: 'dj.api.smartcarlife.selectOrderGoods.list',
projectName: 'boutique',
...data
})
},
/** 选择支付方式下单 */
createWithPay(data) {
console.log(data)
return http.post({
method: 'dj.api.smartcarlife.order.createWithPay',
projectName: 'boutique',
...data
})
},
/** 订单补录 */
supplementOrder(data) {
return http.post({
method: 'dj.api.smartcarlife.order.supplementOrder',
projectName: 'boutique',
...data
})
},
// 获取精品升级场景 太阳膜类商品部位数据
getPositionList(data) {
return http.post({
method: 'dj.api.smartcarlife.goodsPosition.list',
projectName: 'boutique',
...data
})
},
} }
...@@ -2,13 +2,14 @@ ...@@ -2,13 +2,14 @@
<view> <view>
<view v-for="(items, boxIdx) in formList" :key="boxIdx"> <view v-for="(items, boxIdx) in formList" :key="boxIdx">
<view class="cell-box"> <view class="cell-box">
<view v-for="(item, idx) in items" :key="idx" class="cell-row"> <template v-for="(item, idx) in items">
<view v-if="!item.hidden">
<view class="cell-row" :key="idx">
<view class="cell" @click="onCellClick(item)" :class="[ <view class="cell" @click="onCellClick(item)" :class="[
item.noBorder ? '' : 'border', item.noBorder ? '' : 'border',
item.onlyLabel ? 'small-height' : '', item.onlyLabel ? 'small-height' : '',
item.class item.class
]"> ]">
<template v-if="!item.hidden">
<view :class="['cell-label', { 'only-label': item.onlyLabel }]"> <view :class="['cell-label', { 'only-label': item.onlyLabel }]">
<view v-if="item.labellIcon" :class="['sprite-icon', `icon-${item.labellIcon}`]"></view> <view v-if="item.labellIcon" :class="['sprite-icon', `icon-${item.labellIcon}`]"></view>
{{ item.label }} {{ item.label }}
...@@ -18,8 +19,10 @@ ...@@ -18,8 +19,10 @@
<!-- 输入框 --> <!-- 输入框 -->
<template v-if="item.type === 'input'"> <template v-if="item.type === 'input'">
<view class="input-box"> <view class="input-box">
<input class="input-value" v-model="formData[item.value]" :type="item.inputType || 'text'" @blur="handleBlur($event, item)" :placeholder="item.placeholder || '请输入'" <input class="input-value" v-model="formData[item.value]" :type="item.inputType || 'text'"
:maxlength="item.maxlength || 500" /> @blur="handleBlur($event, item)" :placeholder="item.placeholder || '请输入'"
:maxlength="item.inputType === 'number' ? false : (item.maxlength || -1)"
@input="item.inputType === 'number' && item.maxlength ? (formData[item.value] = String($event.target.value).slice(0, item.maxlength)) : null" />
<view v-if="item.valueIcon" :class="['sprite-icon', `icon-${item.valueIcon}`]" <view v-if="item.valueIcon" :class="['sprite-icon', `icon-${item.valueIcon}`]"
@click="onValueClick(item)"></view> @click="onValueClick(item)"></view>
</view> </view>
...@@ -27,7 +30,7 @@ ...@@ -27,7 +30,7 @@
<!-- 下拉选择 --> <!-- 下拉选择 -->
<template v-else-if="item.type === 'select'"> <template v-else-if="item.type === 'select'">
<view class="value"> <view class="value">
<template v-if="formData[item.value] && formData[item.value]"> <template v-if="!item.addHtml && formData[item.value] && formData[item.value]">
<template v-if="item.showText && userInfo && userInfo[item.showText]"> <template v-if="item.showText && userInfo && userInfo[item.showText]">
{{ userInfo[item.showText] }}<text>|</text> {{ userInfo[item.showText] }}<text>|</text>
</template> </template>
...@@ -44,7 +47,8 @@ ...@@ -44,7 +47,8 @@
<radio-group class="radio-group value" @change="onRadioChange($event, item)"> <radio-group class="radio-group value" @change="onRadioChange($event, item)">
<label class="uni-list-cell uni-list-cell-pd" v-for="radio in item.radioList" <label class="uni-list-cell uni-list-cell-pd" v-for="radio in item.radioList"
:key="radio.value + item.value"> :key="radio.value + item.value">
<radio style="transform:scale(0.7)" :value="radio.value" :checked="radio.value == item.current" /> <radio style="transform:scale(0.7)" :value="radio.value" :disabled="radio.disabled"
:checked="radio.value == item.current" />
<view class="radio-name">{{ radio.name }}</view> <view class="radio-name">{{ radio.name }}</view>
</label> </label>
</radio-group> </radio-group>
...@@ -56,11 +60,12 @@ ...@@ -56,11 +60,12 @@
:maxlength="item.maxlength"></textarea> :maxlength="item.maxlength"></textarea>
</template> </template>
</view> </view>
</template>
</view> </view>
<slot v-if="item.addHtml" :name="item.addHtml"></slot> <slot v-if="item.addHtml" :name="item.addHtml"></slot>
</view> </view>
</view> </view>
</template>
</view>
</view> </view>
</view> </view>
</template> </template>
...@@ -124,9 +129,11 @@ export default { ...@@ -124,9 +129,11 @@ export default {
overflow: hidden; overflow: hidden;
margin-bottom: toRpx(18); margin-bottom: toRpx(18);
} }
.cell-row { .cell-row {
padding-left: toRpx(32); padding-left: toRpx(32);
} }
.cell { .cell {
display: flex; display: flex;
align-items: center; align-items: center;
......
<template>
<view>
<view class="package-list">
<view class="package-item">
<view class="header">
<view class="header-left">
<view class="sprite-icon icon-blue-delete"></view>
<view class="name">平步青云套餐</view>
</view>
<view class="price">¥6660.00</view>
</view>
<view class="goods-item">
<view class="goods-name">AITO汽车专享 M5中控屏钢化保护膜</view>
<view class="alias-name">商品别名:阿尔法 T5极狐非三电整车延保(新车2年6万公里)</view>
<view class="front-gear-box">
<view class="front-gear-input-box">
<view class="front-gear-label">前档玻璃</view>
<view class="front-gear-input">
<view class="unit">¥</view>
<input class="uni-input" type="digit" placeholder="请输入价格" placeholder-style="font-size: 14px" />
</view>
</view>
<view class="control">
<view class="minus">-</view>
<input class="uni-input control-input" type="number" />
<view class="add">+</view>
</view>
</view>
</view>
<view class="goods-item">
<view class="goods-name">AITO汽车专享 M5中控屏钢化保护膜</view>
<view class="alias-name">商品别名:阿尔法 T5极狐非三电整车延保(新车2年6万公里)</view>
<view class="front-gear-box">
<view class="front-gear-input-box">
<view class="front-gear-label">前档玻璃</view>
<view class="front-gear-input">
<view class="unit">¥</view>
<input class="uni-input" type="digit" placeholder="请输入价格" placeholder-style="font-size: 14px" />
</view>
</view>
<view class="control">
<view class="minus">-</view>
<input class="uni-input control-input" type="number" />
<view class="add">+</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'Package'
}
</script>
<style scoped lang="scss">
.front-gear-box {
display: flex;
justify-content: space-between;
margin-top: toRpx(24);
.front-gear-input-box {
display: flex;
align-items: center;
.front-gear-label {
font-size: toRpx(24);
margin-right: toRpx(24);
color: #999999;
}
.front-gear-input {
position: relative;
display: flex;
border: toRpx(2) solid #eff0f2;
background-color: #fff;
font-size: toRpx(28);
height: toRpx(70);
width: toRpx(250);
line-height: toRpx(70);
text-align: right;
.uni-input {
padding: 0 toRpx(32);
height: 100%;
}
.unit {
position: absolute;
top: 50%;
left: toRpx(32);
transform: translateY(-50%);
}
}
}
.control {
display: flex;
align-items: center;
.control-input {
width: toRpx(94);
height: toRpx(74);
background-color: #fff;
border: toRpx(2) solid #eff0f2;
padding: 0 toRpx(10);
text-align: center;
}
.minus,
.add {
width: toRpx(80);
height: toRpx(74);
line-height: toRpx(70);
text-align: center;
background-color: #fff;
border-top: toRpx(2) solid #eff0f2;
border-bottom: toRpx(2) solid #eff0f2;
}
.minus {
border-radius: toRpx(12) 0 0 toRpx(12);
border-left: toRpx(2) solid #eff0f2;
}
.add {
border-radius: 0 toRpx(12) toRpx(12) 0;
border-right: toRpx(2) solid #eff0f2;
}
}
}
.package-list {
padding: toRpx(12) toRpx(32) toRpx(12) 0;
.package-item {
background-color: #f5f7fa;
border-radius: toRpx(16);
margin-bottom: toRpx(16);
.header {
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: toRpx(1.6) solid #dce1e6;
padding: toRpx(24);
&-left {
display: flex;
align-items: center;
font-size: toRpx(28);
.name {
margin-left: toRpx(26);
color: #999;
}
.price {
color: #666;
}
}
}
.goods-item {
padding: toRpx(24);
border-bottom: toRpx(1.6) solid #dce1e6;
&:last-child {
border-bottom: none;
}
.goods-name {
color: #ff781f;
font-size: toRpx(28);
}
.alias-name {
margin-top: toRpx(12);
font-size: toRpx(24);
color: #666;
}
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<view>
<view class="shop-list">
<view class="shop-item" v-for="(item, index) in list" :key="item.goods.goodsId">
<view class="sprite-icon icon-blue-delete"></view>
<view class="right">
<view class="shop-name">商品名称:{{ item.goods.goodsAlias || item.goods.upgradeGoodsName ||
item.goods.goodsInfo.goodsName }}</view>
<!-- <view class="alias">商品别名:{{ item.goods.goodsAlias }}</view> -->
<view class="front-gear-box">
<view class="front-gear-input-box">
<view class="front-gear-label"
v-if="(item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition) && (item.goods.goodsInfo.goodsType == 1 || item.goods.upgradeGoodsType == 1 || item.goods.goodsInfo.goodsType == baseConfigData.selfBuildFilmType || item.goods.upgradeGoodsType == baseConfigData.selfBuildFilmType)">
{{ formatPosition((item.goods.merchantGoodsPosition || item.goods.upgradeGoodsPosition),
positionTypeList)}}</view>
<view class="front-gear-input">
<view class="unit">¥</view>
<input class="uni-input" type="digit" placeholder="请输入价格" placeholder-style="font-size: 14px" v-model="item.goods.sellPrice" @input="validatePrice($event, item, index)" />
</view>
</view>
<view class="control">
<view class="minus" @click="decreaseNumber(item)">-</view>
<input class="uni-input control-input" type="number" v-model="item.goods.number" @input="validateNumber($event, item)" />
<view class="add" @click="increaseNumber(item)">+</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'Product',
props: {
list: {
type: Array,
default: []
},
positionTypeList: {
type: Array,
default: []
},
baseConfigData: {
type: Object,
default: {}
}
},
created() {
// 初始化商品数量
this.list.forEach(item => {
if (!item.goods.number) {
this.$set(item.goods, 'number', '1')
}
})
},
methods: {
// 格式化位置信息
formatPosition(item, positionTypeList) {
const filterData = positionTypeList.filter(v => v.positionValue == item)
return (filterData.length && filterData[0] && filterData[0].positionName) || ''
},
// 验证价格输入
validatePrice(event, item) {
let value = event.detail.value
// 限制只能输入数字和小数点
value = value.replace(/[^\d.]/g, '')
// 限制只能有一个小数点
if (value.split('.').length > 2) {
value = value.slice(0, value.lastIndexOf('.')) + value.slice(value.lastIndexOf('.') + 1)
}
// 限制最多两位小数
if (value.includes('.')) {
const parts = value.split('.')
if (parts[1].length > 2) {
parts[1] = parts[1].substring(0, 2)
value = parts.join('.')
}
}
// 限制最大值为100000
if (parseFloat(value) > 100000) {
value = '100000'
}
// 限制最小值为0
if (parseFloat(value) < 0) {
value = '0'
}
if (item.goods.validMinSellPrice === 'Y' && item.goods.minSellPrice && parseFloat(value) < parseFloat(item.goods.minSellPrice)) {
console.log('最小值', item.goods.minSellPrice)
value = item.goods.minSellPrice.toString()
}
// 更新值
this.$set(item.goods, 'sellPrice', value)
},
// 验证数量输入
validateNumber(event, item) {
let value = event.detail.value
// 限制只能输入整数
value = value.replace(/[^\d]/g, '')
// 如果为空或0,设置为1
if (!value || parseInt(value) === 0) {
value = '1'
}
// 更新值
this.$set(item.goods, 'number', value)
},
// 增加数量
increaseNumber(item) {
if (!item.goods.number) {
this.$set(item.goods, 'number', '1')
} else {
const newValue = parseInt(item.goods.number) + 1
this.$set(item.goods, 'number', newValue.toString())
}
},
// 减少数量
decreaseNumber(item) {
if (!item.goods.number || parseInt(item.goods.number) <= 1) {
this.$set(item.goods, 'number', '1')
} else {
const newValue = parseInt(item.goods.number) - 1
this.$set(item.goods, 'number', newValue.toString())
}
}
}
}
</script>
<style scoped lang="scss">
.shop-list {
padding: toRpx(12) toRpx(32) toRpx(12) 0;
.shop-item {
display: flex;
align-items: center;
background-color: #f5f7fa;
border-radius: toRpx(16);
margin-bottom: toRpx(16);
padding: toRpx(24);
.right {
flex: 1;
font-size: toRpx(28);
margin-left: toRpx(24);
.shop-name {
color: #ff781f;
}
.alias {
margin-top: toRpx(12);
font-size: toRpx(24);
color: #666;
}
}
}
}
.front-gear-box {
display: flex;
justify-content: space-between;
margin-top: toRpx(24);
.front-gear-input-box {
display: flex;
align-items: center;
.front-gear-label {
font-size: toRpx(24);
margin-right: toRpx(24);
color: #999999;
}
.front-gear-input {
position: relative;
display: flex;
border: toRpx(2) solid #eff0f2;
background-color: #fff;
font-size: toRpx(28);
height: toRpx(70);
width: toRpx(250);
line-height: toRpx(70);
text-align: right;
.uni-input {
padding: 0 toRpx(32);
height: 100%;
}
.unit {
position: absolute;
top: 50%;
left: toRpx(32);
transform: translateY(-50%);
}
}
}
.control {
display: flex;
align-items: center;
.control-input {
width: toRpx(94);
height: toRpx(74);
background-color: #fff;
border: toRpx(2) solid #eff0f2;
padding: 0 toRpx(10);
text-align: center;
}
.minus,
.add {
width: toRpx(80);
height: toRpx(74);
line-height: toRpx(70);
text-align: center;
background-color: #fff;
border-top: toRpx(2) solid #eff0f2;
border-bottom: toRpx(2) solid #eff0f2;
}
.minus {
border-radius: toRpx(12) 0 0 toRpx(12);
border-left: toRpx(2) solid #eff0f2;
}
.add {
border-radius: 0 toRpx(12) toRpx(12) 0;
border-right: toRpx(2) solid #eff0f2;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -90,7 +90,7 @@ const FORM_LIST = [ ...@@ -90,7 +90,7 @@ const FORM_LIST = [
key: 'carInfo', key: 'carInfo',
}, },
{ {
label: '车架号', label: '车架号(VIN)',
value: 'standNo', value: 'standNo',
maxlength: '17', maxlength: '17',
type: 'input' type: 'input'
...@@ -134,59 +134,62 @@ const FORM_LIST = [ ...@@ -134,59 +134,62 @@ const FORM_LIST = [
}, },
{ {
label: '前档', label: '前档',
value: 'user', value: 'frontGear',
type: 'select', type: 'select',
key: 'name', key: 'name',
labellIcon: 'front-gear', labellIcon: 'front-gear',
addHtml: 'product' addHtml: 'frontGear',
hidden: true
}, },
{ {
label: '前侧窗玻璃', label: '前侧窗玻璃',
value: 'user', value: 'frontWindow',
type: 'select', type: 'select',
key: 'name', key: 'name',
labellIcon: 'front-window', labellIcon: 'front-window',
addHtml: 'product' addHtml: 'frontWindow',
hidden: true
}, },
{ {
label: '后侧窗玻璃', label: '后侧窗玻璃',
value: 'user', value: 'rearGear',
type: 'select', type: 'select',
key: 'name', key: 'name',
labellIcon: 'rear-gear', labellIcon: 'rear-gear',
addHtml: 'product' addHtml: 'rearGear',
hidden: true
}, },
{ {
label: '后档', label: '后档',
value: 'user', value: 'rearWindow',
type: 'select', type: 'select',
key: 'name', key: 'name',
labellIcon: 'rear-window', labellIcon: 'rear-window',
addHtml: 'product' addHtml: 'rearWindow',
hidden: true
}, },
{ {
label: '天窗', label: '天窗',
value: 'user', value: 'sunRoof',
type: 'select', type: 'select',
key: 'name', key: 'name',
labellIcon: 'sun-roof', labellIcon: 'sun-roof',
addHtml: 'product' addHtml: 'sunRoof',
hidden: true
}, },
{ {
label: '套餐', label: '套餐',
value: 'couponInfo', value: 'couponInfo',
type: 'select', type: 'select',
key: 'name', key: 'name',
required: true, // addHtml: 'package'
addHtml: 'package'
}, },
{ {
label: '其他精品', label: '其他精品',
value: 'couponInfo', value: 'couponInfo',
type: 'select', type: 'select',
key: 'name', key: 'name',
required: true, // addHtml: ''
addHtml: 'product'
}, },
{ {
label: '收款方式', label: '收款方式',
...@@ -197,11 +200,13 @@ const FORM_LIST = [ ...@@ -197,11 +200,13 @@ const FORM_LIST = [
radioList: [ radioList: [
{ {
value: '0', value: '0',
name: '嘀加收款' name: '嘀加收款',
disabled: false
}, },
{ {
value: '1', value: '1',
name: '4s店收款' name: '4s店收款',
disabled: false
} }
], ],
}, },
...@@ -212,18 +217,18 @@ const FORM_LIST = [ ...@@ -212,18 +217,18 @@ const FORM_LIST = [
key: 'name', key: 'name',
current: '0', current: '0',
radioList: [ radioList: [
{ // {
value: '3', // value: '3',
name: 'POS机' // name: 'POS机'
}, // },
{ // {
value: '6', // value: '6',
name: '对公转账' // name: '对公转账'
}, // },
{ // {
value: '7', // value: '7',
name: '其他收款' // name: '其他收款'
} // }
], ],
addHtml: 'otherPay' addHtml: 'otherPay'
}, },
...@@ -240,14 +245,14 @@ const FORM_LIST = [ ...@@ -240,14 +245,14 @@ const FORM_LIST = [
] ]
] ]
const payType = [ const payTypeList = [
{ {
value: '1', value: '1',
name: '微信支付' name: '微信支付'
}, },
{ {
value: '2', value: '2',
name: '线下收款' name: '门店收款'
}, },
{ {
value: '3', value: '3',
...@@ -311,11 +316,15 @@ const popupTypeEnum = { ...@@ -311,11 +316,15 @@ const popupTypeEnum = {
5: { 5: {
key: 'couponInfo', key: 'couponInfo',
list: '', list: '',
},
6: {
key: 'frontGear',
list: '',
} }
} }
export { export {
FORM_LIST, FORM_LIST,
popupTypeEnum, popupTypeEnum,
payType payTypeList
} }
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!