app-submit-goods.vue 11 KB

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