铝交易,微信公众号
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.

375 lines
7.5 KiB

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