zhou.xiaoning 2 年之前
父節點
當前提交
629d48f769

+ 5 - 7
src/packages/sbyj/views/home/main/index.vue

@@ -30,8 +30,7 @@
             </template>
           </Cell>
           <template v-for="(item, index) in newsList" :key="index">
-            <Cell class="article-item" :title="item.title" :value="formatDate(item.publishdate, 'MM/DD')"
-              :to="{ name: 'news-detail', query: { id: item.id } }" />
+            <Cell class="article-item" :title="item.data.content" :value="item.time" />
           </template>
         </CellGroup>
       </app-block>
@@ -44,7 +43,7 @@ import { shallowRef } from "vue";
 import { Cell, CellGroup, PullRefresh } from "vant";
 import { formatDate } from "@/filters";
 import { useNavigation } from '@/packages/sbyj/router/navigation';
-import { queryImageConfigs } from "@/services/api/common";
+import { queryImageConfigs, getJ10News } from "@/services/api/common";
 import { queryNewTitles } from "@/services/api/news";
 import { useLoginStore } from '@/stores'
 import Banner from '@/packages/sbyj/components/base/banner/index.vue'
@@ -54,7 +53,7 @@ const loginStore = useLoginStore();
 const { routerTo, setGlobalUrlParams } = useNavigation();
 const refreshing = shallowRef(false); // 是否处于加载中状态
 const topBanners = shallowRef<string[]>([]); // 轮播图列表
-const newsList = shallowRef<Model.NewTitlesRsp[]>([]); // 资讯列表
+const newsList = shallowRef<Model.J10NewsRsp[]>([]); // 资讯列表
 
 // 跳转导航页面
 const switchTab = (tabIndex: number) => {
@@ -82,10 +81,9 @@ const onRefresh = () => {
     })
   }
   // 市场资讯
