SaleGoodsDetail.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <template>
  2. <view class="">
  3. <view class="goods-scroll"><u-swiper :list="list" :height="340" indicator-pos="bottomRight" mode="number"></u-swiper></view>
  4. <view class="goods-info info-view">
  5. <view class="goods-name">{{ goods_base_detail.title || '' }}</view>
  6. <view class="goods-desc">{{ goods_base_detail.describe || '' }}</view>
  7. <view class="goods-code clearfix">
  8. <view class="float_left">
  9. <text class="info-label">商品编码</text>
  10. {{ goods_base_detail.code || '' }}
  11. </view>
  12. <view class="float_right" v-if="goods_base_detail.storage">
  13. <text class="info-label">货架编码</text>
  14. {{ goods_base_detail.storage || '未设置' }}
  15. </view>
  16. </view>
  17. </view>
  18. <view class="goods-info-other info-view">
  19. <view class="info-li">
  20. <view class="info-label">商品分类</view>
  21. <view class="info-val">{{ goods_base_detail.categoryTitle || '' }}</view>
  22. </view>
  23. <view class="info-li">
  24. <view class="info-label">商品品牌</view>
  25. <view class="info-val">{{ goods_base_detail.brandTitle || '未设置' }}</view>
  26. </view>
  27. <view class="info-li">
  28. <view class="info-label">保质期/天</view>
  29. <view class="info-val">{{ goods_base_detail.expireTime || '未设置' }}</view>
  30. </view>
  31. </view>
  32. <view class="info-view tag-view">
  33. <text class="info-label">关键词</text>
  34. <u-tag v-for="(item, index) in tag_list" :key="index" class="tag-li" mode="plain" :text="item" />
  35. <text v-if="!tag_list.length" class="input-pl">未设置</text>
  36. </view>
  37. <view class="goods-info-other info-view">
  38. <view class="info-li">
  39. <view class="info-label">商品状态</view>
  40. <view class="info-val">{{ goods_detail.enableStatus === 5 ? '上架' : '下架' }}</view>
  41. </view>
  42. <view class="info-li">
  43. <view class="info-label">负库存销售</view>
  44. <view class="info-val">{{ goods_detail.isDistribution === 5 ? '开启' : '禁用' }}</view>
  45. </view>
  46. <view class="info-li">
  47. <view class="info-label">经营屏蔽</view>
  48. <view class="info-val">{{ goods_detail.isShield === 5 ? '开启' : '禁用' }}</view>
  49. </view>
  50. <view class="info-li">
  51. <view class="info-label">快递运费</view>
  52. <view class="info-val">{{ goods_detail.enableStatus === 1 ? '包邮' : goods_detail.enableStatus === 2 ? '运费模版' : '统一运费' }}</view>
  53. </view>
  54. </view>
  55. <view class="info-view tag-view">
  56. <view class="unit-master">
  57. <text class="info-label">基本单位</text>
  58. <text>{{ master_unit.unitName || '' }}</text>
  59. </view>
  60. <view>
  61. <text class="info-label">辅助单位</text>
  62. <block v-for="(item, index) in other_unit_data" :key="index">
  63. <u-tag v-if="item.isMaster !== 5" class="tag-li" mode="plain" :text="'1' + item.unitName + '=' + Number(item.conversion) + master_unit.unitName" />
  64. </block>
  65. <text v-if="!other_unit_data.length" class="input-pl">未设置</text>
  66. </view>
  67. </view>
  68. <view class="sku-detail">
  69. <view class="info-title">规格明细</view>
  70. <view class="sku-li" v-for="(item, index) in goods_detail.specMultiple" :key="index">
  71. <view class="clearfix">
  72. <view class="float_left sku-img">
  73. <image :src="item.specImage || '../../static/img/goods.png'" mode="aspectFill"></image>
  74. <text class="default-sku" v-if="item.isDefault === 5">默认规格</text>
  75. </view>
  76. <view class="float_left sku-info">
  77. <view class="sku-name">
  78. {{ item.unitName }};
  79. <text v-for="(spec, s) in item.specGroup" :key="s">{{ spec.specValueName }}</text>
  80. </view>
  81. <view class="price">
  82. <text class="sale-price" v-if="item.enabledLadder !== 1">{{ $utils.formattedNumber(item.salePrice) }}</text>
  83. <text class="market-price">{{ $utils.formattedNumber(item.marketPrice) }}</text>
  84. </view>
  85. <view class="num">
  86. <text>库存:{{ $utils.formatNub(item.inventory) }}{{ item.unitName }}</text>
  87. <text>起订:{{ $utils.formatNub(item.setNum) }}{{ item.unitName }}</text>
  88. </view>
  89. <view class="num">
  90. <text>重量:{{ item.weight ? item.weight / 1000 : 0 }}kg</text>
  91. <text>销量:{{ $utils.formatNub(item.salesNum) }}{{ item.unitName }}</text>
  92. </view>
  93. </view>
  94. </view>
  95. <view class="ladder-price" v-if="item.enabledLadder === 1">
  96. <view class="price-li" v-for="(la, laI) in item.ladderPrice" :key="laI">
  97. <view class="num-top">
  98. {{ la.from }}-
  99. <text v-if="laI === item.ladderPrice.length - 1">∞</text>
  100. <text v-else>{{ la.to }}</text>
  101. {{ item.unitName }}
  102. </view>
  103. <view class="price">{{ $utils.formattedNumber(la.price) }}</view>
  104. </view>
  105. </view>
  106. </view>
  107. </view>
  108. <view class="sku-detail">
  109. <view class="info-title">商品详情</view>
  110. <view class="detail-view"><rich-text :nodes="goods_base_detail.description"></rich-text></view>
  111. </view>
  112. </view>
  113. </template>
  114. <script>
  115. export default {
  116. data() {
  117. return {
  118. list: [],
  119. goods_id: '',
  120. goods_base_detail: {},
  121. master_unit: {},
  122. other_unit_data: [],
  123. tag_list: [],
  124. basic_goods_id: '',
  125. goods_detail: {
  126. specMultiple: []
  127. }
  128. };
  129. },
  130. onLoad(options) {
  131. if (options.id) {
  132. this.goods_id = options.id;
  133. this.basic_goods_id = options.basicGoodsId;
  134. this.getGoodsBasicInfoById();
  135. this.getGoodsInfo();
  136. }
  137. },
  138. methods: {
  139. // 商品详情
  140. getGoodsInfo() {
  141. this.$u.api.getGoodsInfo(this.goods_id).then(res => {
  142. this.goods_detail = res.data;
  143. });
  144. },
  145. // 商品基础资料
  146. getGoodsBasicInfoById() {
  147. this.$u.api.getGoodsBasicInfoById(this.basic_goods_id).then(res => {
  148. this.goods_base_detail = res.data;
  149. this.list = res.data.images.map(item => {
  150. return {
  151. image: item
  152. };
  153. });
  154. this.tag_list = res.data.tag ? res.data.tag.split(',') : [];
  155. this.master_unit = res.data.unitData.find(item => item.isMaster === 5);
  156. this.other_unit_data = res.data.unitData.filter(item => item.isMaster === 4);
  157. });
  158. }
  159. }
  160. };
  161. </script>
  162. <style scoped lang="scss">
  163. .goods-scroll {
  164. width: 702rpx;
  165. margin: 0 auto 20rpx;
  166. }
  167. .info-view {
  168. background-color: #ffffff;
  169. width: 702rpx;
  170. margin: 0 auto;
  171. border-radius: 10rpx;
  172. margin-bottom: 20rpx;
  173. padding: 20rpx;
  174. .info-label {
  175. font-size: 24rpx;
  176. color: #999999;
  177. }
  178. }
  179. .goods-info {
  180. font-size: 24rpx;
  181. .goods-name {
  182. font-size: 28rpx;
  183. font-weight: 700;
  184. }
  185. .goods-desc {
  186. padding: 10rpx 0;
  187. color: #999999;
  188. }
  189. .goods-code {
  190. .info-label {
  191. margin-right: 10rpx;
  192. }
  193. }
  194. }
  195. .goods-info-other {
  196. display: flex;
  197. .info-li {
  198. flex: 4;
  199. font-size: 26rpx;
  200. text-align: center;
  201. border-right: 1px solid #f5f5f5;
  202. .info-label {
  203. padding-bottom: 20rpx;
  204. }
  205. &:last-child {
  206. border-right: 0 none;
  207. }
  208. }
  209. }
  210. .tag-view {
  211. .info-label {
  212. margin-right: 20rpx;
  213. }
  214. .tag-li {
  215. margin-right: 10rpx;
  216. }
  217. }
  218. .unit-master {
  219. padding-bottom: 20rpx;
  220. }
  221. .sku-detail {
  222. .info-title {
  223. text-align: center;
  224. line-height: 90rpx;
  225. font-size: 24rpx;
  226. color: #666666;
  227. }
  228. .sku-li {
  229. margin: 0 auto 20rpx;
  230. width: 702rpx;
  231. background-color: #ffffff;
  232. padding: 24rpx;
  233. border-radius: 20rpx;
  234. .sku-img {
  235. position: relative;
  236. width: 120rpx;
  237. height: 120rpx;
  238. border-radius: 10rpx;
  239. overflow: hidden;
  240. image {
  241. width: 100%;
  242. height: 100%;
  243. }
  244. .default-sku {
  245. position: absolute;
  246. width: 100%;
  247. font-size: 20rpx;
  248. line-height: 36rpx;
  249. height: 36rpx;
  250. text-align: center;
  251. color: #ffffff;
  252. left: 0;
  253. bottom: 0;
  254. background-color: $uni-color-success;
  255. }
  256. }
  257. .sku-info {
  258. margin-left: 20rpx;
  259. font-size: 24rpx;
  260. color: #6c6c6c;
  261. .sku-name {
  262. color: #000000;
  263. font-size: 28rpx;
  264. font-weight: bold;
  265. }
  266. .price {
  267. padding-top: 6rpx;
  268. .sale-price {
  269. font-size: 28rpx;
  270. color: $uni-color-error;
  271. font-weight: bold;
  272. margin-right: 20rpx;
  273. }
  274. .market-price {
  275. font-size: 22rpx;
  276. color: #999999;
  277. text-decoration: line-through;
  278. }
  279. }
  280. .num {
  281. line-height: 36rpx;
  282. padding-top: 10rpx;
  283. text {
  284. margin-right: 20rpx;
  285. }
  286. }
  287. }
  288. .ladder-price {
  289. margin-top: 20rpx;
  290. border-top: 1px solid #eeeeee;
  291. font-size: 24rpx;
  292. padding: 20rpx 0;
  293. display: flex;
  294. .price-li {
  295. flex: 3;
  296. text-align: center;
  297. border-right: 1px solid #eeeeee;
  298. .price {
  299. font-size: 28rpx;
  300. font-weight: bold;
  301. padding-top: 8rpx;
  302. color: $uni-color-error;
  303. }
  304. &:last-child {
  305. border-right: 0 none;
  306. }
  307. }
  308. }
  309. }
  310. }
  311. .detail-view {
  312. background-color: #ffffff;
  313. padding: 20rpx;
  314. img {
  315. width: 100%;
  316. }
  317. }
  318. </style>