li.shaoyi 3 年 前
コミット
cc04005a20

+ 3 - 2
src/business/goods/index.ts

@@ -100,9 +100,9 @@ export function useQueryTHJTradeDataList() {
     const loading = shallowRef(false)
     const { getUserId } = useLoginStore()
 
-    const getQueryTHJTradeDataList = (marketid: number) => {
+    const getQueryTHJTradeDataList = async (marketid: number) => {
         loading.value = true
-        return queryTHJTradeData({
+        await queryTHJTradeData({
             data: {
                 userid: getUserId(),
                 marketid: marketid,
@@ -117,6 +117,7 @@ export function useQueryTHJTradeDataList() {
                 loading.value = false
             }
         })
+        return dataList.value
     }
 
     return {

+ 3 - 0
src/packages/mobile/views/goods/details/index.vue

@@ -62,6 +62,9 @@
                 <span>{{ selectedDate.unitprice }}</span>
             </div>
             <Divider>历史价格走势</Divider>
+            <div class="">
+                走势图
+            </div>
             <Divider>商品详情</Divider>
             <div class="">
                 <template v-for="(url, index) in goodsImages" :key="index">

+ 17 - 12
src/packages/mobile/views/mine/generalize/index.vue

@@ -3,8 +3,8 @@
         <template #header>
             <app-navbar title="我的推广" />
         </template>
-        <app-pull-refresh class="tradeData__container" v-model:pageIndex="pageIndex" :page-count="pageCount"
-            :updateList="dataList" @refresh="onRefresh" @updated="onRefreshUpdated">
+        <app-pull-refresh class="tradeData__container" :dataList="dataList" v-model:error="error"
+            v-model:pageIndex="pageIndex" :page-count="pageCount" @refresh="onRefresh">
             <template #header>
                 <div class="mine-generalize__header">
                     <div class="info">
@@ -30,7 +30,7 @@
                         <Empty />
                     </Tab>
                 </Tabs>
-                <ul class="list list-row" v-if="showHeader">
+                <ul class="list list-row" v-if="dataList.length">
                     <li class="list-column">
                         <span>日期</span>
                     </li>
@@ -78,8 +78,9 @@ import AppQrcode from '@mobile/components/base/qrcode/index.vue'
 import { formatDate } from '@/filters'
 import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
 
-const { dataList, pageIndex, pageCount, getQueryTHJTradeDataList } = useQueryTHJTradeDataList()
-const showHeader = shallowRef(false)
+const { pageIndex, pageCount, getQueryTHJTradeDataList } = useQueryTHJTradeDataList()
+const dataList = shallowRef<Model.THJTradeDataRsp[]>([])
+const error = shallowRef(false)
 
 const { getUserId } = useLoginStore()
 const showQRCode = shallowRef(false)
@@ -97,14 +98,18 @@ queryUserAccount({
     }
 })
 
-const onRefresh = (callback: () => void) => {
-    getQueryTHJTradeDataList(64201).finally(() => callback())
+const onRefresh = (finish: () => void) => {
+    getQueryTHJTradeDataList(64201).then((res) => {
+        if (pageIndex.value === 1) {
+            dataList.value = []
+        }
+        dataList.value.push(...res)
+    }).catch(() => {
+        error.value = true
+    }).finally(() => {
+        finish()
+    })
 }
-
-const onRefreshUpdated = (data: Model.UserScoreLogRsp[]) => {
-    showHeader.value = data.length > 0
-}
-
 </script>
 
 <style lang="less">