ShoeStyleView.vue 6.1 KB

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