app-submit-goods.vue 10 KB

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