pages/order/register/index

pages/order/edit/index2
增加选择车牌组件
This commit is contained in:
xiaolian
2024-07-18 10:38:37 +08:00
parent 68c7d5d698
commit fc345108e7
10 changed files with 102 additions and 43 deletions
+8 -2
View File
@@ -5,7 +5,7 @@
.btn-36afa2{background: #36afa2;border:none;}
.btn-36afa2::after{border:none;}
.btn-36afa2-hover{background:#2fa195;}
.btn-36afa2[disabled]{background:#ddd !important;border:none !important;color:#bbb !important;}
.btn-36afa2[disabled]{background:#f0f0f0 !important;border:none !important;color:#ccc !important;}
.btn-f9394d{background: #f9394d;border:none;}
.btn-f9394d::after{border:none;}
.btn-f9394d-hover{background:#f0293e;}
@@ -18,4 +18,10 @@
.btn-no-border::after{border:none;}
.btn-no-border[disabled]{background:#ddd !important;border:none;color:#bbb;}
.btn-no-bg{background:none;}
.btn-inset-shadow{box-shadow:inset 0rpx 0rpx 10rpx 5rpx rgba(0, 0, 0, .2);}
.btn-inset-shadow{box-shadow:inset 0rpx 0rpx 10rpx 5rpx rgba(0, 0, 0, .2);}
.btn-f0{background:#f0f0f0;border:none;}
.btn-f0::after{border:none;}
.btn-f0-hover{background:#ededed;}
.btn-f0[disabled]{background:#ccc !important;border:none !important;}
+52 -27
View File
@@ -1,4 +1,7 @@
// components/brandSelect/index.js
import _ from '../../commons/js/commons'
const app = getApp()
let debouncetimer = null; //函数防抖-间隔时间
Component({
/**
@@ -34,12 +37,16 @@ Component({
value: 'background-color: rgba(0, 0, 0, 0.7)'
},
},
attached(){
debouncetimer = null
},
observers: {
'show': function (value) {
// 在 numberA 或者 numberB 被设置时,执行这个函数
this.setData({
show_page: value,
cur: -1
cur: -1,
item: {}
})
}
},
@@ -51,41 +58,27 @@ Component({
show_page: false,
// list: [],
list: [{
id: 1,
name: '宝马'
},{
id: 1,
name: '宝马'
},{
id: 1,
name: '宝马'
},{
id: 1,
name: '宝马'
},{
id: 1,
name: '宝马'
},{
name: '宝马'
},{
name: '宝马'
},{
name: '宝马'
},{
name: '宝马'
},{
name: '宝马'
},{
name: '宝马'
},{
name: '宝马'
},{
name: '宝马'
},{
name: '宝马'
},{
name: '宝马'
},{
name: '宝马'
},{
id: 1,
name: '宝马'
}],
cur: -1
cur: -1,
keyword: '',
item: {}
},
/**
@@ -106,8 +99,8 @@ Component({
// console.log(res)
},
onLeave(res) {
// console.log(res)
this.triggerEvent('leave', {index: this.data.cur})
console.log(this.data.item)
this.triggerEvent('leave', {index: this.data.cur,item: this.data.list[this.data.cur]})
},
onAfterLeave(res) {
// console.log(res)
@@ -119,11 +112,43 @@ Component({
exit() {
this.setData({ show_page: false })
},
cancel() {
this.setData({ show_page: false, cur: -1,item: {} })
},
bindInputKeyword(e){
let that = this
that.debounce(function(){
that.setData({
keyword: e.detail.value
})
console.log(1)
},200)
},
bindSelectIndex(e){
console.log(e)
this.setData({
cur: e.currentTarget.dataset.index
})
}
},
/**
* 函数防抖
* @param {*} fn
* @param {*} wait
* @returns
*/
debounce(fn, wait) {
var gapTime = wait || 200; //间隔时间,如果interval不传,则默认200ms
return (function () {
var context = this
var args = arguments
if (debouncetimer) {
clearTimeout(debouncetimer);
debouncetimer = null;
}
debouncetimer = setTimeout(function () {
fn.apply(context, args) //保持this和参数
}, gapTime)
})()
},
}
})
+5 -4
View File
@@ -4,7 +4,7 @@
<view class="detail-page fn-flex" style="flex-direction:column;">
<view class="inner30">
<view class="ulib-r20 bds-2-eb text-center pt15 pb15">
<input placeholder="请输入品牌名" value="" />
<input placeholder="请输入品牌名" value="{{keyword}}" bindinput="bindInputKeyword"/>
</view>
</view>
<view class="list fn-flex-item relative">
@@ -19,12 +19,13 @@
</view>
</block>
</scroll-view>
</view>
</view>
<!-- <view class="color-fff">请输入品牌名</view> -->
<listmore wx:else isMiddle="{{true}}" noDataMsg="请输入品牌名" isNoData="{{true}}"></listmore>
</view>
<view class="pb40 pl80 pr80">
<button class="btn btn-36afa2 color-fff" style="transition: .2s all ease;" hover-class="btn-36afa2-hover" bindtap="exit" disabled="{{!(cur>-1)}}">我选好了</button>
<view class="pb40 pl80 pr80 fn-flex">
<button class="btn btn-36afa2 color-fff fn-flex-item" style="transition: .2s all ease;" hover-class="btn-36afa2-hover" bindtap="exit" disabled="{{!(cur>-1)}}">我选好了</button>
<button class="btn btn-f0 color-ccc ml30" style="transition: .2s all ease;" hover-class="btn-f0-hover" bindtap="cancel">取消</button>
</view>
</view>
+2 -2
View File
@@ -39,8 +39,8 @@
</view>
-->
</view>
<!-- <button bindtap="bindShowBrand">1111</button> -->
<!-- <brandSelect show="{{brand_page_show}}"></brandSelect> -->
<button bindtap="bindShowBrand">1111</button>
<brandSelect show="{{brand_page_show}}"></brandSelect>
</view>
<lcb-footer></lcb-footer>
+8
View File
@@ -59,6 +59,7 @@ Page({
confirm_amount: '', //定⾦
discount_amount: '', //⻋身优惠
business_type: 0,
brand_page_show: false
},
//生命周期函数--监听页面加载
onLoad: function (options) {
@@ -579,4 +580,11 @@ Page({
}
},
//显示选择品牌
bindShowBrand(){
this.setData({
brand_page_show: true
})
}
})
+3 -1
View File
@@ -1,4 +1,6 @@
{
"navigationBarTitleText": "编辑订单",
"usingComponents": {}
"usingComponents": {
"brandSelect": "/components/brandSelect/index"
}
}
+7 -3
View File
@@ -14,12 +14,15 @@
<view wx:if="{{step == 2}}">
<view class="relative bbs-1-eb pl190 last-b-none">
<view class="absolute left-0 box-middle font-28 color-333">车辆品牌<text class="color-f9394d">*</text></view>
<view class="pt30 pb30 text-right font-28 color-666">
<picker bindchange="changeBrand" value="{{brandIndex}}" range="{{brandArray}}">
<view class="pt30 pb30 text-right font-28 color-666" bindtap="bindShowBrand">
<!-- <picker bindchange="changeBrand" value="{{brandIndex}}" range="{{brandArray}}">
<text class="color-ccc" wx:if="{{brandIndex == -1}}">请选择</text>
<text wx:else>{{brandArray[brandIndex]}}</text>
<i class="iconfont ml5 icon-gengduo"></i>
</picker>
</picker> -->
<text class="color-ccc" wx:if="{{1}}">请选择</text>
<!-- <text wx:else>{{brandArray[brandIndex]}}</text> -->
<i class="iconfont ml5 icon-gengduo"></i>
</view>
</view>
<view class="relative bbs-1-eb pl190 last-b-none" wx:if="{{brandIndex != -1}}">
@@ -235,6 +238,7 @@
</view>
<!-- <lcb-footer></lcb-footer> -->
<!-- <lcb-backChannel></lcb-backChannel> -->
<brandSelect show="{{brand_page_show}}"></brandSelect>
<lcb-msg isShow="{{isShowSelectCustomer}}" isHasClose="{{true}}">
<view slot="content">
+8
View File
@@ -65,6 +65,7 @@ Page({
register_amount: '', //上牌费
confirm_amount: '', //定⾦
discount_amount: '', //⻋身优惠
brand_page_show: false
},
//生命周期函数--监听页面加载
onLoad: function (options) {
@@ -512,5 +513,12 @@ Page({
this.setData({
is_get_insure: e.detail.value ? 1 : 0
})
},
//显示选择品牌
bindShowBrand(){
this.setData({
brand_page_show: true
})
}
})
+3 -1
View File
@@ -1,4 +1,6 @@
{
"navigationBarTitleText": "订单登记",
"usingComponents": {}
"usingComponents": {
"brandSelect": "/components/brandSelect/index"
}
}
+6 -3
View File
@@ -77,12 +77,15 @@
<view wx:if="{{step == 2}}">
<view class="relative bbs-1-eb pl190 last-b-none">
<view class="absolute left-0 box-middle font-28 color-333">车辆品牌<text class="color-f9394d">*</text></view>
<view class="pt30 pb30 text-right font-28 color-666">
<picker bindchange="changeBrand" value="{{brandIndex}}" range="{{brandArray}}">
<view class="pt30 pb30 text-right font-28 color-666" bindtap="bindShowBrand">
<!-- <picker bindchange="changeBrand" value="{{brandIndex}}" range="{{brandArray}}">
<text class="color-ccc" wx:if="{{brandIndex == -1}}">请选择</text>
<text wx:else>{{brandArray[brandIndex]}}</text>
<i class="iconfont ml5 icon-gengduo"></i>
</picker>
</picker> -->
<text class="color-ccc" wx:if="{{1}}">请选择</text>
<!-- <text wx:else>{{brandArray[brandIndex]}}</text> -->
<i class="iconfont ml5 icon-gengduo"></i>
</view>
</view>
<view class="relative bbs-1-eb pl190 last-b-none" wx:if="{{brandIndex != -1}}">