|
|
@@ -4,45 +4,19 @@
|
|
|
<view class="loading-page" v-if="getLoading()">
|
|
|
<image class="loading-icon" src="../../../static/images/loading.png" />
|
|
|
</view>
|
|
|
- <scroll-view
|
|
|
- v-else
|
|
|
- class="content"
|
|
|
- scroll-y="true"
|
|
|
- @scrolltolower="onScrollToLower"
|
|
|
- >
|
|
|
- <view
|
|
|
- class="item"
|
|
|
- v-for="(item, i) in companyList"
|
|
|
- :key="i"
|
|
|
- @click="toggle(i)"
|
|
|
- >
|
|
|
+ <scroll-view v-else class="content" scroll-y="true" @scrolltolower="onScrollToLower">
|
|
|
+ <view class="item" v-for="(item, i) in companyList" :key="i" @click="toggle(i)">
|
|
|
<view class="item-header">
|
|
|
- <text class="item-title"
|
|
|
- >{{ i + 1 }}. {{ item.entName || "" }}</text
|
|
|
- >
|
|
|
- <uni-icons
|
|
|
- type="down"
|
|
|
- size="22"
|
|
|
- color="#999"
|
|
|
- :style="{
|
|
|
- transform: expanded[i] ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
|
- transition: 'transform 0.3s ease-in-out',
|
|
|
- }"
|
|
|
- ></uni-icons>
|
|
|
+ <text class="item-title">{{ i + 1 }}. {{ item.entName || "" }}</text>
|
|
|
+ <uni-icons type="down" size="22" color="#999" :style="{
|
|
|
+ transform: expanded[i] ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
|
+ transition: 'transform 0.3s ease-in-out',
|
|
|
+ }"></uni-icons>
|
|
|
</view>
|
|
|
- <scroll-view
|
|
|
- class="item-collapse"
|
|
|
- scroll-y="true"
|
|
|
- :style="{
|
|
|
- height: getCollapseHeight(i),
|
|
|
- }"
|
|
|
- @scrolltolower="getDrugInfoNameList(i)"
|
|
|
- >
|
|
|
- <view
|
|
|
- class="cv-item"
|
|
|
- v-for="(d, di) in products[i]"
|
|
|
- :key="'drug-' + di"
|
|
|
- >
|
|
|
+ <scroll-view class="item-collapse" scroll-y="true" :style="{
|
|
|
+ height: getCollapseHeight(i),
|
|
|
+ }" @scrolltolower="getDrugInfoNameList(i)">
|
|
|
+ <view class="cv-item" v-for="(d, di) in products[i]" :key="'drug-' + di">
|
|
|
<text class="cv-index">{{ di + 1 }}</text>
|
|
|
<text class="cv-label">药品名称:</text>
|
|
|
<text class="cv-value">{{ d.physicName || "" }}</text>
|
|
|
@@ -51,10 +25,7 @@
|
|
|
</view>
|
|
|
<view class="loading-row" v-if="companyHasMore">
|
|
|
<view class="loading-wrapper">
|
|
|
- <image
|
|
|
- class="loading-icon"
|
|
|
- src="../../../static/images/loading.png"
|
|
|
- />
|
|
|
+ <image class="loading-icon" src="../../../static/images/loading.png" />
|
|
|
</view>
|
|
|
</view>
|
|
|
</scroll-view>
|
|
|
@@ -77,11 +48,13 @@ export default {
|
|
|
companyTotalCount: 0,
|
|
|
companyHasMore: true,
|
|
|
companyLoading: false,
|
|
|
+ fetchedCount: 0,
|
|
|
allCompanies: [],
|
|
|
loading: true,
|
|
|
expanded: {},
|
|
|
products: {},
|
|
|
productPages: [],
|
|
|
+ canScanCompanyList: ["华润三九医药股份有限公司", '华润三九(枣庄)药业有限公司', '华润三九(南昌)药业有限公司', '合肥华润神鹿药业有限公司', '杭州华润老桐君药业有限公司', '吉林三九金复康药业有限公司', '华润三九(郴州)制药有限公司']
|
|
|
};
|
|
|
},
|
|
|
onLoad() {
|
|
|
@@ -89,24 +62,6 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
getDrugInfoNameList(i) {
|
|
|
- // if (!this.products[i]) this.products[i] = [];
|
|
|
- // if (
|
|
|
- // this.products[i].length >= this.companyList[i].drugInfoNameList?.length
|
|
|
- // ) {
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // const size = 10;
|
|
|
- // const page = (this.productPages[i] || 0) + 1;
|
|
|
- // const start = (page - 1) * size;
|
|
|
- // const end = Math.min(
|
|
|
- // start + size,
|
|
|
- // this.companyList[i].drugInfoNameList?.length || 0
|
|
|
- // );
|
|
|
- // this.products[i] = [
|
|
|
- // ...(this.products[i] || []),
|
|
|
- // ...(this.companyList[i].drugInfoNameList?.slice(start, end) || []),
|
|
|
- // ];
|
|
|
- // this.productPages[i] = page;
|
|
|
const res = getPaginatedList({
|
|
|
page: this.productPages[i] || 0,
|
|
|
initData: this.companyList[i]?.drugInfoNameList || [],
|
|
|
@@ -119,31 +74,18 @@ export default {
|
|
|
getCollapseHeight(i) {
|
|
|
return this.expanded[i]
|
|
|
? Math.min(7.3 * 70, this.companyList[i].drugInfoNameList.length * 70) +
|
|
|
- "rpx"
|
|
|
+ "rpx"
|
|
|
: "0";
|
|
|
},
|
|
|
getLoading() {
|
|
|
return this.loading;
|
|
|
},
|
|
|
fetchInitial() {
|
|
|
- // this.genMockAll();
|
|
|
- // this.companyTotalCount = this.allCompanies.length;
|
|
|
this.fetchCustomers();
|
|
|
},
|
|
|
fetchCustomers() {
|
|
|
if (!this.companyHasMore || this.companyLoading) return;
|
|
|
this.companyLoading = true;
|
|
|
- // const start = (this.companyPageNum - 1) * this.companyPageSize;
|
|
|
- // const next = this.allCompanies.slice(start, start + this.companyPageSize);
|
|
|
- // this.companyList = [...this.companyList, ...next];
|
|
|
- // if (this.companyList.length < this.companyTotalCount) {
|
|
|
- // this.companyPageNum++;
|
|
|
- // this.companyHasMore = true;
|
|
|
- // } else {
|
|
|
- // this.companyHasMore = false;
|
|
|
- // }
|
|
|
- // this.companyLoading = false;
|
|
|
- // this.loading = false;
|
|
|
request("/customer/info/getEnterpriseData", {
|
|
|
pageNum: this.companyPageNum,
|
|
|
pageSize: this.companyPageSize,
|
|
|
@@ -152,10 +94,19 @@ export default {
|
|
|
if (res.code == 200) {
|
|
|
const { total, list } = res.data || {};
|
|
|
this.companyTotalCount = total || 0;
|
|
|
- this.companyList = Array.isArray(list)
|
|
|
- ? [...this.companyList, ...list]
|
|
|
- : [...this.companyList];
|
|
|
- if (this.companyList.length < this.companyTotalCount) {
|
|
|
+ const rawList = Array.isArray(list) ? list : [];
|
|
|
+ this.fetchedCount = (this.fetchedCount || 0) + rawList.length;
|
|
|
+
|
|
|
+ const filtered = rawList.filter((item) =>
|
|
|
+ this.canScanCompanyList.includes(item.entName)
|
|
|
+ );
|
|
|
+
|
|
|
+ this.companyList = [...this.companyList, ...filtered];
|
|
|
+
|
|
|
+ if (
|
|
|
+ rawList.length > 0 &&
|
|
|
+ this.fetchedCount < this.companyTotalCount
|
|
|
+ ) {
|
|
|
this.companyPageNum++;
|
|
|
this.companyHasMore = true;
|
|
|
} else {
|
|
|
@@ -164,6 +115,15 @@ export default {
|
|
|
this.companyList.forEach((item, i) => {
|
|
|
this.getDrugInfoNameList(i);
|
|
|
});
|
|
|
+
|
|
|
+ if (
|
|
|
+ this.companyHasMore &&
|
|
|
+ (filtered.length === 0 || this.companyList.length < 10)
|
|
|
+ ) {
|
|
|
+ this.companyLoading = false;
|
|
|
+ this.fetchCustomers();
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
this.companyLoading = false;
|
|
|
this.loading = false;
|
|
|
@@ -175,41 +135,6 @@ export default {
|
|
|
toggle(i) {
|
|
|
this.$set(this.expanded, i, !this.expanded[i]);
|
|
|
},
|
|
|
- genMockAll() {
|
|
|
- const companies = [];
|
|
|
- const names = [
|
|
|
- "华润三九医药股份有限公司",
|
|
|
- "华润三九(枣庄)药业有限公司",
|
|
|
- "华润三九(南昌)药业有限公司",
|
|
|
- "合肥华润神鹿药业有限公司",
|
|
|
- "杭州华润老桐君药业有限公司",
|
|
|
- "吉林三九金复康药业有限公司",
|
|
|
- "华润三九(郴州)制药有限公司",
|
|
|
- ];
|
|
|
- const drugs = [
|
|
|
- "益气清肺颗粒6袋",
|
|
|
- "维E胶囊30*100mg",
|
|
|
- "右美沙芬糖浆180",
|
|
|
- "赐多康西洋参片40",
|
|
|
- "麝香3*27*2",
|
|
|
- "牦牛骨钙VD片60",
|
|
|
- "畅生源胶丸120",
|
|
|
- "多种矿物质口服液7支",
|
|
|
- "三七提取物软胶囊30粒",
|
|
|
- "拉曼布拉氏益生菌20",
|
|
|
- "维生素AD滴剂700U*50",
|
|
|
- "锌钙特铝塑盒120",
|
|
|
- ];
|
|
|
- for (let i = 0; i < 80; i++) {
|
|
|
- const dn = [];
|
|
|
- const count = 3 + (i % 4);
|
|
|
- for (let j = 0; j < count; j++) {
|
|
|
- dn.push({ physicName: drugs[(i + j) % drugs.length] });
|
|
|
- }
|
|
|
- companies.push({ customerName: names[i % names.length], drugs: dn });
|
|
|
- }
|
|
|
- this.allCompanies = companies;
|
|
|
- },
|
|
|
},
|
|
|
};
|
|
|
</script>
|