lxf 2 weeks ago
parent
commit
1e3b576dce

+ 5 - 2
src/lang/follow/zh-CN.js

@@ -164,7 +164,10 @@ export default {
     "l161": "外汇专家",
     "l162": "能源专家",
     "l163": "指数专家",
-    "l164": "",
-    "l165": "",
+    "l164": "跟随了",
+    "l165": "几天前",
+    "l166": "专家主页",
+    "l167": "交易专家主页",
+    "l168": "进入管理",
   }
 }

+ 1 - 0
src/store/getter.js

@@ -33,4 +33,5 @@ export default {
 
   followList: state => state.copy.followList,
   followAccount: state => state.copy.followAccount,
+  expertInfo: state => state.copy.expertInfo,
 }

+ 15 - 1
src/store/modules/copy.js

@@ -1,8 +1,9 @@
-import { getFollowList, getFollowAccount } from "@/api/copy";
+import { getFollowList, getFollowAccount, getExpertInfo } from "@/api/copy";
 const copy = {
   state: {
     followList: [],
     followAccount: {},
+    expertInfo: {},
   },
   mutations: {
     setFollowList: (state, list) => {
@@ -11,6 +12,9 @@ const copy = {
     setFollowAccount: (state, info) => {
       state.followAccount = info
     },
+    setExpertInfo: (state, info) => {
+      state.expertInfo = info
+    },
   },
   actions: {
     getFollowList({ commit }, sign) {
@@ -24,6 +28,16 @@ const copy = {
         })
       })
     },
+    getExpertInfo({ commit }, sign) {
+      return new Promise((resolve, reject) => {
+        getExpertInfo().then(res => {
+          var list = res.list || []
+          commit('setExpertInfo', list[0] || {})
+          resolve(list[0] || {})
+        }).catch(error => {
+        })
+      })
+    },
     getFollowAccount({ commit }, sign) {
       return new Promise((resolve, reject) => {
         getFollowAccount().then(res => {

+ 1 - 1
src/view/account/components/list.vue

@@ -84,7 +84,7 @@
           </div>
         </div>
       </div>
-      <div class="li" @click="$router.push('/my-copy')" v-if="followAccount.id">
+      <div class="li" @click="$router.push('/market/follow/1')" v-if="followAccount.id">
         <div class="top flex">
           <div class="flex">
             <img class="icon" src="/img/copy/icon2.png" alt="">

+ 4 - 1
src/view/account/index.vue

@@ -52,7 +52,7 @@ export default {
     }
   },
   computed: {
-    ...mapGetters(['showAssets', 'currencyList', 'accountList', 'cashInfo', 'currency']),
+    ...mapGetters(['showAssets', 'currencyList', 'accountList', 'cashInfo', 'followAccount', 'currency']),
     currencyName() {
       return {
         'CNY': this.$t('common.l21'),
@@ -69,6 +69,9 @@ export default {
       if (this.cashInfo.uid) {
         amount += Number(this.$bigDecimal.multiply(this.cashInfo.balance, this.currencyList[this.currency] || 1))
       }
+      if (this.followAccount.uid) {
+        amount += Number(this.$bigDecimal.multiply(this.followAccount.balance, this.currencyList[this.currency] || 1))
+      }
       return amount
     }
   },

+ 29 - 8
src/view/copyTrade/copyDetail/components/historyList.vue

@@ -11,9 +11,9 @@
         <div class="box">
           <div class="left">
             <div class="name-box flex">
-              <div class="title">
-                贵州茅台
-              </div>
+              <div class="title" v-if="productDataObj[item.symbol]">
+            {{ productDataObj[item.symbol].title }}
+          </div>
               <div>({{ item.symbol }})</div>
               <div class="cmd" :class="'cmd' + item.cmd">
                 <!-- 买 -->
@@ -21,9 +21,9 @@
               </div>
             </div>
             <div class="price-box flex">
-              <div>{{ item.open_price }}</div>
+              <div>{{ $handleDigits(item.open_price, productDataObj[item.symbol] ? productDataObj[item.symbol].digits : 2) }}</div>
               <div>&gt;</div>
-              <div :class="{up: item.cmd == 0, down: item.cmd == 1}">{{ item.close_price }}</div>
+              <div :class="{up: item.cmd == 0, down: item.cmd == 1}">{{ $handleDigits(item.close_price, productDataObj[item.symbol] ? productDataObj[item.symbol].digits : 2) }}</div>
             </div>
           </div>
           <div class="profit">
@@ -31,7 +31,7 @@
               <!-- 盈亏 -->
               {{ $t('account.l7') }}
             </div>
-            <div class="number" :class="item.profit > 0 ? 'up' : 'down'">{{ item.profit > 0 ? '+' : '' }}{{ $handleDigits(item.profit) }}(12.73%)</div>
+            <div class="number" :class="item.profit > 0 ? 'up' : 'down'">{{ item.profit > 0 ? '+' : '' }}{{ $handleDigits(item.profit) }}({{ getRateReturn(item) }}%)</div>
           </div>
         </div>
         <van-row>
@@ -40,8 +40,8 @@
               <!-- 购买数量 -->
               {{ $t('follow.l35') }}
             </div>
-            <div>
-              {{ item.volume }}
+            <div v-if="productDataObj[item.symbol]">
+              {{ $handleDigits($bigDecimal.multiply(item.volume, productDataObj[item.symbol].contract_size)) }}
             </div>
           </van-col>
           <van-col span="8">
@@ -66,7 +66,9 @@
 </template>
 <script>
 import { getFollowHistoryTradeList } from "@/api/copy";
+import bus from '@/utils/bus'
 export default {
+  inject: ['getproductDataObj'],
   data () {
     return {
       pageNum: 0,
@@ -74,9 +76,15 @@ export default {
       finished: false,
       loading: false,
       list: [],
+      symbolList: [],
       id: '',
     }
   },
+  computed: {
+    productDataObj() {
+      return this.getproductDataObj()
+    },
+  },
   created () {
     this.id = this.$route.params.id
   },
@@ -95,6 +103,16 @@ export default {
         pageSize: this.pageSize,
       }).then(res => {
         var list = res.list || [];
+        var symbolList = []
+        list.forEach((item) => {
+          if (this.symbolList.indexOf(item.symbol) === -1 && !this.productDataObj[item.symbol]) {
+            symbolList.push(item.symbol)
+            this.symbolList.push(item.symbol)
+          }
+        })
+        bus.$emit("alterProductData", {
+          getData: symbolList
+        });
         if (this.pageNum == 1) {
           this.list = list;
         } else {
@@ -106,6 +124,9 @@ export default {
         }
       }).catch(() => {})
     },
+    getRateReturn(item) {
+      return (((item.close_price - item.open_price) / item.open_price) * 100).toFixed(2)
+    }
   }
 }
 </script>

+ 63 - 27
src/view/copyTrade/copyDetail/components/openList.vue

@@ -4,9 +4,9 @@
       <div class="box">
         <div class="left">
           <div class="name-box flex">
-            <div class="title">
-              贵州茅台
-            </div>
+            <div class="title" v-if="productDataObj[item.symbol]">
+            {{ productDataObj[item.symbol].title }}
+          </div>
             <div>({{ item.symbol }})</div>
             <div class="cmd" :class="'cmd' + item.cmd">
               <!-- 买 -->
@@ -14,9 +14,9 @@
             </div>
           </div>
           <div class="price-box flex">
-            <div>{{ item.open_price }}</div>
+            <div>{{ $handleDigits(item.open_price, productDataObj[item.symbol] ? productDataObj[item.symbol].digits : 2) }}</div>
             <div>&gt;</div>
-            <div :class="{up: item.cmd == 0, down: item.cmd == 1}">{{ item.close_price }}</div>
+            <div v-if="productDataObj[item.symbol]" :class="{up: item.cmd == 0, down: item.cmd == 1}">{{ $handleDigits(item.cmd == 0 ? productDataObj[item.symbol].ask : productDataObj[item.symbol].bid, productDataObj[item.symbol].digits) }}</div>
           </div>
         </div>
         <div class="profit">
@@ -24,7 +24,7 @@
             <!-- 持仓盈亏 -->
             {{ $t('account.l19') }}
           </div>
-          <div class="number" :class="item.profit > 0 ? 'up' : 'down'">{{ item.profit > 0 ? '+' : '' }}{{ $handleDigits(item.profit) }}(12.73%)</div>
+          <div class="number" :class="item.profit > 0 ? 'up' : 'down'">{{ item.profit > 0 ? '+' : '' }}{{ $handleDigits(item.profit) }}({{ getRateReturn(item) }}%)</div>
         </div>
       </div>
       <van-row>
@@ -33,8 +33,8 @@
             <!-- 持仓数量 -->
             {{ $t('follow.l34') }}
           </div>
-          <div>
-            {{ item.volume }}
+          <div v-if="productDataObj[item.symbol]">
+            {{ $handleDigits($bigDecimal.multiply(item.volume, productDataObj[item.symbol].contract_size)) }}
           </div>
         </van-col>
         <van-col span="8">
@@ -43,7 +43,7 @@
             {{ $t('account.l21') }}
           </div>
           <div>
-            2,000
+            {{ formatMarket(item) }}
           </div>
         </van-col>
       </van-row>
@@ -51,35 +51,71 @@
         {{ item.open_time.replace(/-/g, '/') }}
       </div>
     </div>
-    <NoData v-if="!loading && list.length == 0" />
+    <NoData v-if="list.length == 0" />
   </div>
 </template>
 <script>
-import { getFollowPositionTradeList } from "@/api/copy";
 export default {
+  props: ['list'],
+  inject: ['getproductDataObj'],
   data () {
     return {
-      loading: false,
-      list: [],
-      id: '',
     }
   },
-  created () {
-    this.id = this.$route.params.id
-    this.getFollowPositionTradeList()
+  computed: {
+    productDataObj() {
+      return this.getproductDataObj()
+    },
   },
   methods: {
-    getFollowPositionTradeList() {
-      this.loading = true
-      getFollowPositionTradeList({
-        eid: this.id,
-      }).then(res => {
-        var list = res.list || [];
-        this.list = list;
-      }).catch(() => {}).finally(() => {
-        this.loading = false
-      })
+    formatMarket(item) {
+      var currencyData = this.productDataObj[item.symbol]
+      if (currencyData) {
+        var market = this.$bigDecimal.multiply(item.close_price, this.$bigDecimal.multiply(item.volume, currencyData.contract_size))
+        var rate;
+        if (currencyData.market == 'CFD') {
+          if (currencyData.profit_mode == '1') {
+            var market1 = ''
+            var market2 = ''
+            if (currencyData.currency != 'USD') {
+              market1 = this.productDataObj[`USD${currencyData.currency}`]
+              market2 = this.productDataObj[`${currencyData.currency}USD`]
+              if (market1) {
+                rate = (market1['ask'] + market1['bid']) / 2
+              }
+              if (market2) {
+                rate = (market2['ask'] + market2['bid']) / 2
+              }
+              if (market2) {
+                market = market * rate
+              } else if (market1) {
+                market = market / rate
+              }
+            }
+          } else if (currencyData.profit_mode == '0') {
+            var symbol = currencyData.symbol.slice(3, 6)
+            var market1 = this.productDataObj[`USD${symbol}`]
+            var market2 = this.productDataObj[`${symbol}USD`]
+            if (market1) {
+              rate = (market1['ask'] + market1['bid']) / 2
+            }
+            if (market2) {
+              rate = (market2['ask'] + market2['bid']) / 2
+            }
+            if (market2) {
+              market = market * rate
+            } else if (market1) {
+              market = market / rate
+            }
+          }
+        }
+        return Number(market).toFixed(2)
+      }
+      return this.$bigDecimal.multiply(item.close_price, this.$bigDecimal.multiply(item.volume, item.productBean.contract_size))
     },
+    getRateReturn(item) {
+      return ((((item.cmd == 0 ? this.productDataObj[item.symbol].ask : this.productDataObj[item.symbol].bid) - item.open_price) / item.open_price) * 100).toFixed(2)
+    }
   }
 }
 </script>

+ 200 - 13
src/view/copyTrade/copyDetail/index.vue

@@ -19,8 +19,7 @@
                   {{ expertInfo.expert_title }}
                 </div>
                 <div class="level">
-                  <!-- 高级 -->
-                  {{ $t('setting.l14') }}
+                  {{ expertInfo.expert_level }}
                 </div>
               </div>
               <div class="time">
@@ -80,21 +79,21 @@
                 <!-- 资产净值(USD) -->
                 {{ $t('account.l2') }}(USD)
               </div>
-              <div>319,873.36</div>
+              <div>{{ $numToThousand(equity) }}</div>
             </van-col>
             <van-col span="8">
               <div class="lab">
                 <!-- 持仓盈亏(USD) -->
                 {{ $t('account.l19') }}(USD)
               </div>
-              <div class="up">572.39 (2.37%)</div>
+              <div :class="{up: allProfit >= 0, down: allProfit < 0}">{{ $numToThousand(allProfit) }} ({{ getPercentage(allProfit, equity) }}%)</div>
             </van-col>
             <van-col span="8">
               <div class="lab">
                 <!-- 持仓市值(USD) -->
                 {{ $t('account.l21') }}(USD)
               </div>
-              <div>319,873.36</div>
+              <div>{{ $numToThousand(allMarket) }}</div>
             </van-col>
           </van-row>
           <van-row gutter="6">
@@ -103,21 +102,21 @@
                 <!-- 可用现金(USD) -->
                 {{ $t('account.l23') }}(USD)
               </div>
-              <div>319,873.36</div>
+              <div>{{ $numToThousand(marginFree) }}</div>
             </van-col>
             <van-col span="8">
               <div class="lab">
                 <!-- 占用保证金(USD) -->
                 {{ $t('account.l22') }}(USD)
               </div>
-              <div class="up">572.39 (2.37%)</div>
+              <div class="up">{{ $numToThousand(followAccount.margin) }}</div>
             </van-col>
             <van-col span="8">
               <div class="lab">
                 <!-- 保证金比例 -->
                 {{ $t('account.l84') }}
               </div>
-              <div>319,873.36</div>
+              <div>{{ getPercentage(equity, followAccount.margin) }}%</div>
             </van-col>
           </van-row>
         </div>
@@ -143,7 +142,7 @@
         </div>
       </div>
     </div>
-    <openList v-if="type == 1" />
+    <openList :list="positionList" v-if="type == 1" />
     <historyList v-if="type == 2" />
     <van-popup v-model="cancelPop" round position="bottom">
       <cancelCopy :info="expertInfo" @success="cancelBack"/>
@@ -157,6 +156,7 @@ import historyList from "./components/historyList.vue";
 import cancelCopy from "./components/cancelCopy.vue";
 import { getFollowList, getFollowPositionTradeList, getFollowHistoryTradeList } from "@/api/copy";
 import { getProductList } from "@/api/product";
+import { mapGetters } from "vuex";
 import bus from '@/utils/bus'
 export default {
   components: {
@@ -165,6 +165,7 @@ export default {
     historyList,
     cancelCopy,
   },
+  inject: ['getproductDataObj'],
   data () {
     return {
       type: '1',
@@ -172,14 +173,55 @@ export default {
       positionList: [],
       historyTotal: 0,
       cancelPop: false,
-      id: ''
+      id: '',
+      positionSign: false,
+      updateSign: false,
+      allProfit: 0,
     }
   },
+  computed: {
+    ...mapGetters(['followAccount']),
+    productDataObj() {
+      return this.getproductDataObj()
+    },
+    equity() {
+      if(!this.positionSign || !this.updateSign) {
+        return this.followAccount.equity
+      }
+      var equity = Number(this.$bigDecimal.add(this.followAccount.balance, Number(this.allProfit)))
+      return equity
+    },
+    marginFree() {
+      if(!this.positionSign || !this.updateSign) {
+        return this.followAccount.margin_free
+      }
+      return this.$bigDecimal.add(this.$bigDecimal.subtract(this.followAccount.balance, Number(this.followAccount.margin)), Number(this.allProfit))
+    },
+    allMarket() {
+      var positionList = this.positionList
+      var allProfit = 0
+      var allMarket = 0
+      positionList.forEach((item, index) => {
+        var v = item
+        allProfit = this.$bigDecimal.add(allProfit, v.profit)
+        allProfit = this.$bigDecimal.add(allProfit, v.commission)
+        allProfit = this.$bigDecimal.add(allProfit, v.swaps)
+        allMarket = this.$bigDecimal.add(allMarket, this.formatMarket(item))
+      })
+      this.allProfit = allProfit
+      return allMarket
+    }
+  },
+  beforeDestroy() {
+    bus.$off('updateSymbol', this.updateSymbol)
+  },
   created () {
     this.id = this.$route.params.id
     this.getFollowList()
     this.getFollowPositionTradeList()
     this.getFollowHistoryTradeList()
+    this.$store.dispatch('getFollowAccount')
+    bus.$on('updateSymbol', this.updateSymbol)
   },
   methods: {
     getFollowPositionTradeList() {
@@ -201,6 +243,7 @@ export default {
         }).then(res => {
           var list = res.list || []
           var list1 = []
+          this.positionSign = true
           list.forEach(item => {
             if (item.profit_mode == 0) {
               var symbol = item.symbol.slice(3, 6)
@@ -220,15 +263,159 @@ export default {
             }
           })
           bus.$emit("alterProductData", {
-            getData: list1
-          });
-          bus.$emit("alterProductData", {
+            getData: list1,
             setData: list,
             subscribeList: [...symbolList]
           });
+          this.updateSymbol()
         })
       }).catch(() => {})
     },
+    updateSymbol() {
+      var positionList = this.positionList
+      positionList.forEach((item, index) => {
+        var v = item
+        this.updateSign = true
+        if (this.productDataObj[item.symbol]) {
+          if (item.cmd == 0) {
+            v.close_price = this.productDataObj[item.symbol].bid
+          }
+          if (item.cmd == 1) {
+            v.close_price = this.productDataObj[item.symbol].ask
+          }
+        }
+        v.profit = this.formatProfit(v) || v.profit
+        this.$set(this.positionList, index, v)
+      })
+    },
+    formatMarket(item) {
+      var currencyData = this.productDataObj[item.symbol]
+      if (currencyData) {
+        var market = this.$bigDecimal.multiply(item.close_price, this.$bigDecimal.multiply(item.volume, currencyData.contract_size))
+        var rate;
+        if (currencyData.market == 'CFD') {
+          if (currencyData.profit_mode == '1') {
+            var market1 = ''
+            var market2 = ''
+            if (currencyData.currency != 'USD') {
+              market1 = this.productDataObj[`USD${currencyData.currency}`]
+              market2 = this.productDataObj[`${currencyData.currency}USD`]
+              if (market1) {
+                rate = (market1['ask'] + market1['bid']) / 2
+              }
+              if (market2) {
+                rate = (market2['ask'] + market2['bid']) / 2
+              }
+              if (market2) {
+                market = market * rate
+              } else if (market1) {
+                market = market / rate
+              }
+            }
+          } else if (currencyData.profit_mode == '0') {
+            var symbol = currencyData.symbol.slice(3, 6)
+            var market1 = this.productDataObj[`USD${symbol}`]
+            var market2 = this.productDataObj[`${symbol}USD`]
+            if (market1) {
+              rate = (market1['ask'] + market1['bid']) / 2
+            }
+            if (market2) {
+              rate = (market2['ask'] + market2['bid']) / 2
+            }
+            if (market2) {
+              market = market * rate
+            } else if (market1) {
+              market = market / rate
+            }
+          }
+        }
+        return Number(market).toFixed(2)
+      }
+      return this.$bigDecimal.multiply(item.close_price, this.$bigDecimal.multiply(item.volume, item.productBean.contract_size))
+    },
+    formatProfit(data) {
+      var currencyData = this.productDataObj[data.symbol]
+      if (!currencyData) {
+        return data.profit
+      }
+      var rate, profit;
+      if (currencyData.market == 'CFD') {
+        if (currencyData.profit_mode == '1') {
+          var market1 = ''
+          var market2 = ''
+          if (currencyData.currency != 'USD') {
+            market1 = this.productDataObj[`USD${currencyData.currency}`]
+            market2 = this.productDataObj[`${currencyData.currency}USD`]
+            if (market1) {
+              rate = (market1['ask'] + market1['bid']) / 2
+            }
+            if (market2) {
+              rate = (market2['ask'] + market2['bid']) / 2
+            }
+          }
+          if (data.cmd == '1') {
+            if (market2) {
+              profit = (data.open_price - currencyData.ask) * (data.volume) * currencyData.contract_size * rate
+            } else if (market1) {
+              profit = ((data.open_price - currencyData.ask) * (data.volume) * currencyData.contract_size) / rate
+            } else {
+              profit = (data.open_price - currencyData.ask) * (data.volume) * currencyData.contract_size
+            }
+          } else if (data.cmd == '0') {
+            if (market2) {
+              profit = (currencyData.bid - data.open_price) * (data.volume) * currencyData.contract_size * rate
+            } else if (market1) {
+              profit = ((currencyData.bid - data.open_price) * (data.volume) * currencyData.contract_size) / rate
+            } else {
+              profit = (currencyData.bid - data.open_price) * (data.volume) * currencyData.contract_size
+            }
+          }
+        } else if (currencyData.profit_mode == '0') {
+          var symbol = currencyData.symbol.slice(3, 6)
+          var market1 = this.productDataObj[`USD${symbol}`]
+          var market2 = this.productDataObj[`${symbol}USD`]
+          if (market1) {
+            rate = (market1['ask'] + market1['bid']) / 2
+          }
+          if (market2) {
+            rate = (market2['ask'] + market2['bid']) / 2
+          }
+          if (data.cmd == '1') {
+            if (market2) {
+              profit = (data.open_price - currencyData.ask) * (data.volume) * currencyData.contract_size * rate
+            } else if (market1) {
+              profit = (( data.open_price - currencyData.ask) * (data.volume) * currencyData.contract_size) / rate
+            } else {
+              profit = ((data.open_price - currencyData.ask) * (data.volume) * currencyData.contract_size)
+            }
+          } else if (data.cmd == '0') {
+            if (market2) {
+              profit = (currencyData.bid - data.open_price) * (data.volume) * currencyData.contract_size * rate
+            } else if (market1) {
+              profit = ((currencyData.bid - data.open_price) * (data.volume) * currencyData.contract_size) / rate
+            } else {
+              profit = ((currencyData.bid - data.open_price) * (data.volume) * currencyData.contract_size)
+            }
+          }
+        }
+      } else {
+        if (data.cmd == '1') {
+          profit = (data.open_price - currencyData.ask) * (data.volume) * currencyData.contract_size
+        } else if (data.cmd == '0') {
+          profit = (currencyData.bid - data.open_price) * (data.volume) * currencyData.contract_size
+        }
+      }
+      if (profit) {
+        return profit.toFixed(2)
+      }
+      return '0.00'
+    },
+    getPercentage(value, equity) {
+      if (!value || !Number(equity)) {
+        return '0.00'
+      }
+      return (value/equity * 100).toFixed(2)
+    },
     getFollowHistoryTradeList() {
       getFollowHistoryTradeList({
         eid: this.id,

+ 1 - 2
src/view/copyTrade/following/components/followed.vue

@@ -16,8 +16,7 @@
                 {{ item.expert_title }}
               </div>
               <div class="level">
-                <!-- 高级 -->
-                {{ $t('setting.l14') }}
+                {{ item.expert_level }}
               </div>
             </div>
           </div>

+ 8 - 5
src/view/copyTrade/following/components/following.vue

@@ -16,15 +16,13 @@
                 {{ item.expert_title }}
               </div>
               <div class="level">
-                <!-- 高级 -->
-                {{ $t('setting.l14') }}
+                {{ item.expert_level }}
               </div>
             </div>
-            <div class="tip flex">
+            <div class="tip flex" v-if="item.expert_active_datetime">
               <div class="radius"></div>
               <div>
-                <!-- 在过去1天活跃 -->
-                {{ $t('follow.l140').replace('{p}', 1) }}
+                {{ getDay(item.expert_active_datetime) }}
               </div>
             </div>
           </div>
@@ -102,6 +100,11 @@ export default {
     cancelBack() {
       this.$store.dispatch('getFollowList')
       this.cancelPop = false
+    },
+    getDay(time) {
+      var timeDifference = new Date() - new Date(time.replace(' ', 'T') + '+08:00')
+      var day = Math.floor(timeDifference / (1000 * 60 * 60 * 24))
+      return day < 3 ? this.$t('follow.l140').replace('{p}', day || 1) : this.$t('follow.l165')
     }
   }
 }

+ 9 - 8
src/view/copyTrade/marketview/find/components/swipeList.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="com flex">
+  <div class="com flex" v-if="list.length">
     <img class="icon" src="/img/copy/market/icon5.png" alt="">
     <van-swipe
       vertical
@@ -7,16 +7,16 @@
       :autoplay="3000"
       :show-indicators="false"
     >
-      <van-swipe-item v-for="(item) in 6" style="height: 17px;" :key="item">
+      <van-swipe-item v-for="(item) in list" style="height: 17px;" :key="item.id">
         <div class="text">
-          用户昵称{{ item }} <span class="span">跟随了</span> 交易专家1
+          {{ item.user_title }} <span class="span">{{ $t('follow.l164') }}</span> {{ item.expert_title }}
         </div>
       </van-swipe-item>
     </van-swipe>
   </div>
 </template>
 <script>
-import { getFollowList } from "@/api/copy";
+import { getExpertFollowList } from "@/api/copy";
 export default {
   data () {
     return {
@@ -24,12 +24,13 @@ export default {
     }
   },
   created () {
-    // this.getFollowList()
+    this.getExpertFollowList()
   },
   methods: {
-    getFollowList() {
-      getFollowList({
-        status: 1
+    getExpertFollowList() {
+      getExpertFollowList({
+        pageNum: 1,
+        pageSize: 10,
       }).then(res => {
         this.list = res.list || []
       }).catch(() => {})

+ 7 - 4
src/view/copyTrade/marketview/find/index.vue

@@ -1,6 +1,6 @@
 <template>
-  <div>
-    <div class="header" @click="$router.push('/my-trade')">
+  <div class="find">
+    <div class="header" @click="$router.push('/my-trade')" v-if="isLogin">
       <div class="box">
         <div class="left">
           <div class="flex">
@@ -28,7 +28,7 @@
     <userList :list="stockList" market="stock" v-if="stockList.length" />
     <userList :list="cfdList" market="cfd" v-if="cfdList.length" />
     <swipeList />
-    <applyBox />
+    <applyBox v-if="expertInfo.status != 1" />
   </div>
 </template>
 <script>
@@ -56,7 +56,7 @@ export default {
     }
   },
   computed: {
-    ...mapGetters(['followList']),
+    ...mapGetters(['followList', 'expertInfo']),
   },
   created () {
     this.getExpertList(this.market, 'stockList')
@@ -76,6 +76,9 @@ export default {
 }
 </script>
 <style lang="less" scoped>
+.find {
+  padding-bottom: 20px;
+}
 .header {
   cursor: pointer;
   padding: 0 16px 10px;

+ 15 - 0
src/view/copyTrade/marketview/index.vue

@@ -16,6 +16,13 @@
         {{ $t('market.l10') }}
         <div class="line"></div>
       </div>
+      <div class="href flex" @click="$router.push('/my-copy')">
+        <div>
+          <!-- 专家主页 -->
+          {{ $t('follow.l166') }}
+        </div>
+        <van-icon name="arrow" />
+      </div>
     </div>
     <findView v-if="market == '1'" />
     <tradingExperts v-if="market == '2'" :market="market"/>
@@ -47,6 +54,7 @@ export default {
   activated () {
     if (this.isLogin) {
       this.$store.dispatch('getFollowList')
+      this.$store.dispatch('getExpertInfo')
     }
   },
   created () {
@@ -98,6 +106,13 @@ export default {
       }
     }
   }
+  .href {
+    position: absolute;
+    top: 18px;
+    right: 13px;
+    color: #4670F6;
+    cursor: pointer;
+  }
   .line {
     position: absolute;
     left: 50%;

+ 32 - 14
src/view/copyTrade/marketview/tradingExperts/index.vue

@@ -12,20 +12,34 @@
         </van-col>
         <van-col span="12">
           <div class="col2">
-            <div>
-              <!-- 成为交易专家 -->
-              {{ $t('follow.l4') }}
-            </div>
-            <div class="lab">
-              <!-- 赚取 10 % 分润 -->
-              {{ $t('follow.l5') }}
-            </div>
-            <div class="flex">
-              <div class="btn" @click="$router.push('/copy')">
-                <!-- 立即申请 -->
-                {{ $t('join.l12') }}
+            <template v-if="expertInfo.status == 1">
+              <div class="lab1">
+                <!-- 交易专家主页 -->
+                {{ $t('follow.l167') }}
               </div>
-            </div>
+              <div class="flex">
+                <div class="btn" @click="$router.push('/my-copy')">
+                  <!-- 进入管理 -->
+                  {{ $t('follow.l168') }}
+                </div>
+              </div>
+            </template>
+            <template v-else>
+              <div>
+                <!-- 成为交易专家 -->
+                {{ $t('follow.l4') }}
+              </div>
+              <div class="lab">
+                <!-- 赚取 10 % 分润 -->
+                {{ $t('follow.l5') }}
+              </div>
+              <div class="flex">
+                <div class="btn" @click="$router.push('/copy')">
+                  <!-- 立即申请 -->
+                  {{ $t('join.l12') }}
+                </div>
+              </div>
+            </template>
           </div>
         </van-col>
       </van-row>
@@ -145,7 +159,7 @@ export default {
     }
   },
   computed: {
-    ...mapGetters(['followList']),
+    ...mapGetters(['followList', 'expertInfo']),
     followIdList() {
       return this.followList.map(item => item.eid)
     },
@@ -236,6 +250,10 @@ export default {
     margin-top: 6px;
     margin-bottom: 10px;
   }
+  .lab1 {
+    padding-top: 4px;
+    margin-bottom: 18px;
+  }
   .btn {
     cursor: pointer;
     background-color: #0F8DDF;

+ 29 - 5
src/view/copyTrade/myCopy/components/followers.vue

@@ -8,18 +8,18 @@
         {{ $t('follow.l79') }}
       </div>
     </div>
-    <div class="li" v-for="item in 6" :key="item">
+    <div class="li" v-for="item in list" :key="item.id">
       <div class="box">
         <van-image
           width="36"
           height="36"
           round
           fit="cover"
-          :src="'/img/home/user.png'"
+          :src="item.user_header || '/img/home/user.png'"
         />
         <div class="right">
           <div class="name">
-            交易专家1
+            {{ item.user_title }}
           </div>
           <div class="col flex">
             <div>
@@ -27,7 +27,7 @@
               {{ $t('follow.l77') }}
             </div>
             <div>
-              21,212,124.98 USD
+              {{ $numToThousand(item.margin) }} USD
             </div>
           </div>
           <div class="col flex">
@@ -36,19 +36,43 @@
               {{ $t('follow.l78') }}
             </div>
             <div class="up">
-              21,212,124.98 USD
+              {{ $numToThousand(item.profit) }} USD
             </div>
           </div>
         </div>
       </div>
     </div>
+    <NoData v-if="list.length == 0 && loaded" />
   </div>
 </template>
 <script>
+import { getExpertFollowList } from "@/api/copy";
 export default {
   data () {
     return {
       checked: false,
+      loaded: false,
+      list: []
+    }
+  },
+  watch: {
+    checked(val) {
+      this.getExpertFollowList(val ? 30 : undefined)
+    }
+  },
+  created () {
+    this.getExpertFollowList()
+  },
+  methods: {
+    getExpertFollowList(size) {
+      getExpertFollowList({
+        eid: this.$route.params.id,
+        pageSize: size
+      }).then(res => {
+        this.list = res.list || []
+      }).catch(() => {}).finally(() => {
+        this.loaded = true
+      })
     }
   }
 }

+ 6 - 2
src/view/copyTrade/myCopy/components/profit.vue

@@ -20,7 +20,7 @@
           {{ $t('follow.l116') }}(USD)
         </div>
         <div>
-          2,367.47
+          {{ $numToThousand(expertInfo.balance) }}
         </div>
       </div>
       <div class="btn" @click="settlementPop = true">
@@ -39,6 +39,7 @@
 </template>
 <script>
 import settlement from "./settlement.vue";
+import { mapGetters } from "vuex";
 export default {
   components: {
     settlement
@@ -47,7 +48,10 @@ export default {
     return {
       settlementPop: false
     }
-  }
+  },
+  computed: {
+    ...mapGetters(['expertInfo']),
+  },
 }
 </script>
 <style lang="less" scoped>

+ 5 - 1
src/view/copyTrade/myCopy/components/settlement.vue

@@ -6,7 +6,7 @@
     </div>
     <div class="id">
       <!-- 将分润账户内的 2,367.47 USD转入美元钱包? -->
-      {{ $t('follow.l120').replace('{p}', '2,367.47') }}
+      {{ $t('follow.l120').replace('{p}', $numToThousand(expertInfo.balance)) }}
     </div>
     <div class="btn-box flex">
       <div class="btn ltn" @click="cancel">
@@ -21,12 +21,16 @@
   </div>
 </template>
 <script>
+import { mapGetters } from "vuex";
 export default {
   data () {
     return {
       
     }
   },
+  computed: {
+    ...mapGetters(['expertInfo']),
+  },
   methods: {
     cancel() {
       this.$emit('cancel')

+ 51 - 18
src/view/copyTrade/myCopy/index.vue

@@ -7,20 +7,21 @@
       </div>
     </BackBar1>
     <div class="conatiner">
-      <div class="box flex">
+      <div class="box flex" v-if="expertInfo.eid">
         <van-image
           width="36"
           height="36"
           round
           fit="cover"
-          :src="'/img/home/user.png'"
+          :src="expertInfo.header || '/img/home/user.png'"
         />
         <div class="left">
           <div class="flex name-box">
             <div class="name">
-              交易专家1
+              {{ expertInfo.title }}
             </div>
             <div class="level">
+              {{ expertInfo.level }}
               <!-- 高级 -->
               {{ $t('setting.l14') }}
             </div>
@@ -32,10 +33,10 @@
           <div class="flex bottom">
             <div class="flex users">
               <img class="icon" src="/img/copy/market/icon6.png" alt="">
-              <div>99/100</div>
+              <div>{{ expertInfo.user_count }}/100</div>
             </div>
             <div class="uid">
-              UID:15641321
+              UID:{{ expertInfo.eid }}
             </div>
           </div>
         </div>
@@ -45,23 +46,15 @@
           <!-- 极度认证 -->
           {{ $t('follow.l59') }}
         </div>
-        <div class="tag">
-          A股专家
-        </div>
-        <div class="tag">
-          港股专家
+        <div class="tag" v-for="(tag, index) in product_group" :key="index">
+          {{ tagName[tag] }}
         </div>
       </div>
       <profit />
       <setting />
       <div class="tabbar flex">
-        <div class="bar" :class="{active: market == '1'}" @click="market = '1'">
-          <!-- 沪深 -->
-          {{ $t('market.l9') }}
-        </div>
-        <div class="bar" :class="{active: market == '2'}" @click="market = '2'">
-          <!-- 港股 -->
-          {{ $t('common.l42') }}
+        <div class="bar" v-for="tag in product_group" :key="tag" :class="{active: market == tag}" @click="market = tag">
+          {{ titleName[tag] }}
         </div>
       </div>
       <div class="box2">
@@ -145,6 +138,7 @@ import orderView from "./orderView";
 import followers from "./components/followers.vue";
 import BackBar1 from '@/components/backBar1'
 import shareIcon1 from "@/components/shareIcon1";
+import { mapGetters } from "vuex";
 export default {
   components: {
     BackBar1,
@@ -158,13 +152,52 @@ export default {
   },
   data () {
     return {
-      market: '1',
+      market: '',
       tab: '1',
       id: '',
     }
   },
+  computed: {
+    ...mapGetters(['expertInfo']),
+    product_group() {
+      var product_group = this.expertInfo.product_group ? JSON.parse(this.expertInfo.product_group) : []
+      return product_group.filter(item => this.tagName[item])
+    },
+    titleName() {
+      return {
+        "US": this.$t('common.l41'),
+        "HK": this.$t('common.l42'),
+        "CN": this.$t('download.l19'),
+        "4": this.$t('download.l27'),
+        "3": this.$t('market.l19'),
+        "其他": this.$t('inform.l22'),
+        "5": this.$t('market.l24'),
+        "1": this.$t('market.l21'),
+        "2": this.$t('market.l22')
+      }
+    },
+    tagName() {
+      return {
+        "US": this.$t('follow.l158'),
+        "HK": this.$t('follow.l157'),
+        "CN": this.$t('follow.l156'),
+        "4": this.$t('follow.l163'),
+        "3": this.$t('follow.l162'),
+        "5": this.$t('follow.l159'),
+        "1": this.$t('follow.l161'),
+        "2": this.$t('follow.l160')
+      }
+    }
+  },
   created () {
     this.id = this.$route.params.id
+    this.$store.dispatch('getExpertInfo').then(() => {
+      this.$nextTick(() => {
+        if (!this.market) {
+          this.market = this.product_group[0] || ''
+        }
+      })
+    })
   }
 }
 </script>

+ 86 - 18
src/view/copyTrade/myCopy/orderView/components/historyList.vue

@@ -1,26 +1,32 @@
 <template>
-  <div class="list">
-    <div class="li" v-for="item in 6" :key="item">
+  <van-list
+    :offset="900"
+    v-model="loading"
+    :finished="finished"
+    :finished-text="list.length ? $t('common.l5') : ''"
+    @load="onLoad"
+  >
+    <div class="li" v-for="item in list" :key="item.ticket">
       <div class="left">
         <div class="box flex">
-          <div class="title">
-            贵州茅台
+          <div class="title" v-if="productDataObj[item.symbol]">
+            {{ productDataObj[item.symbol].title }}
           </div>
-          <div>(00700.HK)</div>
-          <div class="cmd">
+          <div>({{ item.symbol }})</div>
+          <div class="cmd" :class="'cmd' + item.cmd">
             <!-- 买 -->
-            {{ $t('follow.l32') }}
+            {{ item.cmd == 0 ? $t('follow.l32') : $t('follow.l33') }}
           </div>
         </div>
         <div class="price flex">
-          <div>42785.25</div>
+          <div>{{ $handleDigits(item.open_price, productDataObj[item.symbol] ? productDataObj[item.symbol].digits : 2) }}</div>
           &gt;
-          <div :class="{up: item == 0, down: item == 1}">42785.25</div>
+          <div :class="{up: item.cmd == 0, down: item.cmd == 1}">{{ $handleDigits(item.close_price, productDataObj[item.symbol] ? productDataObj[item.symbol].digits : 2) }}</div>
         </div>
         <div class="time flex">
-          <div>2024/04/22 09:32:33</div>
+          <div>{{ item.open_time.replace(/-/g, '/') }}</div>
           <img class="icon" src="/img/copy/icon1.png" alt="">
-          <div>2024/04/22 09:32:33</div>
+          <div>{{ item.close_time.replace(/-/g, '/') }}</div>
         </div>
       </div>
       <div class="right">
@@ -29,8 +35,8 @@
             <!-- 数量 -->
             {{ $t('common.l25') }}
           </div>
-          <div>
-            1,000
+          <div v-if="productDataObj[item.symbol]">
+            {{ $handleDigits($bigDecimal.multiply(item.volume, productDataObj[item.symbol].contract_size)) }}
           </div>
         </div>
         <div class="income-box">
@@ -38,25 +44,84 @@
             <!-- 收益率 -->
             {{ $t('follow.l7') }}
           </div>
-          <div class="val up">
-            12.73%
+          <div class="val" :class="getRateReturn(item) > 0 ? 'up' : 'down'">
+            {{ getRateReturn(item) }}%
           </div>
         </div>
       </div>
     </div>
-  </div>
+    <NoData v-if="!loading && list.length == 0" />
+  </van-list>
 </template>
 <script>
+import { getExpertTradeList } from "@/api/copy";
+import bus from '@/utils/bus'
+import { mapGetters } from "vuex";
 export default {
+  inject: ['getproductDataObj'],
   data () {
     return {
-      
+      pageNum: 0,
+      pageSize: 20,
+      finished: false,
+      loading: false,
+      list: [],
+      symbolList: [],
+    }
+  },
+  computed: {
+    ...mapGetters(['expertInfo']),
+    productDataObj() {
+      return this.getproductDataObj()
+    },
+  },
+  created () {
+  },
+  methods: {
+    onLoad() {
+      this.pageNum += 1;
+      if (this.pageNum == 1) {
+        this.list = [];
+      }
+      this.getExpertTradeList()
+    },
+    getExpertTradeList() {
+      getExpertTradeList({
+        eid: this.expertInfo.eid,
+        status: 2,
+        pageNum: this.pageNum,
+        pageSize: this.pageSize,
+      }).then(res => {
+        var list = res.list || [];
+        var symbolList = []
+        list.forEach((item) => {
+          if (this.symbolList.indexOf(item.symbol) === -1 && !this.productDataObj[item.symbol]) {
+            symbolList.push(item.symbol)
+            this.symbolList.push(item.symbol)
+          }
+        })
+        bus.$emit("alterProductData", {
+          getData: symbolList
+        });
+        if (this.pageNum == 1) {
+          this.list = list;
+        } else {
+          this.list = this.list.concat(list);
+        }
+        this.loading = false;
+        if (res.endRow == res.total) {
+          this.finished = true;
+        }
+      }).catch(() => {})
+    },
+    getRateReturn(item) {
+      return (((item.close_price - item.open_price) / item.open_price) * 100).toFixed(2)
     }
   }
 }
 </script>
 <style lang="less" scoped>
-.list {
+.van-list {
   padding: 0 16px 10px;
 }
 .li {
@@ -91,6 +156,9 @@ export default {
     font-size: 10px;
     color: #FFFFFF;
   }
+  .cmd1 {
+    background-color: var(--green-);
+  }
 }
 .price {
   font-size: 12px;

+ 60 - 14
src/view/copyTrade/myCopy/orderView/components/openList.vue

@@ -1,24 +1,24 @@
 <template>
   <div class="list">
-    <div class="li" v-for="item in 6" :key="item">
+    <div class="li" v-for="item in list" :key="item.ticket">
       <div class="left">
         <div class="box flex">
-          <div class="title">
-            贵州茅台
+          <div class="title" v-if="productDataObj[item.symbol]">
+            {{ productDataObj[item.symbol].title }}
           </div>
-          <div>(00700.HK)</div>
-          <div class="cmd">
+          <div>({{ item.symbol }})</div>
+          <div class="cmd" :class="'cmd' + item.cmd">
             <!-- 买 -->
-            {{ $t('follow.l32') }}
+            {{ item.cmd == 0 ? $t('follow.l32') : $t('follow.l33') }}
           </div>
         </div>
         <div class="price flex">
-          <div>42785.25</div>
+          <div>{{ $handleDigits(item.open_price, productDataObj[item.symbol] ? productDataObj[item.symbol].digits : 2) }}</div>
           &gt;
-          <div :class="{up: item == 0, down: item == 1}">42785.25</div>
+          <div v-if="productDataObj[item.symbol]" :class="{up: item.cmd == 0, down: item.cmd == 1}">{{ $handleDigits(item.cmd == 0 ? productDataObj[item.symbol].ask : productDataObj[item.symbol].bid, productDataObj[item.symbol].digits) }}</div>
         </div>
         <div class="time flex">
-          <div>2024/04/22 09:32:33</div>
+          <div>{{ item.open_time.replace(/-/g, '/') }}</div>
         </div>
       </div>
       <div class="right">
@@ -27,8 +27,8 @@
             <!-- 数量 -->
             {{ $t('common.l25') }}
           </div>
-          <div>
-            1,000
+          <div v-if="productDataObj[item.symbol]">
+            {{ $handleDigits($bigDecimal.multiply(item.volume, productDataObj[item.symbol].contract_size)) }}
           </div>
         </div>
         <div class="income-box">
@@ -36,19 +36,65 @@
             <!-- 收益率 -->
             {{ $t('follow.l7') }}
           </div>
-          <div class="val up">
-            12.73%
+          <div class="val" v-if="productDataObj[item.symbol]" :class="getRateReturn(item) > 0 ? 'up' : 'down'">
+            {{ getRateReturn(item) }}%
           </div>
         </div>
       </div>
     </div>
+    <NoData v-if="!loading && list.length == 0" />
   </div>
 </template>
 <script>
+import { getExpertTradeList } from "@/api/copy";
+import bus from '@/utils/bus'
+import { mapGetters } from "vuex";
 export default {
+  inject: ['getproductDataObj'],
   data () {
     return {
-      
+      loading: false,
+      list: [],
+      symbolList: [],
+    }
+  },
+  computed: {
+    ...mapGetters(['expertInfo']),
+    productDataObj() {
+      return this.getproductDataObj()
+    },
+  },
+  created () {
+    this.getExpertTradeList()
+  },
+  methods: {
+    getExpertTradeList() {
+      this.loading = true;
+      getExpertTradeList({
+        eid: this.expertInfo.eid,
+        status: 1,
+      }).then(res => {
+        var list = res.list || [];
+        var symbolList = []
+        list.forEach((item) => {
+          if (this.symbolList.indexOf(item.symbol) === -1) {
+            this.symbolList.push(item.symbol)
+            if (!this.productDataObj[item.symbol]) {
+              symbolList.push(item.symbol)
+            }
+          }
+        })
+        bus.$emit("alterProductData", {
+          getData: symbolList,
+          subscribeList: [...this.symbolList]
+        });
+        this.list = list;
+      }).catch(() => {}).finally(() => {
+        this.loading = false;
+      })
+    },
+    getRateReturn(item) {
+      return ((((item.cmd == 0 ? this.productDataObj[item.symbol].ask : this.productDataObj[item.symbol].bid) - item.open_price) / item.open_price) * 100).toFixed(2)
     }
   }
 }

+ 7 - 1
src/view/copyTrade/myTrade/index.vue

@@ -27,7 +27,7 @@
         <van-row gutter="6" type="flex">
           <van-col span="8">
             <div class="amount">
-              79,237.68
+              {{ $numToThousand(followAccount.equity) }}
             </div>
           </van-col>
           <van-col span="8">
@@ -71,6 +71,7 @@ import BackBar1 from '@/components/backBar1'
 import list from "./components/list.vue";
 import list1 from "./components/list1.vue";
 import incomeDetails from "./components/incomeDetails.vue";
+import { mapGetters } from "vuex";
 export default {
   components: {
     BackBar1,
@@ -78,6 +79,9 @@ export default {
     list1,
     incomeDetails
   },
+  computed: {
+    ...mapGetters(['followAccount']),
+  },
   data () {
     return {
       type: '1',
@@ -86,6 +90,7 @@ export default {
   },
   created () {
     this.$store.dispatch('getFollowList')
+    this.$store.dispatch('getFollowAccount')
   }
 }
 </script>
@@ -108,6 +113,7 @@ export default {
   }
   .amount {
     font-size: 20px;
+    word-break: break-all;
   }
   .btn {
     cursor: pointer;

+ 8 - 12
src/view/copyTrade/register/home.vue

@@ -120,7 +120,7 @@
       </div>
     </div>
     <template v-if="loaded">
-      <div class="btn-box" v-if="info.id && info.status == 0">
+      <div class="btn-box" v-if="expertInfo.id && expertInfo.status == 0">
         <div class="btn flex btn1">
           <div>
             <!-- 您已提交过申请 -->
@@ -152,8 +152,8 @@
   </div>
 </template>
 <script>
-import { getExpertInfo } from "@/api/copy";
 import BackBar1 from '@/components/backBar1'
+import { mapGetters } from "vuex";
 export default {
   components: {
     BackBar1
@@ -162,7 +162,6 @@ export default {
     return {
       checked: true,
       loaded: false,
-      info: {},
       list: [
         {
           rate: '20%',
@@ -192,6 +191,7 @@ export default {
     }
   },
   computed: {
+    ...mapGetters(['expertInfo']),
     rateText() {
       return {
         // '1000': '至尊',
@@ -210,17 +210,13 @@ export default {
     }
   },
   created () {
-    this.getExpertInfo()
+    this.$store.dispatch('getExpertInfo').then((res) => {
+      if (res.status != 1) {
+        this.loaded = true
+      }
+    })
   },
   methods: {
-    getExpertInfo() {
-      getExpertInfo().then(res => {
-        var list = res.list || []
-        this.info = list[0] || {}
-      }).catch(() => {}).finally(() => {
-        this.loaded = true
-      })
-    },
     nextStep() {
       if (!this.checked) {
         // this.$toast('请阅读并同意交易专家协议');

+ 8 - 2
src/view/copyTrade/tradeDetail/components/followers.vue

@@ -55,13 +55,19 @@ export default {
       list: []
     }
   },
+  watch: {
+    checked(val) {
+      this.getExpertFollowList(val ? 30 : undefined)
+    }
+  },
   created () {
     this.getExpertFollowList()
   },
   methods: {
-    getExpertFollowList() {
+    getExpertFollowList(size) {
       getExpertFollowList({
-
+        eid: this.$route.params.id,
+        pageSize: size
       }).then(res => {
         this.list = res.list || []
       }).catch(() => {}).finally(() => {

+ 29 - 8
src/view/copyTrade/tradeDetail/orderView/components/historyList.vue

@@ -9,8 +9,8 @@
     <div class="li" v-for="item in list" :key="item.ticket">
       <div class="left">
         <div class="box flex">
-          <div class="title">
-            贵州茅台
+          <div class="title" v-if="productDataObj[item.symbol]">
+            {{ productDataObj[item.symbol].title }}
           </div>
           <div>({{ item.symbol }})</div>
           <div class="cmd" :class="'cmd' + item.cmd">
@@ -19,9 +19,9 @@
           </div>
         </div>
         <div class="price flex">
-          <div>{{ item.open_price }}</div>
+          <div>{{ $handleDigits(item.open_price, productDataObj[item.symbol] ? productDataObj[item.symbol].digits : 2) }}</div>
           &gt;
-          <div :class="{up: item.cmd == 0, down: item.cmd == 1}">{{ item.close_price }}</div>
+          <div :class="{up: item.cmd == 0, down: item.cmd == 1}">{{ $handleDigits(item.close_price, productDataObj[item.symbol] ? productDataObj[item.symbol].digits : 2) }}</div>
         </div>
         <div class="time flex">
           <div>{{ item.open_time.replace(/-/g, '/') }}</div>
@@ -35,8 +35,8 @@
             <!-- 数量 -->
             {{ $t('common.l25') }}
           </div>
-          <div>
-            {{ item.volume }}
+          <div v-if="productDataObj[item.symbol]">
+            {{ $handleDigits($bigDecimal.multiply(item.volume, productDataObj[item.symbol].contract_size)) }}
           </div>
         </div>
         <div class="income-box">
@@ -44,8 +44,8 @@
             <!-- 收益率 -->
             {{ $t('follow.l7') }}
           </div>
-          <div class="val up">
-            12.73%
+          <div class="val" :class="getRateReturn(item) > 0 ? 'up' : 'down'">
+            {{ getRateReturn(item) }}%
           </div>
         </div>
       </div>
@@ -55,7 +55,9 @@
 </template>
 <script>
 import { getExpertTradeList } from "@/api/copy";
+import bus from '@/utils/bus'
 export default {
+  inject: ['getproductDataObj'],
   data () {
     return {
       pageNum: 0,
@@ -63,9 +65,15 @@ export default {
       finished: false,
       loading: false,
       list: [],
+      symbolList: [],
       id: '',
     }
   },
+  computed: {
+    productDataObj() {
+      return this.getproductDataObj()
+    },
+  },
   created () {
     this.id = this.$route.params.id
   },
@@ -85,6 +93,16 @@ export default {
         pageSize: this.pageSize,
       }).then(res => {
         var list = res.list || [];
+        var symbolList = []
+        list.forEach((item) => {
+          if (this.symbolList.indexOf(item.symbol) === -1 && !this.productDataObj[item.symbol]) {
+            symbolList.push(item.symbol)
+            this.symbolList.push(item.symbol)
+          }
+        })
+        bus.$emit("alterProductData", {
+          getData: symbolList
+        });
         if (this.pageNum == 1) {
           this.list = list;
         } else {
@@ -96,6 +114,9 @@ export default {
         }
       }).catch(() => {})
     },
+    getRateReturn(item) {
+      return (((item.close_price - item.open_price) / item.open_price) * 100).toFixed(2)
+    }
   }
 }
 </script>

+ 32 - 8
src/view/copyTrade/tradeDetail/orderView/components/openList.vue

@@ -3,8 +3,8 @@
     <div class="li" v-for="item in list" :key="item.ticket">
       <div class="left">
         <div class="box flex">
-          <div class="title">
-            贵州茅台
+          <div class="title" v-if="productDataObj[item.symbol]">
+            {{ productDataObj[item.symbol].title }}
           </div>
           <div>({{ item.symbol }})</div>
           <div class="cmd" :class="'cmd' + item.cmd">
@@ -13,9 +13,9 @@
           </div>
         </div>
         <div class="price flex">
-          <div>{{ item.open_price }}</div>
+          <div>{{ $handleDigits(item.open_price, productDataObj[item.symbol] ? productDataObj[item.symbol].digits : 2) }}</div>
           &gt;
-          <div :class="{up: item.cmd == 0, down: item.cmd == 1}">{{ item.close_price }}</div>
+          <div v-if="productDataObj[item.symbol]" :class="{up: item.cmd == 0, down: item.cmd == 1}">{{ $handleDigits(item.cmd == 0 ? productDataObj[item.symbol].ask : productDataObj[item.symbol].bid, productDataObj[item.symbol].digits) }}</div>
         </div>
         <div class="time flex">
           <div>{{ item.open_time.replace(/-/g, '/') }}</div>
@@ -27,8 +27,8 @@
             <!-- 数量 -->
             {{ $t('common.l25') }}
           </div>
-          <div>
-            {{ item.volume }}
+          <div v-if="productDataObj[item.symbol]">
+            {{ $handleDigits($bigDecimal.multiply(item.volume, productDataObj[item.symbol].contract_size)) }}
           </div>
         </div>
         <div class="income-box">
@@ -36,8 +36,8 @@
             <!-- 收益率 -->
             {{ $t('follow.l7') }}
           </div>
-          <div class="val up">
-            12.73%
+          <div class="val" v-if="productDataObj[item.symbol]" :class="getRateReturn(item) > 0 ? 'up' : 'down'">
+            {{ getRateReturn(item) }}%
           </div>
         </div>
       </div>
@@ -47,14 +47,22 @@
 </template>
 <script>
 import { getExpertTradeList } from "@/api/copy";
+import bus from '@/utils/bus'
 export default {
+  inject: ['getproductDataObj'],
   data () {
     return {
       loading: false,
       list: [],
+      symbolList: [],
       id: '',
     }
   },
+  computed: {
+    productDataObj() {
+      return this.getproductDataObj()
+    },
+  },
   created () {
     this.id = this.$route.params.id
     this.getExpertTradeList()
@@ -67,11 +75,27 @@ export default {
         status: 1,
       }).then(res => {
         var list = res.list || [];
+        var symbolList = []
+        list.forEach((item) => {
+          if (this.symbolList.indexOf(item.symbol) === -1) {
+            this.symbolList.push(item.symbol)
+            if (!this.productDataObj[item.symbol]) {
+              symbolList.push(item.symbol)
+            }
+          }
+        })
+        bus.$emit("alterProductData", {
+          getData: symbolList,
+          subscribeList: [...this.symbolList]
+        });
         this.list = list;
       }).catch(() => {}).finally(() => {
         this.loading = false;
       })
     },
+    getRateReturn(item) {
+      return ((((item.cmd == 0 ? this.productDataObj[item.symbol].ask : this.productDataObj[item.symbol].bid) - item.open_price) / item.open_price) * 100).toFixed(2)
+    }
   }
 }
 </script>

+ 4 - 1
src/view/home/components/loginBox.vue

@@ -64,7 +64,7 @@ export default {
     }
   },
   computed: {
-    ...mapGetters(['showAssets', 'currencyList', 'accountList', 'cashInfo', 'currency']),
+    ...mapGetters(['showAssets', 'currencyList', 'accountList', 'cashInfo', 'followAccount', 'currency']),
     allAssets() {
       var amount = 0
       this.accountList.forEach(item => {
@@ -74,6 +74,9 @@ export default {
       if (this.cashInfo.uid) {
         amount += Number(this.$bigDecimal.multiply(this.cashInfo.balance, this.currencyList[this.currency] || 1))
       }
+      if (this.followAccount.uid) {
+        amount += Number(this.$bigDecimal.multiply(this.followAccount.balance, this.currencyList[this.currency] || 1))
+      }
       return amount
     },
     currencyUtil() {