铝交易,微信公众号
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

370 lines
7.4 KiB

5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
4 months ago
6 months ago
4 months ago
6 months ago
5 months ago
4 months ago
6 months ago
5 months ago
4 months ago
4 months ago
4 months ago
5 months ago
6 months ago
5 months ago
4 months ago
5 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
4 months ago
4 months ago
5 months ago
5 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
  1. <template>
  2. <view class="trading-platform">
  3. <topbar showRight="0"></topbar>
  4. <view class="frame">
  5. <!--顶部栏-->
  6. <!--折线图-->
  7. <!-- <div ref="chartContainer" class="chart" style="width: 100%; height: 300px;">
  8. </div> -->
  9. <visualization/>
  10. <!-- 供应商 -->
  11. <!-- <view v-if="userShop" class="supplier">
  12. <view class="purchaser-title" style="">
  13. <span class="active"> {{ $t('other.orderList') }}</span>
  14. <span v-for="(item, index) in type" :class="actionIndex == index ? 'active' : 'noactive'"
  15. @click="actionIndexChange(index)">{{ item.name }}</span>
  16. </view>
  17. <view class="supplierList">
  18. <orderList :list="list" />
  19. </view>
  20. </view> -->
  21. <!-- 采购商 -->
  22. <view class="purchaser">
  23. <!--切换现货/期货-->
  24. <view class="purchaser-title" style="">
  25. <span v-for="(item, index) in type" :class="actionIndex == index ? 'active' : 'noactive'"
  26. @click="actionIndexChange(index)">{{ item.name }}</span>
  27. </view>
  28. <view class="productList">
  29. <productList :list="list" @previewVideo="previewVideo"/>
  30. </view>
  31. </view>
  32. </view>
  33. <uv-popup ref="previewVideoPopup"
  34. :customStyle="{backgroundColor : 'transparent'}">
  35. <view class="content">
  36. <video :src="vedioUrl"
  37. style="width: 100vw;height: 100vh;"
  38. ></video>
  39. <view class="closexxxxx"
  40. @click="$refs.previewVideoPopup.close()">
  41. <uv-icon
  42. name="close"
  43. color="#fff"
  44. size="50rpx"
  45. ></uv-icon>
  46. </view>
  47. </view>
  48. </uv-popup>
  49. <tabber select="1" />
  50. </view>
  51. </template>
  52. <script>
  53. import tabber from '@/components/base/tabbar.vue'
  54. import topbar from "@/components/base/topbar.vue";
  55. import {
  56. mapGetters
  57. } from 'vuex'
  58. import ProductList from "@/components/user/productList.vue";
  59. import OrderList from "@/pages_order/components/order/orderList.vue";
  60. import mixinList from '@/mixins/list.js'
  61. import * as echarts from 'echarts';
  62. import visualization from '@/components/user/visualization.vue'
  63. export default {
  64. mixins: [mixinList],
  65. components: {
  66. OrderList,
  67. ProductList,
  68. topbar,
  69. tabber,
  70. visualization,
  71. },
  72. computed: {
  73. ...mapGetters(['userShop']),
  74. },
  75. data() {
  76. return {
  77. actionIndex: 0,
  78. mixinsListApi: 'getMyProductlist',
  79. type: [
  80. {
  81. name: '国内现货'
  82. },
  83. {
  84. name: '国外现货'
  85. },
  86. ],
  87. vedioUrl : '',
  88. chartData: [
  89. // {date: "08/16", value: 10},
  90. // {date: "08/17", value: 15},
  91. // {date: "08/18", value: 45},
  92. // {date: "08/19", value: 20},
  93. // {date: "08/20", value: 18},
  94. // {date: "08/21", value: 10},
  95. // {date: "08/22", value: 15},
  96. // {date: "08/23", value: 25},
  97. // {date: "08/24", value: 35},
  98. // {date: "08/25", value: 30},
  99. // {date: "08/26", value: 25},
  100. // {date: "08/27", value: 25},
  101. ],
  102. unit: '元/吨',
  103. }
  104. },
  105. onLoad() {
  106. if (this.userShop) {
  107. // 交易平台挂单列表
  108. this.mixinsListApi = 'productList' //'productlist'
  109. } else {
  110. // 现货/期货列表
  111. this.mixinsListApi = 'productList'
  112. }
  113. this.queryParams.productType = this.actionIndex
  114. },
  115. mounted() {
  116. // this.getAlPrice()
  117. // setTimeout(() => {
  118. // this.initChart();
  119. // })
  120. },
  121. onShow() {
  122. // this.getAlPrice()
  123. },
  124. methods: {
  125. getAlPrice() {
  126. this.$api('getAlPrice', res => {
  127. this.unit = res.result.unit
  128. this.chartData = res.result.data
  129. this.initChart(res.result.data)
  130. })
  131. },
  132. initChart(data) {
  133. var that = this;
  134. const chartContainer = this.$refs.chartContainer;
  135. if (!chartContainer) {
  136. console.error("Chart container not found");
  137. return;
  138. }
  139. const myChart = echarts.init(chartContainer);
  140. // 提取日期和数值
  141. const dates = data.map(item => item.date).splice(0, 48);
  142. const values = data.map(item => item.value).splice(0, 48);
  143. // 计算铝均价
  144. let sum = 0
  145. values.forEach(n => {
  146. sum += parseFloat(n)
  147. })
  148. console.log(sum);
  149. // 配置 ECharts
  150. const option = {
  151. backgroundColor: '#1B263B',
  152. title: {
  153. text: `${'铝均价' + (sum / values.length).toFixed(4)}`,
  154. right: '10%',
  155. top: '10%',
  156. textStyle: {
  157. color: '#fff',
  158. fontSize: 14
  159. }
  160. },
  161. tooltip: {
  162. trigger: 'axis',
  163. formatter: '{c0}',
  164. backgroundColor: '#3A506B',
  165. textStyle: {
  166. color: '#fff'
  167. }
  168. },
  169. grid: {
  170. left: '10%',
  171. right: '10%',
  172. bottom: '20%'
  173. },
  174. xAxis: {
  175. type: 'category',
  176. data: dates,
  177. axisLine: {
  178. lineStyle: {
  179. color: '#fff'
  180. }
  181. },
  182. axisLabel: {
  183. color: '#fff'
  184. }
  185. },
  186. yAxis: {
  187. type: 'value',
  188. axisLine: {
  189. lineStyle: {
  190. color: '#fff'
  191. }
  192. },
  193. axisLabel: {
  194. color: '#fff',
  195. formatter: function(value) {
  196. return value;
  197. }
  198. }
  199. },
  200. series: [{
  201. name: '长江',
  202. type: 'line',
  203. data: values,
  204. smooth: true,
  205. symbol: 'circle',
  206. symbolSize: 8,
  207. itemStyle: {
  208. color: '#4ECDC4'
  209. },
  210. lineStyle: {
  211. color: '#4ECDC4',
  212. width: 2
  213. },
  214. areaStyle: {
  215. color: 'rgba(78, 205, 196, 0.2)'
  216. },
  217. }]
  218. };
  219. myChart.setOption(option);
  220. },
  221. // 切换tab
  222. actionIndexChange(index) {
  223. // index为0时切换到现货交易,index为1时切换到期货交易
  224. this.actionIndex = index;
  225. this.queryParams.productType = this.actionIndex
  226. this.getData()
  227. },
  228. previewVideo(data){
  229. if(data.urls.length > 1){
  230. uni.showActionSheet({
  231. itemList: data.urls.map((n, i) => i),
  232. success : e => {
  233. this.vedioUrl = data.urls[e.tapIndex]
  234. this.$refs.previewVideoPopup.open();
  235. }
  236. })
  237. }else{
  238. this.vedioUrl = data.urls[data.index]
  239. this.$refs.previewVideoPopup.open();
  240. }
  241. },
  242. }
  243. }
  244. </script>
  245. <style scoped lang="scss">
  246. .trading-platform {
  247. background-image: url('../../static/image/index/1.png');
  248. padding-bottom: 100rpx;
  249. .frame {
  250. display: flex;
  251. flex-direction: column;
  252. justify-content: center;
  253. // height: calc(100vh - 120rpx - 120rpx);
  254. .chart {
  255. // height: 300px !important;
  256. background-color: #1B263B;
  257. /* 背景颜色 */
  258. }
  259. .supplier {
  260. // height: 70%;
  261. padding: 20rpx 20rpx;
  262. background-image: url('../../static/image/index/1.png');
  263. color: #FFF;
  264. font-size: 32rpx;
  265. .supplierList {
  266. margin-top: 20rpx;
  267. // height: 92%;
  268. overflow: auto;
  269. }
  270. .purchaser-title {
  271. // height: 8%;
  272. .active {
  273. text-decoration: underline;
  274. width: 80rpx;
  275. margin: 20rpx 20rpx 20rpx 20rpx;
  276. padding: 10rpx 20rpx;
  277. }
  278. .noactive {
  279. width: 80rpx;
  280. margin: 20rpx 20rpx 20rpx 20rpx;
  281. padding: 10rpx 20rpx;
  282. }
  283. }
  284. }
  285. .purchaser {
  286. // height: 60%;
  287. padding: 20rpx 0;
  288. color: #FFF;
  289. font-size: 32rpx;
  290. .purchaser-title {
  291. .active {
  292. text-decoration: underline;
  293. width: 80rpx;
  294. margin: 20rpx 20rpx 20rpx 20rpx;
  295. padding: 10rpx 20rpx;
  296. }
  297. .noactive {
  298. width: 80rpx;
  299. margin: 20rpx 20rpx 20rpx 20rpx;
  300. padding: 10rpx 20rpx;
  301. }
  302. }
  303. .productList {
  304. margin-top: 20rpx;
  305. // height: 60vh;
  306. // overflow: auto;
  307. }
  308. }
  309. }
  310. .closexxxxx{
  311. background-color: #00000055;
  312. padding: 30rpx;
  313. position: fixed;
  314. top: 30rpx;
  315. right: 30rpx;
  316. border-radius: 50%;
  317. z-index: 99999999;
  318. }
  319. }
  320. </style>