app-submit-goods.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <view class="app-submit-goods">
  3. <view v-if="plugin == 'composition'" class="composition">
  4. <view class="composition-item" v-for="(compositionItem, compositionIndex) in list.composition_list" :key="compositionIndex">
  5. <view v-show="compositionItem.open || goodsIndex == 0" v-for="(goodsItem, goodsIndex) in compositionItem.goods_list" :key="goodsIndex" class="dir-left-nowrap goods-item">
  6. <view class="box-grow-0">
  7. <image class="goods-image"
  8. :src="goodsItem.goods_attr.pic_url ? goodsItem.goods_attr.pic_url : goodsItem.cover_pic"></image>
  9. </view>
  10. <view class="box-grow-1">
  11. <view class="goods-name">{{goodsItem.name}}</view>
  12. <view class="dir-left-wrap attr-list">
  13. <view v-for="(attrItem,attrIndex) in goodsItem.attr_list"
  14. :key="attrIndex"
  15. class="attr-item">
  16. {{attrItem.attr_group_name}}:{{attrItem.attr_name}}
  17. </view>
  18. </view>
  19. <view class="dir-left-nowrap goods-other">
  20. <view class="box-grow-1 goods-num">×{{goodsItem.num}}</view>
  21. <view v-if="compositionItem.type == 2" class="box-grow-0 goods-price-info" :class="[`${theme}-color`]">
  22. <view>
  23. <text v-for="(customCurrency,customCurrencyIndex) in goodsItem.custom_currency"
  24. :key="customCurrencyIndex">
  25. {{customCurrency}}+
  26. </text>
  27. <text class="goods-price-unit">¥</text>
  28. <text>{{goodsItem.total_price}}</text>
  29. </view>
  30. <view v-for="(discount,discountIndex) in goodsItem.discounts"
  31. :key="discountIndex">
  32. {{discount.name}}: {{discount.value}}
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="composition-open main-center">
  39. <view @click="toggle(compositionIndex)" class="composition-btn">
  40. <text>{{compositionItem.open ? '点击收起套餐详情' : '点击展开套餐详情'}}</text>
  41. <image v-if="!compositionItem.open" src="/static/image/icon/icon-down.png"></image>
  42. <image v-else src="/static/image/icon/icon-up.png"></image>
  43. </view>
  44. </view>
  45. <view class="composition-info">
  46. <view>{{compositionItem.type == 1 ? '固定套餐' : '搭配套餐'}} ¥{{compositionItem.total_price}}</view>
  47. <view class="composition-discount">已省 ¥{{compositionItem.composition_price}}</view>
  48. </view>
  49. </view>
  50. </view>
  51. <view v-else class="app-submit-goods-item">
  52. <view v-for="(goodsItem, goodsIndex) in list.goods_list" :key="goodsIndex" class="dir-left-nowrap goods-item">
  53. <view class="box-grow-0">
  54. <image class="goods-image"
  55. :src="goodsItem.goods_attr.pic_url ? goodsItem.goods_attr.pic_url : goodsItem.cover_pic"></image>
  56. </view>
  57. <view class="box-grow-1">
  58. <view class="goods-name">{{goodsItem.name}}</view>
  59. <view class="dir-left-wrap attr-list">
  60. <view v-for="(attrItem,attrIndex) in goodsItem.attr_list"
  61. :key="attrIndex"
  62. class="attr-item">
  63. {{attrItem.attr_group_name}}:{{attrItem.attr_name}}
  64. </view>
  65. </view>
  66. <view class="dir-left-nowrap">
  67. <view class="box-grow-1 goods-num">×{{goodsItem.num}}</view>
  68. <view class="box-grow-0 goods-price-info" :class="[`${theme}-color`]">
  69. <view>
  70. <text v-for="(customCurrency,customCurrencyIndex) in goodsItem.custom_currency"
  71. :key="customCurrencyIndex">
  72. {{customCurrency}}+
  73. </text>
  74. <text class="goods-price-unit">¥</text>
  75. <text>{{goodsItem.total_original_price}}</text>
  76. </view>
  77. <view v-for="(discount,discountIndex) in goodsItem.discounts"
  78. :key="discountIndex">
  79. {{discount.name}}: {{discount.value}}
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. </template>
  88. <script>
  89. import {mapState} from 'vuex';
  90. export default {
  91. name: "app-submit-goods",
  92. props: {
  93. list: {
  94. type: Object
  95. },
  96. plugin: {
  97. type: String
  98. },
  99. index: {
  100. type: Number
  101. },
  102. },
  103. data() {
  104. return {
  105. }
  106. },
  107. created() {
  108. let that = this;
  109. },
  110. mounted() {
  111. let that = this;
  112. if(that.plugin == 'composition') {
  113. for(let i in that.list.composition_list) {
  114. that.list.composition_list[i].open = false;
  115. }
  116. that.$forceUpdate();
  117. that.$emit("updateList",that.list,that.index);
  118. }
  119. },
  120. computed: {
  121. ...mapState({
  122. appImg: state => state.mallConfig.__wxapp_img,
  123. }),
  124. theme() {
  125. return this.userTheme ? this.userTheme : this.$store.state.mallConfig.theme;
  126. },
  127. },
  128. methods: {
  129. toggle(index) {
  130. this.list.composition_list[index].open = !this.list.composition_list[index].open;
  131. this.$forceUpdate();
  132. this.$emit("updateList",this.list,this.index);
  133. }
  134. }
  135. }
  136. </script>
  137. <style scoped lang="scss">
  138. $submitBarHeight: #{110rpx};
  139. $borderColor: $uni-weak-color-one;
  140. $xWidth: #{24rpx};
  141. $yWidth: #{24rpx};
  142. .app-submit-goods {
  143. .app-submit-goods-item {
  144. border-bottom: #{1rpx} solid $borderColor;
  145. border-top: #{1rpx} solid $borderColor;
  146. }
  147. .composition {
  148. margin-bottom: #{24rpx};
  149. .composition-item {
  150. margin-top: #{24rpx};
  151. .composition-open {
  152. text-align: center;
  153. background-color: #fff;
  154. height: #{84rpx};
  155. .composition-btn {
  156. display: inline-block;
  157. border: #{2rpx} solid #bbbbbb;
  158. font-size: #{24rpx};
  159. color: #999999;
  160. padding: 0 #{24rpx};
  161. margin: #{12rpx} 0 #{16rpx};
  162. height: #{56rpx};
  163. line-height: #{54rpx};
  164. border-radius: #{28rpx};
  165. image {
  166. width: #{22rpx};
  167. height: #{12rpx};
  168. margin-left: #{16rpx};
  169. }
  170. }
  171. }
  172. .composition-info {
  173. background-color: #fff;
  174. font-size: #{28rpx};
  175. border-top: #{2rpx} solid #e2e2e2;
  176. color: #ff4544;
  177. text-align: right;
  178. padding: #{24rpx};
  179. .composition-discount {
  180. font-size: #{24rpx};
  181. color: #f39800;
  182. }
  183. }
  184. }
  185. }
  186. .goods-item {
  187. background: #fff;
  188. padding: #{24rpx};
  189. .goods-image {
  190. width: #{200rpx};
  191. height: #{200rpx};
  192. display: block;
  193. margin-right: #{24rpx};
  194. }
  195. .goods-name {
  196. height: #{84rpx};
  197. line-height: #{42rpx};
  198. display: -webkit-box;
  199. -webkit-box-orient: vertical;
  200. -webkit-line-clamp: 2;
  201. word-break: break-all;
  202. overflow: hidden;
  203. text-overflow: ellipsis;
  204. margin-bottom: #{22rpx};
  205. }
  206. .attr-list, .goods-num {
  207. font-size: $uni-font-size-weak-one;
  208. color: $uni-general-color-one;
  209. }
  210. .goods-other {
  211. margin-top: #{16rpx};
  212. }
  213. .attr-item {
  214. margin-right: #{24rpx};
  215. }
  216. .attr-item:last-child {
  217. margin-right: 0;
  218. }
  219. .goods-price-info {
  220. text-align: right;
  221. font-size: $uni-font-size-general-one;
  222. }
  223. }
  224. }
  225. </style>