li.shaoyi 10 місяців тому
батько
коміт
cbdadcfb1b

+ 3 - 1
oem/ykhj/config/appconfig.json

@@ -14,5 +14,7 @@
   ],
   "forcedPasswordChange": false,
   "riskType": 1,
-  "i18nEnabled": false
+  "i18nEnabled": false,
+  "allCloseEnabled": true,
+  "allDeliveryEnabled": true
 }

+ 2 - 2
src/hooks/request/index.ts

@@ -112,7 +112,7 @@ export function useDataList<T>(pageSize: number) {
     const currentPage = ref(1) // 当前点击所在的页码
     const startIndex = ref(0) // 当前页码的起始位置,用于数组 splice 替换或删除
 
-    const getItem = (index: number) => {
+    const getItemByIndex = (index: number) => {
         currentPage.value = Math.ceil((index + 1) / pageSize)
         startIndex.value = (currentPage.value - 1) * pageSize
         return dataList.value[index]
@@ -135,7 +135,7 @@ export function useDataList<T>(pageSize: number) {
     return {
         dataList,
         currentPage,
-        getItem,
+        getItemByIndex,
         appendData,
         updateData,
     }

+ 6 - 8
src/packages/mobile/components/base/waterfall/flex/index.vue

@@ -95,14 +95,12 @@ const render = async () => {
     }
 }
 
-// watch(() => props.dataList, () => {
-//     state.columns = state.columns.map(() => [])
-//     state.currentColumnsIndex = 0
-//     state.renderedItemCount = 0
-//     render()
-// })
-
-watch(() => props.dataList.length, () => {
+watch(() => [props.dataList, props.dataList.length], ([newValue], [oldValue]) => {
+    if (newValue !== oldValue) {
+        state.columns = state.columns.map(() => [])
+        state.currentColumnsIndex = 0
+        state.renderedItemCount = 0
+    }
     render()
 })
 

+ 4 - 3
src/packages/mobile/views/notice/list/index.vue

@@ -16,9 +16,10 @@
                             <TextEllipsis :content="item.title" />
                         </template>
                         <template #value>
-                            <Badge :offset="[-5, 8]" :dot="!item.readed">
-                                <span style="font-size: 13px">{{ formatDate(item.createtime, 'YYYY/MM/DD HH:mm:ss') }}</span>
-                            </Badge>
+                            <span style="font-size: 13px">{{ formatDate(item.createtime, 'YYYY/MM/DD HH:mm:ss') }}</span>
+                        </template>
+                        <template #right-icon v-if="!item.readed">
+                            <Badge :offset="[0, 5]" dot />
                         </template>
                     </Cell>
                 </template>

+ 6 - 6
src/packages/mobile/views/spot/list/Index.vue

@@ -61,14 +61,14 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, onActivated, computed, PropType } from 'vue'
+import { ref, onActivated, computed, PropType } from 'vue'
 import { Tag, Icon } from 'vant'
 import { getFileUrl } from '@/filters'
 import { useNavigation } from '@mobile/router/navigation'
 import { useRequest } from '@/hooks/request'
 import { queryOrderQuote } from '@/services/api/goods'
 import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
-import Waterfall from '@mobile/components/base/waterfall/index.vue'
+import Waterfall from '@mobile/components/base/waterfall/flex/index.vue'
 
 const props = defineProps({
     showBackButton: {
@@ -81,10 +81,10 @@ const props = defineProps({
 })
 
 const { getQueryString } = useNavigation()
-const isWaterfall = shallowRef(false)
-const error = shallowRef(false)
-const pullRefreshRef = shallowRef()
-const dataList = shallowRef<Model.OrderQuoteRsp[]>([])
+const isWaterfall = ref(false)
+const error = ref(false)
+const pullRefreshRef = ref()
+const dataList = ref<Model.OrderQuoteRsp[]>([])
 
 const title = getQueryString('title')
 const titleName = computed(() => title ? decodeURIComponent(title) : props.marketSection?.displayname ?? '现货挂牌')

+ 6 - 2
src/packages/sbyj/App.vue

@@ -1,7 +1,8 @@
 <template>
   <router-view />
   <Notify v-model:show="notify.show" :title="notify.title" :content="notify.content" />
-  <Dialog class="g-dialog-tips" v-model:show="tips.show" :title="currentTipts?.title" theme="round-button" confirm-button-text="关闭">
+  <Dialog class="g-dialog-tips" v-model:show="tips.show" :title="currentTipts?.title" theme="round-button"
+    confirm-button-text="关闭">
     <div class="g-dialog-tips__content" v-html="currentTipts?.content"></div>
     <div class="g-dialog-tips__footer">
       <span :class="{ disabled: tips.index === 0 }" @click="changeTips(-1)">上一条</span>
@@ -48,7 +49,10 @@ const changeTips = (value: number) => {
   }
 }
 
-watch(() => noticeStore.tipsList.length, (val) => tips.show = !!val)
+watch(() => noticeStore.tipsList.length, (val) => {
+  tips.index = 0
+  tips.show = !!val
+})
 
 // 接收用户登出通知
 eventBus.$on('LogoutNotify', (msg) => {

+ 25 - 0
src/packages/sbyj/assets/themes/global/global.less

@@ -450,6 +450,31 @@
     }
 }
 
+.g-dialog-tips {
+    &__content {
+        max-height: 50vh;
+        overflow-y: auto;
+        line-height: 1.5;
+        padding: 15px;
+    }
+
+    &__footer {
+        display: flex;
+        justify-content: center;
+        padding: 10px;
+
+        span {
+            &:not(:first-child) {
+                margin-left: 10px;
+            }
+
+            &.disabled {
+                color: #999;
+            }
+        }
+    }
+}
+
 .van {
     &-dialog {
         &__message {

+ 0 - 1
src/packages/sbyj/views/home/main/index.less

@@ -96,7 +96,6 @@
             display: flex;
             align-items: center;
             line-height: 1;
-            font-size: 16px;
             font-weight: bold;
 
             img {

+ 9 - 3
src/packages/sbyj/views/home/main/index.vue

@@ -13,7 +13,12 @@
     </div>
     <PullRefresh class="home-main__container" v-model="refreshing" @refresh="onRefresh">
       <app-block>
-        <Cell title="通知公告" value="更多" :to="{ name: 'notice-list' }" icon="volume" is-link />
+        <Cell class="home-main__titlebar" title="通知公告" value="更多" :to="{ name: 'notice-list' }" icon="volume" is-link>
+          <template #title>
+            <span>{{ $t('routes.notice') }}</span>
+            <Badge :dot="noticeStore.unreadList.length > 0"></Badge>
+          </template>
+        </Cell>
       </app-block>
       <app-block class="home-main__iconbar bg">
         <ul>
@@ -52,16 +57,17 @@
 
 <script lang="ts" setup>
 import { shallowRef } from "vue";
-import { Cell, CellGroup, PullRefresh } from "vant";
+import { Cell, CellGroup, PullRefresh, Badge } from "vant";
 import { formatDate } from "@/filters";
 import { useNavigation } from '@mobile/router/navigation';
 import { queryImageConfigs, getJ10News } from "@/services/api/common";
-import { useGlobalStore } from '@/stores'
+import { useGlobalStore, useNoticeStore } from '@/stores'
 import Banner from '@mobile/components/base/banner/index.vue'
 import Iconfont from '@/components/base/iconfont/index.vue'
 
 const { routerTo } = useNavigation()
 const globalStore = useGlobalStore()
+const noticeStore = useNoticeStore()
 const refreshing = shallowRef(false) // 是否处于加载中状态
 const topBanners = shallowRef<string[]>([]) // 轮播图列表
 const newsList = shallowRef<Model.J10NewsRsp[]>([]) // 资讯列表

+ 2 - 3
src/packages/sbyj/views/mine/index.vue

@@ -127,9 +127,8 @@
                 </Cell> -->
                 <Cell is-link :to="{ name: 'notice-list' }">
                     <template #title>
-                        <Badge :offset="[10, 8]" :dot="noticeStore.unreadList.length > 0">
-                            <Iconfont icon="g-icon-caution">公告通知</Iconfont>
-                        </Badge>
+                        <Iconfont icon="g-icon-caution">公告通知</Iconfont>
+                        <Badge :dot="noticeStore.unreadList.length > 0" />
                     </template>
                 </Cell>
                 <Cell is-link :to="{ name: 'mine-setting' }">

+ 5 - 2
src/packages/sbyj/views/order/list/components/close-holder/index.vue

@@ -23,7 +23,8 @@
                     <Cell title="订单价格"
                         :value="formatDecimal(selectedRow.tHDetailEx.holderPrice, selectedRow.decimalPlace)" />
                     <Cell title="可用重量" :value="enableqty + getGoodsUnitName(selectedRow.goodsUnitID)" />
-                    <Field name="OrderQty" label="终止重量" :rules="formRules.OrderQty">
+                    <Field name="OrderQty" label="终止重量" :rules="formRules.OrderQty"
+                        v-if="globalStore.getSystemInfo('allCloseEnabled')">
                         <template #input>
                             <div class="g-qty-group">
                                 <div class="g-qty-group__stepper">
@@ -38,6 +39,7 @@
                             </div>
                         </template>
                     </Field>
+                    <Cell title="终止重量" :value="orderQty" v-else />
                 </CellGroup>
             </Form>
             <template #footer>
@@ -56,7 +58,7 @@ import { fullloading } from '@/utils/vant'
 import { handleRequestBigNumber, handleNumberValue, formatDecimal, parsePercent } from '@/filters'
 import { getGoodsUnitName } from '@/constants/unit'
 import { useOrder } from '@/business/trade'
-import { useFuturesStore } from '@/stores'
+import { useFuturesStore, useGlobalStore } from '@/stores'
 import { EPriceMode, EValidType, EBuildType } from '@/constants/client'
 import { BuyOrSell } from '@/constants/order'
 import quoteSocket from '@/services/websocket/quote'
@@ -69,6 +71,7 @@ const props = defineProps({
     }
 })
 
+const globalStore = useGlobalStore()
 const futuresStore = useFuturesStore()
 const quote = futuresStore.getGoodsQuote(props.selectedRow.goodsCode)
 

+ 5 - 2
src/packages/sbyj/views/order/list/components/market-order-delivery/index.vue

@@ -11,7 +11,8 @@
                     <Cell title="订单价格"
                         :value="formatDecimal(selectedRow.tHDetailEx.holderPrice, selectedRow.decimalPlace)" />
                     <Cell title="可用重量" :value="enableqty + getGoodsUnitName(selectedRow.goodsUnitID)" />
-                    <Field name="OrderQty" :label="getTagName() + '重量'" :rules="formRules.OrderQty">
+                    <Field name="OrderQty" :label="getTagName() + '重量'" :rules="formRules.OrderQty"
+                        v-if="globalStore.getSystemInfo('allDeliveryEnabled')">
                         <template #input>
                             <div class="g-qty-group">
                                 <div class="g-qty-group__stepper">
@@ -26,6 +27,7 @@
                             </div>
                         </template>
                     </Field>
+                    <Cell :title="getTagName() + '重量'" :value="orderQty" v-else />
                 </CellGroup>
                 <CellGroup inset>
                     <Cell title="交收时间" :value="param326 && param327 ? `${param326} - ${param327}` : '--'" />
@@ -49,7 +51,7 @@ import { BuyOrSell } from '@/constants/order'
 import { getGoodsUnitName } from '@/constants/unit'
 import { getServerTime } from '@/services/api/common'
 import { marketOrderDeliveryApply } from '@/services/api/trade'
-import { useUserStore, useFuturesStore } from '@/stores'
+import { useGlobalStore, useUserStore, useFuturesStore } from '@/stores'
 import AppModal from '@/components/base/modal/index.vue'
 import moment from 'moment'
 
@@ -64,6 +66,7 @@ const userStore = useUserStore()
 const param326 = userStore.getSystemParamValue('326')
 const param327 = userStore.getSystemParamValue('327')
 
+const globalStore = useGlobalStore()
 const futuresStore = useFuturesStore()
 const quote = futuresStore.getGoodsQuote(props.selectedRow.goodsCode)
 

+ 2 - 1
src/packages/sjgj/views/home/main/index.vue

@@ -15,7 +15,8 @@
       <app-block>
         <Cell class="home-main__titlebar" title="通知公告" value="更多" :to="{ name: 'notice-list' }" icon="volume" is-link>
           <template #title>
-            <Badge :offset="[10, 8]" :dot="noticeStore.unreadList.length > 0">{{ $t('routes.notice') }}</Badge>
+            <span>{{ $t('routes.notice') }}</span>
+            <Badge :dot="noticeStore.unreadList.length > 0"></Badge>
           </template>
         </Cell>
       </app-block>

+ 5 - 33
src/packages/tss/views/home/main/index.vue

@@ -1,7 +1,8 @@
 <template>
   <app-view class="home-main">
     <template #header>
-      <app-statusbar class="home-main__header" @ready="onReady" :style="{ backgroundImage: `url(${getFileUrl(topBanners)})` }">
+      <app-statusbar class="home-main__header" @ready="onReady"
+        :style="{ backgroundImage: `url(${getFileUrl(topBanners)})` }">
         <div class="searchbar">
           <Search shape="round" background="transparent" :placeholder="$t('tss.tips1')"
             @click="$router.push({ name: 'search' })" />
@@ -56,15 +57,12 @@ import { Cell, CellGroup, Search, Icon } from 'vant'
 import { getFileUrl } from '@/filters'
 import { queryImageConfigs } from '@/services/api/common'
 import { queryNewTitles } from '@/services/api/news'
-import { queryTouristGoods, queryTouristQuoteDay } from '@/services/api/goods'
-import { useLoginStore, useNoticeStore, useGoodsCollectionStore, useFuturesStore } from '@/stores'
+import { useNoticeStore, useGoodsCollectionStore } from '@/stores'
 import plus from '@/utils/h5plus'
 import ProductList from '../../product/list/components/waterfall-list/index.vue'
 
-const loginStore = useLoginStore()
 const noticeStore = useNoticeStore()
 const goodsCollectionStore = useGoodsCollectionStore()
-const futuresStore = useFuturesStore()
 
 const containerRef = shallowRef<HTMLDivElement>()
 const refreshing = shallowRef(false) // 是否处于加载中状态
@@ -99,39 +97,13 @@ const onRefresh = () => {
 }
 
 const onReady = (el: HTMLDivElement) => {
-    // 设置背景图位置
-    containerRef.value?.style.setProperty('background-position', `0 -${el.clientHeight}px`)
+  // 设置背景图位置
+  containerRef.value?.style.setProperty('background-position', `0 -${el.clientHeight}px`)
 }
 
 onMounted(() => {
   onRefresh()
 
-  if (!loginStore.token) {
-    // 获取游客商品列表
-    queryTouristGoods({
-      data: {
-        trademodes: '10,53'
-      }
-    }).then((res) => {
-      if (res.data.length) {
-        futuresStore.goodsList = res.data
-        const goodsCodes = res.data.map((e) => e.goodscode)
-
-        // 获取游客商品盘面
-        queryTouristQuoteDay({
-          data: {
-            goodsCodes: goodsCodes.join(',')
-          }
-        }).then((res) => {
-          goodsCodes.forEach((goodscode) => {
-            const item = res.data.find((e) => e.goodscode === goodscode)
-            futuresStore.updateQuotation(item ?? { goodscode })
-          })
-        })
-      }
-    })
-  }
-
   onActivated(() => {
     plus.setStatusBarStyle('light')
     onRefresh()

+ 50 - 6
src/packages/tss/views/product/list/components/waterfall-list/index.vue

@@ -3,7 +3,7 @@
         <template #default="{ item }">
             <div class="goods" @click="rowClick(item)">
                 <div class="goods-image">
-                    <img :src="getFileUrl(item.thumurls)" v-if="item.thumurls" />
+                    <img :src="getFirstImage(item.thumurls)" v-if="item.thumurls" />
                     <Image width="100%" height="160px" v-else />
                 </div>
                 <div class="goods-info">
@@ -18,13 +18,15 @@
 </template>
 
 <script lang="ts" setup>
-import { PropType } from 'vue'
+import { PropType, ref, onActivated } from 'vue'
 import { Image } from 'vant'
 import { getFileUrl, handleNumberValue, formatDecimal } from '@/filters'
 import { useNavigation } from '@mobile/router/navigation'
 import { BuyOrSell, BuildType, getGoodsCurrencyName } from '@/constants/order'
+import { queryTouristGoods, queryTouristQuoteDay } from '@/services/api/goods'
+import { useLoginStore, useFuturesStore } from '@/stores'
 import Waterfall from '@mobile/components/base/waterfall/index.vue'
-import { useFuturesStore } from '@/stores'
+import _ from 'lodash'
 
 defineProps({
     dataList: {
@@ -34,17 +36,25 @@ defineProps({
 })
 
 const { router } = useNavigation()
-const futureStore = useFuturesStore()
+const loginStore = useLoginStore()
+const futuresStore = useFuturesStore()
+const quotationList = ref<Model.GoodsQuote[]>([])
+
+// 获取商品首图
+const getFirstImage = (thumurls?: string) => {
+    const firstImage = thumurls ? thumurls.split(',')[0] : ''
+    return getFileUrl(firstImage)
+}
 
 // 获取商品价格
 const getPrice = (item: Model.TCEGoodsCollectionRsp) => {
-    const { ask = 0, currencyid = 0, decimalplace } = futureStore.getGoodsQuote(item.defaultgoodsid).value ?? {}
+    const { ask = 0, currencyid = 0, decimalplace } = quotationList.value.find((e) => e.goodsid === item.defaultgoodsid) ?? {}
     return ask ? getGoodsCurrencyName(currencyid) + formatDecimal(ask, decimalplace) : handleNumberValue()
 }
 
 // 获取价格颜色
 const getColor = (item: Model.TCEGoodsCollectionRsp) => {
-    const { askColor = '' } = futureStore.getGoodsQuote(item.defaultgoodsid).value ?? {}
+    const { askColor = '' } = quotationList.value.find((e) => e.goodsid === item.defaultgoodsid) ?? {}
     return askColor
 }
 
@@ -58,4 +68,38 @@ const rowClick = (row: Model.TCEGoodsCollectionRsp) => {
         }
     })
 }
+
+onActivated(() => {
+    if (loginStore.token) {
+        futuresStore.onDataCompleted(() => {
+            quotationList.value = _.cloneDeep(futuresStore.quotationList)
+        })
+    } else {
+        // 获取游客商品列表
+        queryTouristGoods({
+            data: {
+                trademodes: '10,53'
+            }
+        }).then((res) => {
+            if (res.data.length) {
+                futuresStore.goodsList = res.data
+                const goodsCodes = res.data.map((e) => e.goodscode)
+
+                // 获取游客商品盘面
+                queryTouristQuoteDay({
+                    data: {
+                        goodsCodes: goodsCodes.join(',')
+                    }
+                }).then((res) => {
+                    goodsCodes.forEach((goodscode) => {
+                        const item = res.data.find((e) => e.goodscode === goodscode)
+                        futuresStore.updateQuotation(item ?? { goodscode })
+                    })
+
+                    quotationList.value = _.cloneDeep(futuresStore.quotationList)
+                })
+            }
+        })
+    }
+})
 </script>

+ 5 - 1
src/stores/modules/global.ts

@@ -18,6 +18,8 @@ export interface SystemInfo {
     registrationCodeRule: -1 | 0 | 1; // 注册编码规则,-1=隐藏,0=非必填,1=必填
     riskType: 0 | 1 | 2; // 风控类型,1=按单风控,2=按账户风控
     i18nEnabled: boolean; // 是否启用多语言设置
+    allCloseEnabled: boolean; // 是否启用全部平仓
+    allDeliveryEnabled: boolean; // 是否启用全部交收
 }
 
 export const useGlobalStore = defineStore(() => {
@@ -43,7 +45,9 @@ export const useGlobalStore = defineStore(() => {
             forcedPasswordChange: false,
             registrationCodeRule: 1,
             riskType: 0,
-            i18nEnabled: true
+            i18nEnabled: true,
+            allCloseEnabled: false,
+            allDeliveryEnabled: false
         }
     })