app-submit-goods.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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.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 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">
  100. <view class="screen_left" style="font-size: 24rpx;color: #999999;">×1
  101. <text class="goods-price-unit" style="padding-left:10px;">{{goodsItem.service_list.name}}{{goodsItem.service_list.price}}元</text>
  102. </view>
  103. <view class="screen_right">
  104. <text class="goods-price-unit">¥</text>
  105. {{goodsItem.service_list.price}}
  106. </view>
  107. </view>
  108. </view>
  109. </view>
  110. <view v-for="(discount,discountIndex) in goodsItem.discounts"
  111. :key="discountIndex"
  112. :class="[themeTextClass]"
  113. style="text-align: right; padding-top: 12rpx; font-size: 24rpx;">
  114. <view style="display: inline-block; margin-right: 6rpx;">{{discount.name}}</view>
  115. <template v-if="discount.value<0">-¥{{priceFormat(0-discount.value)}}
  116. </template>
  117. <template v-else-if="discount.value>0">+¥{{priceFormat(discount.value)}}
  118. </template>
  119. <template v-else>¥0.00</template>
  120. </view>
  121. </view>
  122. <view class="composition-info" :class="[themeTextClass]">
  123. <view style="margin-bottom: 8rpx;">{{compositionItem.type == 1 ? '固定套餐' : '搭配套餐'}}
  124. ¥{{compositionItem.total_price}}
  125. </view>
  126. <view class="composition-discount">已省 ¥{{compositionItem.composition_price}}</view>
  127. </view>
  128. </view>
  129. </view>
  130. </view>
  131. </template>
  132. <script>
  133. import {mapState} from 'vuex';
  134. export default {
  135. name: "app-submit-goods",
  136. props: {
  137. list: {
  138. type: Object
  139. },
  140. plugin: {
  141. type: String
  142. },
  143. index: {
  144. type: Number
  145. },
  146. theme: String,
  147. },
  148. data() {
  149. return {}
  150. },
  151. mounted(){
  152. console.log(141)
  153. console.log(this.list.goods_list[0].attr_list)
  154. },
  155. computed: {
  156. ...mapState({
  157. appImg: state => state.mallConfig.__wxapp_img,
  158. }),
  159. themeTextClass() {
  160. if (this.theme && this.theme.indexOf('gift') > 0) {
  161. return `${this.theme} ${this.theme}-color`;
  162. } else {
  163. return `${this.theme} ${this.theme}-m-text`;
  164. }
  165. },
  166. },
  167. methods: {
  168. priceFormat(val) {
  169. if (isNaN(val)) {
  170. return val;
  171. }
  172. return parseFloat(val).toFixed(2);
  173. },
  174. }
  175. }
  176. </script>
  177. <style scoped lang="scss">
  178. .app-submit-goods {
  179. .composition {
  180. .composition-item {
  181. margin-top: #{24rpx};
  182. .composition-open {
  183. text-align: center;
  184. background-color: #fff;
  185. height: #{84rpx};
  186. .composition-btn {
  187. display: inline-block;
  188. border: #{2rpx} solid #bbbbbb;
  189. font-size: #{24rpx};
  190. color: #999999;
  191. padding: 0 #{24rpx};
  192. margin: #{12rpx} 0 #{16rpx};
  193. height: #{56rpx};
  194. line-height: #{54rpx};
  195. border-radius: #{28rpx};
  196. image {
  197. width: #{22rpx};
  198. height: #{12rpx};
  199. margin-left: #{16rpx};
  200. }
  201. }
  202. }
  203. .composition-info {
  204. background-color: #fff;
  205. font-size: #{28rpx};
  206. text-align: right;
  207. padding: #{24rpx};
  208. .composition-discount {
  209. font-size: #{24rpx};
  210. }
  211. }
  212. }
  213. }
  214. .goods-item {
  215. background: #fff;
  216. padding: #{28rpx} #{32rpx};
  217. border-bottom: #{1rpx} solid #e2e2e2;
  218. font-size: #{28rpx};
  219. .address-disabled {
  220. background: #ffecec;
  221. color: #ff4544;
  222. position: absolute;
  223. bottom: 0;
  224. left: 0;
  225. right: #{22rpx};
  226. padding: #{12rpx} 0;
  227. text-align: center;
  228. font-size: #{20rpx};
  229. }
  230. .goods-image {
  231. width: #{156rpx};
  232. height: #{156rpx};
  233. display: block;
  234. margin-right: #{24rpx};
  235. font-size: #{24rpx};
  236. }
  237. .goods-name {
  238. white-space: nowrap;
  239. overflow: hidden;
  240. text-overflow: ellipsis;
  241. line-height: 1.25;
  242. }
  243. .attr-list {
  244. margin-bottom: #{12rpx};
  245. }
  246. .attr-list, .goods-num {
  247. font-size: #{24rpx};
  248. color: #999999;
  249. }
  250. .goods-other {
  251. margin-top: #{16rpx};
  252. }
  253. .attr-item {
  254. margin-right: #{24rpx};
  255. }
  256. .attr-item:last-child {
  257. margin-right: 0;
  258. }
  259. .goods-price-info {
  260. text-align: right;
  261. }
  262. }
  263. .goods-item:last-child {
  264. border-bottom: none;
  265. }
  266. }
  267. </style>