xiongzhu 4 jaren geleden
bovenliggende
commit
56092948f7

+ 21 - 9
src/main/java/com/izouma/nineth/service/OrderService.java

@@ -276,23 +276,23 @@ public class OrderService {
         paymentParams.put("notify_url", adapayProperties.getNotifyUrl() + "/order/" + order.getId());
 
         List<Map<String, Object>> divMembers = new ArrayList<>();
-        BigDecimal restAmount = order.getTotalPrice().setScale(2, RoundingMode.HALF_UP);
+        BigDecimal totalAmount = order.getTotalPrice().subtract(order.getGasPrice());
+        BigDecimal restAmount = order.getTotalPrice().multiply(BigDecimal.valueOf(1));
 
         if (collection.getSource().equals(CollectionSource.TRANSFER)) {
             Asset asset = assetRepo.findById(collection.getAssetId()).orElseThrow(new BusinessException("无记录"));
             User owner = userRepo.findById(asset.getUserId()).orElseThrow(new BusinessException("拥有者用户不存在"));
-
-            restAmount = divMoney(order.getTotalPrice(), restAmount, divMembers, "0",
-                    collection.getServiceCharge() + collection.getRoyalties(), true);
-            restAmount = divMoney(order.getTotalPrice(), restAmount, divMembers, owner.getMemberId(),
-                    -1, false);
+            if (collection.getServiceCharge() + collection.getRoyalties() > 0) {
+                restAmount = divMoney(totalAmount, restAmount, divMembers, "0",
+                        collection.getServiceCharge() + collection.getRoyalties(), true);
+            }
+            restAmount = divMoney(restAmount, divMembers, owner.getMemberId(), restAmount, false);
         } else {
             if (invitor != null) {
-                restAmount = divMoney(order.getTotalPrice(), restAmount, divMembers, invitor.getMemberId(),
+                restAmount = divMoney(totalAmount, restAmount, divMembers, invitor.getMemberId(),
                         invitor.getShareRatio().intValue(), false);
             }
-            restAmount = divMoney(order.getTotalPrice(), restAmount, divMembers, "0",
-                    -1, true);
+            restAmount = divMoney(restAmount, divMembers, "0", restAmount, true);
         }
         if (divMembers.size() > 1) {
             paymentParams.put("div_members", JSON.toJSONString(divMembers));
@@ -354,6 +354,18 @@ public class OrderService {
         }
     }
 
+    public static BigDecimal divMoney(BigDecimal restAmount, List<Map<String, Object>> divMembers,
+                                      String memberId, BigDecimal divAmount, boolean feeFlag) {
+        if (divAmount.compareTo(BigDecimal.ZERO) > 0) {
+            Map<String, Object> divMem = new HashMap<>();
+            divMem.put("member_id", memberId);
+            divMem.put("amount", divAmount.toPlainString());
+            divMem.put("fee_flag", feeFlag ? "Y" : "N");
+            divMembers.add(divMem);
+        }
+        return restAmount.subtract(divAmount);
+    }
+
     @Transactional
     public void notifyOrder(Long orderId, PayMethod payMethod, String transactionId) {
         Order order = orderRepo.findById(orderId).orElseThrow(new BusinessException("订单不存在"));

+ 1 - 1
src/main/nine-space/src/main.js

@@ -56,7 +56,7 @@ http.http
             });
         });
     })
-    .catch(e => { });
+    .catch(e => {});
 
 createApp(App)
     .use(Vant)

+ 1 - 1
src/main/nine-space/src/mixins/product.js

@@ -56,7 +56,7 @@ export default {
             }
         },
         isSold() {
-            return this.info.sale === this.info.total
+            return this.info.sale === this.info.total;
         }
     },
     methods: {

+ 1 - 1
src/main/nine-space/src/views/Discover.vue

@@ -84,7 +84,7 @@
         <div class="box">
             <page-title title="更多藏品" :isLink="false"></page-title>
             <van-list
-                style="padding-bottom: 100px;"
+                style="padding-bottom: 100px"
                 class="box-list"
                 v-model:loading="loading"
                 :finished="finished"

+ 2 - 2
src/main/nine-space/src/views/asset/Detail.vue

@@ -147,7 +147,7 @@
                     <div class="prive" v-if="init.length > 0">
                         <div class="prive1" :class="{ opened: item.opened }" v-for="(item, index) in init" :key="index">
                             <img v-if="!item.opened" class="img" :src="item.icon[0]" alt="" />
-                            <div style="margin-top: 4px;" v-if="item.icon[2]">
+                            <div style="margin-top: 4px" v-if="item.icon[2]">
                                 <img v-if="item.opened" class="img" :src="item.icon[2]" alt="" />
                             </div>
                             <!-- <img class="img" v-else :src="item.icon[0]" alt="" /> -->
@@ -194,7 +194,7 @@
                             <div class="text4">{{ item.createdAt.substr(0, 16) }}</div>
                         </div>
                     </div>
-                    <div v-else style="display: flex; justify-content: center;">暂无购买记录</div>
+                    <div v-else style="display: flex; justify-content: center">暂无购买记录</div>
                 </van-collapse-item>
             </van-collapse>
 

+ 2 - 2
src/main/nine-space/src/views/product/Detail.vue

@@ -524,7 +524,7 @@ export default {
             color: @text3;
             line-height: 20px;
             height: 20px;
-            background-color: #27272B;
+            background-color: #27272b;
             border-radius: 4px;
             padding: 0 10px;
 
@@ -545,7 +545,7 @@ export default {
                     }
                     &:last-child {
                         color: @prim;
-                        background-color: #27272B;
+                        background-color: #27272b;
                     }
                 }