Bläddra i källkod

Merge branch 'master' of http://47.101.159.18:3000/Muchinfo/THJ_Mobile

li.shaoyi 3 år sedan
förälder
incheckning
ceffbc18f5

+ 36 - 1
src/business/news/index.ts

@@ -1,6 +1,6 @@
 import { shallowRef } from 'vue'
 import { useDataTable } from '@/hooks/datatable'
-import { querySiteColumnDetail } from '@/services/api/news'
+import { querySiteColumnDetail, querySiteColumnConfig } from '@/services/api/news'
 
 // 新闻资讯列表
 export function useSiteColumnDetail() {
@@ -35,4 +35,39 @@ export function useSiteColumnDetail() {
         pageCount,
         getSiteColumnDetail,
     }
+}
+
+// 查询资讯栏目配置
+export function useSiteColumnConfig() {
+  
+    const { dataList, total, pageIndex, pageSize, pageCount } = useDataTable<Model.SiteColumnConfigRsp>()
+    const loading = shallowRef(false)
+    
+    const getSiteColumnConfig = (columntype?: number) => {
+        loading.value = true
+        return querySiteColumnConfig({
+            data: {
+                columntype: columntype,
+                page: pageIndex.value,
+                pagesize: pageSize.value,
+            },
+            success: (res) => {
+                total.value = res.total
+                dataList.value = res.data
+            },
+            complete: () => {
+                loading.value = false
+            }
+        })
+    }
+
+    return {
+        loading,
+        dataList,
+        total,
+        pageIndex,
+        pageSize,
+        pageCount,
+        getSiteColumnConfig,
+    }
 }

+ 1 - 5
src/packages/mobile/views/home/components/main/index.less

@@ -79,10 +79,8 @@
         display         : flex;
         align-items     : center;
         background-color: #fff;
-        margin-bottom   : .2rem;
         padding         : .16rem;