-  queryNewTitles({
+  getJ10News({
     data: {
-      page: 1,
-      pagesize: 10,
+      limit: 20
     }
   }).then((res) => {
     newsList.value = res.data

+ 54 - 19
src/packages/sbyj/views/market/detail/index.vue

@@ -1,33 +1,68 @@
 <template>
     <app-view class="market-detail">
         <template #header>
-            <app-navbar :title="futuresStore.getGoodsName(goodsCode) ?? '商品详情'" />
+            <app-navbar title="点价详情" />
         </template>
-        <component :is="Price" v-bind="{ goodsCode }" />
-        <component :is="Chart" v-bind="{ goodsCode }" @ready="onReady" />
-        <component :is="Tik" v-bind="{ goodsCode, startTime, endTime }" />
+        <table style="width: 100%;">
+            <tr>
+                <td style="text-align: center;">回购价</td>
+                <td style="text-align: center;">销售价</td>
+            </tr>
+            <tr>
+                <td style="text-align: center;">449.81</td>
+                <td style="text-align: center;">450.00</td>
+            </tr>
+        </table>
+        <Form class="pricing-detail__form" ref="formRef" style="padding: 0.2rem; background-color: white;"
+                @submit="onSubmit">
+                <Field name="OrderQty">
+                    <template #input>
+                        <Stepper v-model="formData.OrderQty" :rules="formRules.OrderQty" theme="round" button-size="22"
+                            :auto-fixed="false" integer />
+                    </template>
+                </Field>
+        </Form>
+        <table style="width: 100%;">
+            <tr>
+                <td style="width: calc(`100% / 4`); text-align: center;"><Button>100g</Button></td>
+                <td style="width: calc(`100% / 4`); text-align: center;"><Button>500g</Button></td>
+                <td style="width: calc(`100% / 4`); text-align: center;"><Button>1000g</Button></td>
+                <td style="width: calc(`100% / 4`); text-align: center;"><Button>5000g</Button></td>
+            </tr>
+        </table>
+        <div>
+            <span><Button>我要卖料</Button></span>
+            <span><Button>我要买料</Button></span>
+        </div>
+        <div>订单明细</div>
     </app-view>
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, defineAsyncComponent } from 'vue'
-import { formatDate } from '@/filters'
-import { useNavigation } from '@/packages/sbyj/router/navigation'
-import { useFuturesStore } from '@/stores'
 
-const Price = defineAsyncComponent(() => import('@/packages/sbyj/components/modules/quote/price/index.vue'))
-const Chart = defineAsyncComponent(() => import('@/packages/sbyj/components/modules/quote/chart/index.vue'))
-const Tik = defineAsyncComponent(() => import('@/packages/sbyj/components/modules/quote/tik/index.vue'))
+import { useOrder } from '@/business/trade'
+import { shallowRef, onMounted, onUnmounted, computed } from 'vue'
+import { Form, Field, Stepper, Button, FieldRule, FormInstance, Radio, RadioGroup, Checkbox } from 'vant'
 
-const { getQueryString } = useNavigation()
-const goodsCode = getQueryString('goodscode')
-const futuresStore = useFuturesStore()
+const { formData, formSubmit } = useOrder()
 
-const startTime = shallowRef<string>()
-const endTime = shallowRef<string>()
+onMounted(() => {
+    formData.OrderQty = 100
+})
 
-const onReady = (start: string, end: string) => {
-    startTime.value = formatDate(start)
-    endTime.value = formatDate(end)
+// 表单验证规则
+const formRules: { [key in keyof Proto.OrderReq]?: FieldRule[] } = {
+    OrderQty: [{
+        message: '请输入数量',
+        validator: () => {
+            return !!formData.OrderQty
+        }
+    }],
 }
+
+// 下单
+const onSubmit = () => {
+    console.log("onSubmit")
+}
+
 </script>

+ 2 - 61
src/packages/sbyj/views/news/list/index.vue

@@ -3,71 +3,12 @@
     <template #header>
       <app-navbar title="市场资讯" />
     </template>
-    <Tabs v-model:active="currentColumnId" @change="onClickTab">
-      <template v-for="(item, index) in siteColumns" :key="index">
-        <Tab :name="item.id" :title="item.columnname" />
-      </template>
-    </Tabs>
-    <app-pull-refresh ref="pullRefreshRef" class="news-list__container" v-model:loading="loading" v-model:error="error"
-      v-model:pageIndex="pageIndex" :page-count="pageCount" @refresh="onRefresh">
-      <Empty v-if="!dataList.length" />
-      <template v-for="(item, index) in dataList" :key="index">
-        <Cell class="article-item" title-class="article-item__title" value-class="article-item__time" :title="item.title"
-          :value="formatDate(item.publishdate, 'MM/DD')" :to="{ name: 'news-detail', query: { id: item.id } }" />
-      </template>
-    </app-pull-refresh>
+    <iframe src="https://www.jin10.com/example/jin10.com.html" style="height: 100%;" scrolling="auto"
+      security="restricted" sandbox="allow-top-navigation allow-same-origin allow-forms allow-scripts" />
   </app-view>
 </template>
   
 <script lang="ts" setup>
-import { shallowRef } from 'vue'
-import { Cell, Tab, Tabs, Empty } from 'vant'
-import { formatDate } from '@/filters'
-import { useRequest } from '@/hooks/request'
-import { querySiteColumnDetail, querySiteColumnConfig } from '@/services/api/news'
-import AppPullRefresh from '@/packages/sbyj/components/base/pull-refresh/index.vue'
-
-const pullRefreshRef = shallowRef()
-const dataList = shallowRef<Model.SiteColumnDetailRsp[]>([])
-const siteColumns = shallowRef<Model.SiteColumnConfigRsp[]>([])
-const currentColumnId = shallowRef(0)
-const error = shallowRef(false)
-
-/// 查询栏目配置
-const getSiteColumnConfig = querySiteColumnConfig().then((res) => {
-  siteColumns.value = res.data
-  /// 默认第一个
-  if (res.data.length) {
-    currentColumnId.value = res.data[0].id
-  }
-})
-
-const { loading, pageIndex, pageCount, run } = useRequest(querySiteColumnDetail, {
-  manual: true,
-  params: {
-    pagesize: 20,
-  },
-  onSuccess: (res) => {
-    if (pageIndex.value === 1) {
-      dataList.value = []
-    }
-    dataList.value.push(...res.data)
-  },
-  onError: () => {
-    error.value = true
-  }
-})
-
-const onRefresh = () => {
-  getSiteColumnConfig.then(() => {
-    run({ columnid: currentColumnId.value })
-  })
-}
-
-// Tab触发
-const onClickTab = () => {
-  pullRefreshRef.value?.refresh()
-}
 </script>
   
 <style lang="less">

+ 10 - 0
src/services/api/common/index.ts

@@ -237,4 +237,14 @@ export function postNoticeReaded(config: RequestConfig<Model.NoticeReadedReq> =
             ...config.data
         },
     })
+}
+
+/**
+ * 获取金10资讯数据
+ */
+ export function getJ10News(config: RequestConfig<Model.J10NewsReq> = {}) {
+    return http.commonRequest<Model.J10NewsRsp[]>({
+        url: '/Common/GetJ10News',
+        params: config.data,
+    })
 }

+ 5 - 0
src/types/model/common.d.ts

@@ -318,5 +318,10 @@ declare global {
             loginID?: number; // 登录账号
             noticeID: number; // 通知公告ID
         }
+
+        /** 获取金10资讯数据 请求 */
+        interface J10NewsReq {
+            limit?: number; // 获取最新limit条内容
+        }
     }
 }

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

@@ -105,4 +105,16 @@ declare namespace Model {
         updatedate: string; // 修改时间
         userid: number; // 用户ID(默认为0, 核心为为机构用户ID)
     }
+
+    /** 金10资讯数据 */
+    interface J10NewsRsp {
+        id: string;
+        time: string;
+        type: number;
+        data: {
+            pic: string;
+            title: string;
+            content: string;
+        }
+    }
 }