ShoeStyleView.vue 6.2 KB

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