test.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <view class="page" :style="{height: `${height}px`}">
  3. <view class="u-content" >
  4. <view class='u-header main-between'>
  5. <view>开箱展示</view>
  6. <view @click="close"><image class="bd-icon" src="../../../static/image/icon/clear.png"></image></view>
  7. </view>
  8. <view class="u-body dir-top-nowrap cross-center">
  9. <!-- <image class="u-img" :src="img"></image>
  10. <text class="u-text">申请获取您绑定的手机号</text> -->
  11. <swiper
  12. class="swiper"
  13. v-bind:indicator-dots="picList.length>1"
  14. circular
  15. @change='bannerChange'
  16. indicator-color="rgba(255,255,255,.3)"
  17. indicator-active-color="#30353c"
  18. >
  19. <swiper-item v-for="(item, index) in picList" v-bind:key="index">
  20. <view class="swiper-img"
  21. @click="clickImage(index)" v-bind:style="{backgroundImage: 'url(' + item.pic_url + ')'}">
  22. </view>
  23. </swiper-item>
  24. </swiper>
  25. <view class="bd-subtitle">左右滑动查看开箱展示</view>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import {
  32. mapGetters,
  33. mapState
  34. } from "vuex";
  35. import uCharts from "../../components/u-charts/u-charts.min.js"
  36. export default {
  37. components: {
  38. },
  39. data() {
  40. return {
  41. picList:[],
  42. height:0
  43. };
  44. },
  45. onLoad(options) {
  46. //this.$refs.priceLine.init();
  47. let that=this;
  48. wx.getSystemInfo({
  49. success: function(res) {
  50. that.height = res.windowHeight;
  51. }
  52. })
  53. uni.setNavigationBarTitle({
  54. title: "价格走势"
  55. })
  56. this.title = options.title
  57. //this.getData(options.id||'15326',options.signid||'2:3')
  58. },
  59. methods: {
  60. touchStart(e) {
  61. this.canvases.showToolTip(e, {
  62. format: function(item, category) {
  63. return category + ' ' + item.name + ':' + item.data
  64. }
  65. });
  66. this.canvases.scrollStart(e);
  67. },
  68. touchMove(e) {
  69. this.canvases[this.canvasId].scroll(e);
  70. },
  71. touchEnd(e) {
  72. this.canvases.scrollEnd(e);
  73. },
  74. error(e) {
  75. uni.showToast({
  76. title: e.errMsg,
  77. icon: 'none'
  78. })
  79. },
  80. getData(goods_id, sign_id) {
  81. let that = this;
  82. this.$request({
  83. url: this.$api.goods.PriceMove,
  84. data: {
  85. goods_id: goods_id,
  86. sign_id: sign_id
  87. }
  88. }).then(response => {
  89. this.$hideLoading();
  90. if (response.code === 0) {
  91. that.max = response.data.max;
  92. let categories = [];
  93. let seriesData = [];
  94. response.data.priceMove.forEach((value) => {
  95. let tempTime = value.created_at.split(" ")[0];
  96. let time = tempTime.split("-");
  97. categories.push(time[1] + '/' + time[2])
  98. seriesData.push(value.price)
  99. })
  100. that.categories = categories;
  101. that.series = [{
  102. name: "",
  103. data: seriesData,
  104. color: '#409eff'
  105. }]
  106. that.canvases = new uCharts({
  107. $this: that,
  108. canvasId: that.canvasId,
  109. type: 'line',
  110. fontSize: 7,
  111. legend: true,
  112. dataLabel: true,
  113. dataPointShape: true,
  114. background: '#FFFFFF',
  115. pixelRatio: that.pixelRatio,
  116. categories: categories,
  117. series: that.series,
  118. animation: true,
  119. enableScroll: true,
  120. xAxis: {
  121. type: 'line',
  122. gridColor: '#CCCCCC',
  123. gridType: 'line',
  124. dashLength: 8,
  125. itemCount: that.categories.length,
  126. scrollShow: true
  127. },
  128. yAxis: {
  129. gridType: 'line',
  130. gridColor: '#CCCCCC',
  131. dashLength: 8,
  132. splitNumber: 6,
  133. min: 10,
  134. max: that.max,
  135. format: (val) => {
  136. return '¥' + val.toFixed(0)
  137. }
  138. },
  139. width: that.cWidth,
  140. height: that.cHeight,
  141. extra: {
  142. line: {
  143. type: 'straight'
  144. }
  145. }
  146. });
  147. } else {
  148. uni.showToast({
  149. title: response.msg,
  150. icon: 'none'
  151. });
  152. }
  153. }).catch(() => {
  154. this.$hideLoading();
  155. });
  156. }
  157. }
  158. }
  159. </script>
  160. <style lang="scss">
  161. .u-content {
  162. background-color: #ffffff;
  163. }
  164. .u-header {
  165. padding: 5upx;
  166. border-bottom: 1upx solid #eeeeee;
  167. color: #353535;
  168. font-size: 28upx;
  169. }
  170. .u-img {
  171. width: 88upx;
  172. height: 88upx;
  173. text-align: center;
  174. margin: 32upx 0 40upx;
  175. }
  176. .u-body {
  177. padding: 0 24upx;
  178. }
  179. .u-text {
  180. margin-bottom: 40upx;
  181. font-size: 26upx;
  182. color: #666666;
  183. }
  184. .bd-icon {
  185. width: 40upx;
  186. height: 40upx;
  187. }
  188. .bd-subtitle{
  189. padding: 5upx;
  190. font-size: 24upx;
  191. line-height: 44upx;
  192. color: #999999;
  193. }
  194. </style>