app-submit-goods.vue 11 KB

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