ShoeStyleView.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <template>
  2. <view class="padding">
  3. <uni-section title="款式信息" type="line">
  4. <!-- <uni-list>
  5. <uni-list-item link @click="ViewImage(data.pice)">
  6. <template v-slot:header>
  7. <view class="slot-box">
  8. <image class="slot-image img" :src="data.pice" mode="widthFix"></image>
  9. <image class="slot-image img" :src="data.foto" mode="widthFix"></image>
  10. </view>
  11. </template>
  12. <template v-slot:body>
  13. <text class="slot-box slot-text">
  14. <text style="display: block;">{{data.styleNum}}</text>
  15. <text style="display: block;font-size: 12px;color: #909399;">
  16. 版本:{{data.version}}</text>
  17. <text style="display: block;font-size: 12px;color: #909399;">
  18. 颜色:{{data.color? data.color: ''}} {{data.enColor? data.enColor: ''}}</text>
  19. </text>
  20. </template>
  21. </uni-list-item>
  22. </uni-list> -->
  23. <uni-grid :column="2" :highlight="true" :showBorder="false" :square="false" style="height: auto;">
  24. <uni-grid-item v-for="(item, index) in pics" :index="index" :key="index">
  25. <view class="grid-item-box" style="background-color: #fff;">
  26. <image class="slot-image img" :src="item" mode="widthFix" @click="ViewImage(index)"></image>
  27. </view>
  28. </uni-grid-item>
  29. </uni-grid>
  30. <uni-list>
  31. <uni-list-item title="款号" :rightText="data.styleNum" />
  32. <uni-list-item title="颜色" :rightText="data.version + '-' +data.color" />
  33. <uni-list-item title="尺码" :rightText="data.size" />
  34. <uni-list-item title="码段" :rightText="data.outsoleSegment" />
  35. <uni-list-item class="fob" title="FOB价" :rightText="data.fob" />
  36. <uni-list-item title="备注" :rightText="data.remark" />
  37. </uni-list>
  38. </uni-section>
  39. <view style="height: 30rpx;"></view>
  40. <uni-list>
  41. <uni-list-item title="面料" :rightText="data.upper" />
  42. <uni-list-item title="内里" :rightText="data.insole" />
  43. <uni-list-item title="面衬" :rightText="data.lining" />
  44. <uni-list-item title="楦头" :rightText="data.lastNumber" />
  45. </uni-list>
  46. <view style="height: 30rpx;"></view>
  47. <uni-list>
  48. <uni-list-item title="大底" :rightText="data.outsole" />
  49. <uni-list-item title="大底编号" :rightText="data.outsoleNumber" />
  50. <uni-list-item title="大底厂家" :rightText="data.outsoleFactory" />
  51. <uni-list-item title="日期" :rightText="formatDate(data.createTime)" />
  52. </uni-list>
  53. <view style="height: 30rpx;"></view>
  54. <uni-list v-if="checkRole(['SalesManager'])">
  55. <uni-list-item class="outPrice" title="大底价格参考" :rightText="data.outsolePrice" />
  56. <uni-list-item class="outPrice" title="材料价格参考" :rightText="data.referPrice" />
  57. </uni-list>
  58. <!-- <uni-section title="鞋底图片" type="line">
  59. <uni-grid :column="1" :highlight="true" :showBorder="false" :square="false" style="height: auto;">
  60. <uni-grid-item style="padding: 8px;">
  61. <image class="slot-image img" :src="data.foto" mode="widthFix" @click="ViewImage(1)"></image>
  62. </uni-grid-item>
  63. </uni-grid>
  64. </uni-section> -->
  65. <!-- <view style="margin-top: 10px;text-align: center;">
  66. <button class="bottom" size="mini" type="primary" @click="onBackward">返回样品页</button>
  67. </view> -->
  68. </view>
  69. </template>
  70. <script>
  71. import {
  72. getShoeStyle,
  73. listShoeStyle
  74. } from '@/api/trade/shoe-style.js'
  75. import {
  76. formatDate,
  77. formatDateMinute
  78. } from '@/utils/date.js'
  79. import {
  80. getToken,
  81. getTokens
  82. } from '@/utils/auth'
  83. import {
  84. showConfirm,
  85. toast
  86. } from '@/utils/common'
  87. import {
  88. checkPermi,
  89. checkRole
  90. } from '@/utils/permission.js'
  91. export default {
  92. data() {
  93. return {
  94. formatDate,
  95. getDataApi: getShoeStyle,
  96. checkPermi,
  97. checkRole,
  98. pics: [],
  99. data: {}
  100. }
  101. },
  102. // onLoad: function(option) {
  103. // },
  104. onShow(options) {
  105. let pages = getCurrentPages();
  106. // 数组中索引最大的页面--当前页面
  107. let currentPage = pages[pages.length - 1];
  108. // 打印出当前页面中的 options
  109. var options = currentPage.options
  110. console.log(currentPage, 'currentPage.options')
  111. if (options.styleNum && options.version) {
  112. uni.setStorageSync('options', options)
  113. } else {
  114. options = uni.getStorageSync('options')
  115. }
  116. if (!getToken()) {
  117. uni.navigateTo({
  118. url: '/pages/login'
  119. })
  120. // this.$tab.reLaunch('/pages/login')
  121. }
  122. if (options.data) {
  123. const id = options.data
  124. this.getData(id)
  125. } else if (options.styleNum) {
  126. this.getData2(options)
  127. }
  128. },
  129. methods: {
  130. onBackward() {
  131. wx.switchTab({
  132. url: './index'
  133. })
  134. },
  135. ViewImage(idx) {
  136. const pics = [this.data.foto, this.data.pice]
  137. uni.previewImage({
  138. urls: pics,
  139. current: idx
  140. })
  141. },
  142. getData(id) {
  143. uni.showLoading({
  144. title: '加载中'
  145. })
  146. this.getDataApi(id).then(res => {
  147. uni.hideLoading()
  148. console.log(res)
  149. if (res.code === 200) {
  150. this.pics = [res.data.foto, res.data.pice]
  151. this.data = res.data
  152. }
  153. }).catch(err => {
  154. uni.hideLoading()
  155. })
  156. },
  157. getData2(item) {
  158. uni.showLoading({
  159. title: '加载中'
  160. })
  161. listShoeStyle(item).then(res => {
  162. uni.setStorageSync('options', '')
  163. if (res.rows && res.rows.length > 0) {
  164. this.pics = [];
  165. if (res.rows[0].foto) {
  166. this.pics.push(res.rows[0].foto)
  167. };
  168. if (res.rows[0].pice) {
  169. this.pics.push(res.rows[0].pice)
  170. };
  171. this.data = res.rows[0]
  172. } else {
  173. uni.showToast({
  174. icon: 'none',
  175. title: '没有当前信息'
  176. })
  177. }
  178. uni.hideLoading()
  179. }).catch(err => {
  180. uni.hideLoading()
  181. })
  182. }
  183. }
  184. }
  185. </script>
  186. <style lang="scss">
  187. .img {
  188. width: 100%;
  189. height: 100%;
  190. margin-right: 10px;
  191. }
  192. .f-text {
  193. line-height: 38px;
  194. }
  195. .ivu-form-item {
  196. margin-bottom: 1px;
  197. }
  198. .fob {
  199. background: #faf78ce8 !important;
  200. }
  201. .outPrice{
  202. background: #fdddc6e8 !important;
  203. }
  204. </style>