-        border-top      : 5px solid #f0f0f0;
-        border-bottom   : 5px solid #f0f0f0;
+        margin-top      : .2rem;
 
         .left {
             display        : flex;
@@ -91,7 +89,6 @@
             align-items    : center;
             padding        : .24rem;
             border-right   : 1px solid #eee;
-            width: 33%;
 
             h2 {
                 font-size: .36rem;
@@ -108,7 +105,6 @@
             flex   : 1;
             padding: 0 .24rem;
             
-
             table {
                 width    : 100%;
                 font-size: .24rem;

+ 2 - 2
src/packages/mobile/views/home/components/main/index.vue

@@ -38,7 +38,7 @@
       <div class="home-main__market">
         <div class="left">
           <h2>合金指数</h2>
-          <span>{{ formatDate(marketRun.tradedate, "YYYY-MM-DD") }}</span>
+          <span>{{ formatDate(marketRun.tradedate ?? Date(), "YYYY-MM-DD") }}</span>
         </div>
         <div class="right">
           <table cellspacing="0" cellpadding="0">
@@ -91,7 +91,7 @@ const refreshing = shallowRef(false) // 是否处于加载中状态
 const topBanners = shallowRef<Model.ImageConfigsRsp[]>([])   // 轮播图列表
 const bodyBanners = shallowRef<Model.ImageConfigsRsp[]>([])  // 轮播图列表
 const newsList = shallowRef<Model.SiteColumnDetailRsp[]>([]) // 资讯列表
-const marketRun = shallowRef<Model.MarketRunRsp>({}) // 资讯列表
+const marketRun = shallowRef<Partial<Model.MarketRunRsp>>({})         // 市场
 
 const {dataList, getQuerySpotGoodsPriceLists} = useQuerySpotGoodsPriceLists()
 getQuerySpotGoodsPriceLists()

+ 21 - 8
src/packages/mobile/views/news/list/index.vue

@@ -4,13 +4,7 @@
       <app-navbar title="市场资讯" />
     </template>
     <Tabs v-model:active="active" @click-tab="onClickTab">
-      <Tab title="宏观新闻">
-        <Empty v-if="empty" />
-      </Tab>
-      <Tab title="行业动态">
-        <Empty v-if="empty" />
-      </Tab>
-      <Tab title="厂家信息">
+      <Tab v-for="(item, index) in configs" :key="index" :title="item.columnname">
         <Empty v-if="empty" />
       </Tab>
     </Tabs>
@@ -31,20 +25,39 @@ import { ref, shallowRef } from 'vue'
 import { Cell, Tab, Tabs, Empty } from 'vant'
 import { formatDate } from '@/filters'
 import { useSiteColumnDetail } from '@/business/news'
+import { querySiteColumnConfig } from '@/services/api/news'
 import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
 
 /// tab激活项
 const active = ref(0);
 const empty = shallowRef(false)
+const configs = shallowRef<Model.SiteColumnConfigRsp[]>([])
+const config = shallowRef<Model.SiteColumnConfigRsp>({})
 
 const { dataList, pageIndex, pageCount, getSiteColumnDetail } = useSiteColumnDetail()
 /// Tab触发
 const onClickTab = (e) => {
   active.value = e.name
+  /// 设置选中的数据
+  if (configs.value.length>0) {
+    config.value = configs.value[e.name]
+  }
+  getSiteColumnDetail(config.value.id)
 }
 
+/// 查询栏目配置
+querySiteColumnConfig({
+  success: (res) => {
+    configs.value = res.data
+    /// 默认第一个
+    if (res.data.length > 0) {
+      config.value = res.data[0]
+    }
+  }
+})
+
 const onRefresh = (callback: () => void) => {
-  getSiteColumnDetail(active.value).finally(() => callback())
+  getSiteColumnDetail(config.value.id).finally(() => callback())
 }
 
 const onUpdated = (lists: Model.THJProductRsp[]) => {

+ 7 - 0
src/services/api/news/index.ts

@@ -6,4 +6,11 @@ import { HttpParams } from '@/services/http/interface'
  */
 export function querySiteColumnDetail(params: HttpParams<{ req: Model.SiteColumnDetailReq, rsp: Model.SiteColumnDetailRsp[] }>) {
     return httpRequest('/WrTrade2/QuerySiteColumnDetail', 'get', params);
+}
+
+/**
+ * 查询资讯栏目配置
+ */
+ export function querySiteColumnConfig(params: HttpParams<{ req: Model.SiteColumnConfigReq, rsp: Model.SiteColumnConfigRsp[] }>) {
+    return httpRequest('/WrTrade2/QuerySiteColumnConfig', 'get', params);
 }

+ 4 - 0
src/types/model/goods.d.ts

@@ -214,10 +214,14 @@ declare namespace Model {
 
     /** 获取现货行情 响应 */
     interface SpotGoodsPriceRsp {
+        /// 涨跌幅
+        chg: string
         /// 报价货币ID
         currencyid: number
         /// 现货品种ID
         deliverygoodsid: number
+        /// 上日价格
+        prespotgoodsprice: number
         /// 现货品牌ID(通用则为0, 不为0则须先有商品ID)
         spotgoodsbrandid: number
         /// 【最新价】当前价格

+ 29 - 0
src/types/model/news.d.ts

@@ -19,4 +19,33 @@ declare namespace Model {
         title: string; // 标题
         updatedate: string; // 修改时间
     }
+
+     /** 查询资讯栏目配置 请求 */
+     interface SiteColumnConfigReq {
+        page?: number; // 页码
+        pagesize?: number; // 每页条数
+        columntype?: number; // 栏目类型 - 1:行情资讯 10:会员服务 30:关于我们 100:核心企业栏目-百色
+    }
+
+    /** 查询资讯栏目配置 响应 */
+    interface SiteColumnConfigRsp {
+        // 栏目名称
+        columnname: string
+        // 栏目类型 - 1:行情资讯 10:会员服务 30:关于我们 100:核心企业栏目-百色
+        columntype: number
+        // 创建时间
+        creaedate: string
+        // 创建人
+        creatorid: number
+        // ID(SEQ_SITE_COLUMNCONFIG)
+        id: number
+        // 是否展示 - 0:不展示 1:展示
+        isshow: number
+        // 操作人
+        modifierid: number
+        // 排序
+        sort: number
+        // 修改时间
+        updatedate: string
+    }
 }