Commit db3b3307 by 李伟康

feat(OrderPopup): 优化多个组件并添加加载完成事件

- 在 CarModelList、CouponList、DiversionMerchant、EmployeeList、GoodsList、PackageList 和 SkuGoodsList 组件中添加 onComplete 事件
- 在 OrderPopup 组件中添加 loadComplete 状态和相关逻辑
- 优化 CarModelList 组件中的条件判断逻辑
- 为 OrderPopup 组件添加加载中动画
1 parent 30a15305
...@@ -25,11 +25,14 @@ ...@@ -25,11 +25,14 @@
:class="[ :class="[
{'sub-brand-name':j.isTitle}, {'sub-brand-name':j.isTitle},
{'item flex':!j.isTitle}, {'item flex':!j.isTitle},
{active: currentId ? j.id == currentId : j.id == data.customer[params.idKey]} {active: (currentId ? j.id == currentId : j.id == data.customer[params.idKey]) && !j.isTitle}
]" ]"
@click="choose(j,c)" @click="choose(j,c)"
> >
<view class="sprite-icon icon-tag-checked" v-if="!j.isTitle"></view> <view
class="sprite-icon icon-tag-checked"
v-if="!j.isTitle"
></view>
{{j.name}} {{j.name}}
</view> </view>
</template> </template>
...@@ -132,7 +135,7 @@ export default { ...@@ -132,7 +135,7 @@ export default {
} }
}) })
this.list = carModelList this.list = carModelList
this.$emit('onComplete')
}, },
handleSearch (searchValue) { handleSearch (searchValue) {
if (!searchValue) { if (!searchValue) {
......
...@@ -114,6 +114,7 @@ export default { ...@@ -114,6 +114,7 @@ export default {
list, list,
}; };
}) })
this.$emit('onComplete')
this.list = couponList this.list = couponList
}, },
async getCustomerCouponList (customerPhone) { async getCustomerCouponList (customerPhone) {
......
...@@ -42,6 +42,7 @@ export default { ...@@ -42,6 +42,7 @@ export default {
merchantId: shopMerchantId merchantId: shopMerchantId
}) })
if (data && data.length) { if (data && data.length) {
this.$emit('onComplete')
this.list = data this.list = data
params.cacheData = data params.cacheData = data
this.$emit('update:params', params) this.$emit('update:params', params)
......
...@@ -46,6 +46,7 @@ export default { ...@@ -46,6 +46,7 @@ export default {
name: searchValue name: searchValue
}) })
if (data && data.length) { if (data && data.length) {
this.$emit('onComplete')
this.list = data this.list = data
params.cacheData = data params.cacheData = data
this.$emit('update:params', params) this.$emit('update:params', params)
......
...@@ -100,6 +100,7 @@ export default { ...@@ -100,6 +100,7 @@ export default {
this.currentIds.push(e.goods.goodsId) this.currentIds.push(e.goods.goodsId)
this.chooseList.push(e) this.chooseList.push(e)
}) })
this.$emit('onComplete')
return arr return arr
}, },
choose (i) { choose (i) {
......
...@@ -115,6 +115,7 @@ export default { ...@@ -115,6 +115,7 @@ export default {
this.currentIds.push(e.packageGoods.packageCode) this.currentIds.push(e.packageGoods.packageCode)
this.chooseList.push(e) this.chooseList.push(e)
}) })
this.$emit('onComplete')
return arr return arr
}, },
choose (i) { choose (i) {
......
...@@ -184,6 +184,7 @@ export default { ...@@ -184,6 +184,7 @@ export default {
this.chooseList.push(e) this.chooseList.push(e)
} }
}) })
this.$emit('onComplete')
return arr return arr
}, },
async choose (i, index) { async choose (i, index) {
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<view :class="['popup-body',{ 'hide-search' :componentObject.hideSearch}]"> <view :class="['popup-body',{ 'hide-search' :componentObject.hideSearch}]">
<scroll-view <scroll-view
scroll-y scroll-y
class="popup-scroll-view" :class="['popup-scroll-view',{show:loadComplete}]"
> >
<component <component
:is="componentObject.name" :is="componentObject.name"
...@@ -55,9 +55,14 @@ ...@@ -55,9 +55,14 @@
ref="componentRef" ref="componentRef"
@choose="chooseContent = $event" @choose="chooseContent = $event"
@openSkuPopup="openSkuPopup" @openSkuPopup="openSkuPopup"
@onComplete="loadComplete = true"
></component> ></component>
</scroll-view> </scroll-view>
<image
v-if="!loadComplete"
class="loading"
src="../../assets/images/common/loadding.gif"
/>
</view> </view>
</popup> </popup>
<sku-popup <sku-popup
...@@ -123,6 +128,7 @@ export default { ...@@ -123,6 +128,7 @@ export default {
position: 'bottom', position: 'bottom',
chooseContent: null, chooseContent: null,
componentObject: null, componentObject: null,
loadComplete: false
} }
}, },
watch: { watch: {
...@@ -281,9 +287,23 @@ export default { ...@@ -281,9 +287,23 @@ export default {
} }
.popup-body { .popup-body {
height: calc(100% - 392rpx); height: calc(100% - 392rpx);
position: relative;
.popup-scroll-view { .popup-scroll-view {
height: 100%; height: 100%;
padding-top: 32rpx; padding-top: 32rpx;
opacity: 0;
}
.loading {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: toRpx(64);
height: toRpx(64);
}
.show{
opacity: 1;
} }
} }
.hide-search { .hide-search {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!