فهرست منبع

外部订单优化

wangxy 2 هفته پیش
والد
کامیت
fb9e053621
4فایلهای تغییر یافته به همراه348 افزوده شده و 37 حذف شده
  1. 22 0
      src/api/store/externalOrder.js
  2. 8 0
      src/views/company/orderApprove/list.vue
  3. 280 17
      src/views/store/externalOrder/index.vue
  4. 38 20
      src/views/store/storeOrder/list.vue

+ 22 - 0
src/api/store/externalOrder.js

@@ -23,6 +23,28 @@ export function getExternalOrder(id) {
   })
   })
 }
 }
 
 
+export function auditExternalOrder(id) {
+  return request({
+    url: '/store/externalOrder/audit/' + id,
+    method: 'post'
+  })
+}
+
+export function cancelExternalOrder(id) {
+  return request({
+    url: '/store/externalOrder/cancel/' + id,
+    method: 'post'
+  })
+}
+
+export function approveExternalOrder(data) {
+  return request({
+    url: '/store/externalOrder/approveOrder',
+    method: 'post',
+    data: data
+  })
+}
+
 export function exportExternalOrder(query) {
 export function exportExternalOrder(query) {
   return request({
   return request({
     url: '/store/externalOrder/export',
     url: '/store/externalOrder/export',

+ 8 - 0
src/views/company/orderApprove/list.vue

@@ -44,6 +44,12 @@
 
 
     <el-table height="450" v-loading="loading" border :data="orderList">
     <el-table height="450" v-loading="loading" border :data="orderList">
       <el-table-column label="订单编号" align="center" prop="orderCode" width="180px"/>
       <el-table-column label="订单编号" align="center" prop="orderCode" width="180px"/>
+      <el-table-column label="订单类型" align="center" prop="orderType">
+        <template slot-scope="scope">
+          <span v-if="scope.row.orderType === 0">外部订单</span>
+          <span v-else-if="scope.row.orderType === 1">普通订单</span>
+        </template>
+      </el-table-column>
       <el-table-column label="审核类型" align="center" prop="auditType">
       <el-table-column label="审核类型" align="center" prop="auditType">
         <template slot-scope="scope">
         <template slot-scope="scope">
           <span v-if="scope.row.auditType === 1">价格变更审核</span>
           <span v-if="scope.row.auditType === 1">价格变更审核</span>
@@ -185,6 +191,7 @@ export default {
       auditOpen: false,
       auditOpen: false,
       auditForm: {
       auditForm: {
         id: null,
         id: null,
+        orderType: null,
         auditType: null,
         auditType: null,
         originalTotalPrice: null,
         originalTotalPrice: null,
         originalPayPrice: null,
         originalPayPrice: null,
@@ -219,6 +226,7 @@ export default {
     handleAudit(row) {
     handleAudit(row) {
       this.auditForm = {
       this.auditForm = {
         id: row.id,
         id: row.id,
+        orderType: row.orderType,
         auditType: row.auditType,
         auditType: row.auditType,
         originalTotalPrice: row.originalTotalPrice,
         originalTotalPrice: row.originalTotalPrice,
         originalPayPrice: row.originalPayPrice,
         originalPayPrice: row.originalPayPrice,

+ 280 - 17
src/views/store/externalOrder/index.vue

@@ -115,7 +115,7 @@
           <dict-tag :options="statusOptions" :value="scope.row.status" />
           <dict-tag :options="statusOptions" :value="scope.row.status" />
         </template>
         </template>
       </el-table-column>
       </el-table-column>
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="100px">
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="240px">
         <template slot-scope="scope">
         <template slot-scope="scope">
           <el-button
           <el-button
             size="mini"
             size="mini"
@@ -123,6 +123,27 @@
             v-hasPermi="['store:externalOrder:query']"
             v-hasPermi="['store:externalOrder:query']"
             @click="handleView(scope.row)"
             @click="handleView(scope.row)"
           >查看</el-button>
           >查看</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            v-hasPermi="['store:externalOrder:audit']"
+            @click="handleAudit(scope.row)"
+            v-if="scope.row.status == 1"
+          >审核</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            v-hasPermi="['store:externalOrder:approveOrder']"
+            @click="handleApprove(scope.row)"
+            v-if="scope.row.status == 3 && !scope.row.isApplyAudit"
+          >申请审核</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            v-hasPermi="['store:externalOrder:cancel']"
+            @click="handleCancel(scope.row)"
+            v-if="scope.row.status != 4"
+          >取消订单</el-button>
         </template>
         </template>
       </el-table-column>
       </el-table-column>
     </el-table>
     </el-table>
@@ -192,9 +213,9 @@
             clearable
             clearable
             size="small"
             size="small"
             style="width: 300px; margin-bottom: 10px;"
             style="width: 300px; margin-bottom: 10px;"
-            @keyup.enter.native="getProductList"
+            @keyup.enter.native="handleProductSearch"
           />
           />
-          <el-button type="primary" size="small" style="margin-left: 10px;" @click="getProductList">搜索</el-button>
+          <el-button type="primary" size="small" style="margin-left: 10px;" @click="handleProductSearch">搜索</el-button>
           <el-table border width="100%" style="margin-top:5px;" :data="productJson" @selection-change="handleProductSelectionChange">
           <el-table border width="100%" style="margin-top:5px;" :data="productJson" @selection-change="handleProductSelectionChange">
             <el-table-column type="selection" width="55" align="center" />
             <el-table-column type="selection" width="55" align="center" />
             <el-table-column label="商品图片" align="center" width="120">
             <el-table-column label="商品图片" align="center" width="120">
@@ -206,13 +227,38 @@
               </template>
               </template>
             </el-table-column>
             </el-table-column>
             <el-table-column label="商品名称" show-overflow-tooltip align="center" prop="productName" />
             <el-table-column label="商品名称" show-overflow-tooltip align="center" prop="productName" />
-            <el-table-column label="售价" align="center" prop="price" >
+            <el-table-column label="售价" align="center" prop="price" width="160">
               <template slot-scope="scope">
               <template slot-scope="scope">
-                <span v-if="scope.row.price!=null">{{scope.row.price.toFixed(2)}}</span>
+                <el-input-number
+                  v-model="productPrices[scope.row.productId]"
+                  :min="0"
+                  :precision="2"
+                  :step="0.01"
+                  size="mini"
+                  @change="handleQuantityChange"
+                />
+              </template>
+            </el-table-column>
+            <el-table-column label="数量" align="center" width="160">
+              <template slot-scope="scope">
+                <el-input-number
+                  v-model="productQuantities[scope.row.productId]"
+                  :min="1"
+                  :max="getProductMax(scope.row)"
+                  size="mini"
+                  style="width: 140px;"
+                  @change="handleQuantityChange"
+                />
               </template>
               </template>
             </el-table-column>
             </el-table-column>
-            <el-table-column label="库存" align="center" prop="stock" />
           </el-table>
           </el-table>
+          <pagination
+            v-show="productTotal > 0"
+            :total="productTotal"
+            :page.sync="productQueryParams.pageNum"
+            :limit.sync="productQueryParams.pageSize"
+            @pagination="getProductList"
+          />
         </el-form-item>
         </el-form-item>
         <el-form-item label="支付方式" prop="payType">
         <el-form-item label="支付方式" prop="payType">
           <el-select v-model="form.payType" placeholder="请选择支付方式" clearable size="small">
           <el-select v-model="form.payType" placeholder="请选择支付方式" clearable size="small">
@@ -271,11 +317,56 @@
     <el-dialog :title="userAddress.title" v-if="userAddress.open" :visible.sync="userAddress.open" width="800px" append-to-body>
     <el-dialog :title="userAddress.title" v-if="userAddress.open" :visible.sync="userAddress.open" width="800px" append-to-body>
       <add-external-user-address ref="addExternalUserAddress" @addUserAddress="addUserAddress" />
       <add-external-user-address ref="addExternalUserAddress" @addUserAddress="addUserAddress" />
     </el-dialog>
     </el-dialog>
+
+    <el-dialog title="申请审核" :visible.sync="approveOpen" width="600px" append-to-body :close-on-click-modal="false">
+      <el-form ref="approveForm" :model="approveForm" :rules="approveRules" label-width="120px">
+        <el-form-item label="审核类型" prop="auditType">
+          <el-radio-group v-model="approveForm.auditType">
+            <el-radio :label="1">申请改价</el-radio>
+            <el-radio :label="2">订单完成</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <template v-if="approveForm.auditType === 1">
+          <el-form-item label="原价格">
+            <el-input v-model="approveForm.oldTotalPrice" disabled style="width: 200px;" />
+          </el-form-item>
+          <el-form-item label="更改后总价" prop="newTotalPrice">
+            <el-input-number v-model="approveForm.newTotalPrice" :precision="2" :min="0" style="width: 200px;" />
+          </el-form-item>
+          <el-form-item label="更改后实收" prop="newPayPrice">
+            <el-input-number v-model="approveForm.newPayPrice" :precision="2" :min="0" style="width: 200px;" />
+          </el-form-item>
+        </template>
+        <el-form-item label="申请原因" prop="priceChangeReason">
+          <el-input v-model="approveForm.priceChangeReason" type="textarea" :rows="3" placeholder="请输入申请原因" />
+        </el-form-item>
+        <el-form-item label="凭证图片">
+          <el-upload
+            class="avatar-uploader"
+            :action="uploadUrl"
+            :headers="headers"
+            :show-file-list="false"
+            :on-success="handleUploadSuccess"
+            accept="image/*"
+          >
+            <img v-if="approveForm.voucherImages" :src="approveForm.voucherImages" style="max-width: 200px; max-height: 200px;">
+            <el-button v-else size="small" type="primary">点击上传</el-button>
+          </el-upload>
+        </el-form-item>
+        <el-form-item label="凭证说明">
+          <el-input v-model="approveForm.voucherRemark" type="textarea" :rows="2" placeholder="请输入凭证说明" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="approveOpen = false">取 消</el-button>
+        <el-button type="primary" @click="submitApprove">确 定</el-button>
+      </div>
+    </el-dialog>
   </div>
   </div>
 </template>
 </template>
 
 
 <script>
 <script>
-import { listExternalOrder, createExternalOrder, getExternalOrder, exportExternalOrder } from "@/api/store/externalOrder";
+import { listExternalOrder, createExternalOrder, getExternalOrder, auditExternalOrder, cancelExternalOrder, approveExternalOrder, exportExternalOrder } from "@/api/store/externalOrder";
 import { getCompanyList } from "@/api/company/company";
 import { getCompanyList } from "@/api/company/company";
 import { listUserAddress } from "@/api/store/userAddress";
 import { listUserAddress } from "@/api/store/userAddress";
 import { listStoreProduct } from "@/api/store/storeProduct";
 import { listStoreProduct } from "@/api/store/storeProduct";
@@ -306,7 +397,13 @@ export default {
       address: [],
       address: [],
       addressloading: false,
       addressloading: false,
       productJson: [],
       productJson: [],
+      productTotal: 0,
       productNameSearch: null,
       productNameSearch: null,
+      productQueryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        productName: null
+      },
       user: {
       user: {
         open: false,
         open: false,
         title: "创建外部订单用户"
         title: "创建外部订单用户"
@@ -333,13 +430,43 @@ export default {
         userId: null,
         userId: null,
         payType: null,
         payType: null,
         payMoney: null,
         payMoney: null,
-        productIds: []
+        products: []
       },
       },
+      productQuantities: {},
+      productPrices: {},
+      selectedProducts: [],
       rules: {
       rules: {
         addressId: [{ required: true, message: "请选择收货地址", trigger: "change" }],
         addressId: [{ required: true, message: "请选择收货地址", trigger: "change" }],
         payType: [{ required: true, message: "支付方式不能为空", trigger: "change" }],
         payType: [{ required: true, message: "支付方式不能为空", trigger: "change" }],
         payMoney: [{ required: true, message: "支付金额不能为空", trigger: "blur" }]
         payMoney: [{ required: true, message: "支付金额不能为空", trigger: "blur" }]
       },
       },
+      approveOpen: false,
+      approveForm: {
+        orderIds: [],
+        auditType: 1,
+        oldTotalPrice: null,
+        newTotalPrice: null,
+        newPayPrice: null,
+        priceChangeReason: null,
+        voucherImages: null,
+        voucherRemark: null
+      },
+      approveRules: {
+        auditType: [
+          { required: true, message: "请选择审核类型", trigger: "change" }
+        ],
+        newTotalPrice: [
+          { required: true, message: "请输入更改后总价", trigger: "blur" }
+        ],
+        newPayPrice: [
+          { required: true, message: "请输入更改后实收", trigger: "blur" }
+        ],
+        priceChangeReason: [
+          { required: true, message: "请输入申请原因", trigger: "blur" }
+        ]
+      },
+      uploadUrl: process.env.VUE_APP_BASE_API + "/common/upload",
+      headers: { Authorization: "Bearer " + this.$store.getters.token },
       payTypeOptions: [],
       payTypeOptions: [],
       statusOptions: [],
       statusOptions: [],
       userStatusOptions: []
       userStatusOptions: []
@@ -351,7 +478,7 @@ export default {
     this.getDicts("sys_package_pay_type").then(response => {
     this.getDicts("sys_package_pay_type").then(response => {
       this.payTypeOptions = response.data;
       this.payTypeOptions = response.data;
     });
     });
-    this.getDicts("sys_order_status").then(response => {
+    this.getDicts("sys_externalOrder_status").then(response => {
       this.statusOptions = response.data;
       this.statusOptions = response.data;
     });
     });
     this.getDicts("sys_company_status").then(response => {
     this.getDicts("sys_company_status").then(response => {
@@ -408,9 +535,16 @@ export default {
       this.users = [];
       this.users = [];
       this.address = [];
       this.address = [];
       this.productJson = [];
       this.productJson = [];
+      this.productTotal = 0;
       this.productNameSearch = null;
       this.productNameSearch = null;
+      this.productQueryParams.pageNum = 1;
+      this.productQueryParams.productName = null;
+      this.productQuantities = {};
+      this.productPrices = {};
+      this.selectedProducts = [];
       this.open = true;
       this.open = true;
       this.title = "创建外部订单";
       this.title = "创建外部订单";
+      this.getProductList();
     },
     },
     reset() {
     reset() {
       this.form = {
       this.form = {
@@ -418,8 +552,11 @@ export default {
         userId: null,
         userId: null,
         payType: null,
         payType: null,
         payMoney: null,
         payMoney: null,
-        productIds: []
+        products: []
       };
       };
+      this.productQuantities = {};
+      this.productPrices = {};
+      this.selectedProducts = [];
       this.resetForm("form");
       this.resetForm("form");
     },
     },
     cancel() {
     cancel() {
@@ -481,18 +618,69 @@ export default {
         this.addressloading = false;
         this.addressloading = false;
       });
       });
     },
     },
+    handleProductSearch() {
+      this.productQueryParams.pageNum = 1;
+      this.productQueryParams.productName = this.productNameSearch;
+      this.getProductList();
+    },
     getProductList() {
     getProductList() {
       var data = {
       var data = {
-        productName: this.productNameSearch,
-        pageNum: 1,
-        pageSize: 100
+        pageNum: this.productQueryParams.pageNum,
+        pageSize: this.productQueryParams.pageSize,
+        productName: this.productNameSearch
       };
       };
       listStoreProduct(data).then(response => {
       listStoreProduct(data).then(response => {
-        this.productJson = response.rows;
+        this.productJson = response.rows || [];
+        this.productJson.forEach(item => {
+          if (this.productPrices[item.productId] == null && item.price != null) {
+            this.$set(this.productPrices, item.productId, Number(item.price));
+          }
+          if (this.productQuantities[item.productId] == null) {
+            this.$set(this.productQuantities, item.productId, 1);
+          }
+        });
+        this.productTotal = response.total || 0;
       });
       });
     },
     },
+    getDisplayProductPrice(product) {
+      const customPrice = this.productPrices[product.productId];
+      if (customPrice !== undefined && customPrice !== null && customPrice !== "") {
+        return Number(customPrice);
+      }
+      return Number(product.price || 0);
+    },
+    getProductMax(product) {
+      const stock = Number(product.stock);
+      if (Number.isFinite(stock) && stock > 0) {
+        return stock;
+      }
+      return 999;
+    },
     handleProductSelectionChange(selection) {
     handleProductSelectionChange(selection) {
-      this.form.productIds = selection.map(item => item.productId);
+      this.selectedProducts = selection;
+      // 初始化未设置数量的商品默认值为1
+      selection.forEach(item => {
+        if (this.productQuantities[item.productId] == null) {
+          this.$set(this.productQuantities, item.productId, 1);
+        }
+        if (this.productPrices[item.productId] == null) {
+          this.$set(this.productPrices, item.productId, this.getDisplayProductPrice(item));
+        }
+      });
+      this.handleQuantityChange();
+    },
+    isProductSelected(productId) {
+      return this.selectedProducts.some(item => item.productId === productId);
+    },
+    handleQuantityChange() {
+      // 数量变化时自动计算总金额
+      let total = 0;
+      this.selectedProducts.forEach(item => {
+        const quantity = this.productQuantities[item.productId] || 1;
+        const price = this.getDisplayProductPrice(item);
+        total += price * quantity;
+      });
+      this.form.payMoney = total.toFixed(2);
     },
     },
     submitForm() {
     submitForm() {
       this.$refs["form"].validate(valid => {
       this.$refs["form"].validate(valid => {
@@ -501,16 +689,22 @@ export default {
             this.msgError("请选择会员");
             this.msgError("请选择会员");
             return;
             return;
           }
           }
-          if (this.form.productIds.length === 0) {
+          if (this.selectedProducts.length === 0) {
             this.msgError("请选择至少一个商品");
             this.msgError("请选择至少一个商品");
             return;
             return;
           }
           }
+          // 构建商品列表 [{productId, num}]
+          const products = this.selectedProducts.map(item => ({
+            productId: item.productId,
+            num: this.productQuantities[item.productId] || 1,
+            price: this.getDisplayProductPrice(item)
+          }));
           var submitData = {
           var submitData = {
             addressId: this.form.addressId,
             addressId: this.form.addressId,
             userId: this.form.userId,
             userId: this.form.userId,
             payType: this.form.payType,
             payType: this.form.payType,
             payMoney: parseFloat(this.form.payMoney) || 0,
             payMoney: parseFloat(this.form.payMoney) || 0,
-            productIds: this.form.productIds
+            products: products
           };
           };
           createExternalOrder(submitData).then(response => {
           createExternalOrder(submitData).then(response => {
             if (response.code === 200) {
             if (response.code === 200) {
@@ -528,6 +722,75 @@ export default {
         this.detailOpen = true;
         this.detailOpen = true;
       });
       });
     },
     },
+    handleAudit(row) {
+      this.$confirm("确认审核该订单?审核后订单将变为待发货状态", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        auditExternalOrder(row.orderId).then(response => {
+          if (response.code === 200) {
+            this.msgSuccess("审核成功");
+            this.getList();
+          }
+        });
+      });
+    },
+    handleCancel(row) {
+      this.$confirm("确认取消该订单?取消后订单将变为已取消状态", "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        cancelExternalOrder(row.orderId).then(response => {
+          if (response.code === 200) {
+            this.msgSuccess("取消订单成功");
+            this.getList();
+          }
+        });
+      });
+    },
+    handleApprove(row) {
+      this.approveForm = {
+        orderIds: [row.orderId],
+        auditType: 1,
+        oldTotalPrice: row.payPrice,
+        newTotalPrice: null,
+        newPayPrice: null,
+        priceChangeReason: null,
+        voucherImages: null,
+        voucherRemark: null
+      };
+      this.approveOpen = true;
+    },
+    handleUploadSuccess(response) {
+      if (response.code === 200) {
+        this.approveForm.voucherImages = response.url;
+        this.msgSuccess("上传成功");
+      } else {
+        this.msgError(response.msg);
+      }
+    },
+    submitApprove() {
+      this.$refs["approveForm"].validate(valid => {
+        if (valid) {
+          const data = {
+            orderIds: this.approveForm.orderIds,
+            auditType: this.approveForm.auditType,
+            newTotalPrice: this.approveForm.newTotalPrice,
+            newPayPrice: this.approveForm.newPayPrice,
+            priceChangeReason: this.approveForm.priceChangeReason,
+            voucherImages: this.approveForm.voucherImages,
+            voucherRemark: this.approveForm.voucherRemark
+          };
+          approveExternalOrder(data).then(response => {
+            this.msgSuccess("提交成功");
+            this.approveOpen = false;
+            this.getList();
+          });
+        }
+      });
+    },
     handleExport() {
     handleExport() {
       const queryParams = this.queryParams;
       const queryParams = this.queryParams;
       this.$confirm("是否确认导出外部订单数据项?", "警告", {
       this.$confirm("是否确认导出外部订单数据项?", "警告", {

+ 38 - 20
src/views/store/storeOrder/list.vue

@@ -419,16 +419,16 @@
         </el-form-item>
         </el-form-item>
         <el-form-item label="商品信息" prop="product" >
         <el-form-item label="商品信息" prop="product" >
           <el-input
           <el-input
-            v-model="queryParams.productName"
+            v-model="productNameSearch"
             placeholder="请输入商品名称搜索"
             placeholder="请输入商品名称搜索"
             clearable
             clearable
             size="small"    style="width: 300px; margin-bottom: 10px;"
             size="small"    style="width: 300px; margin-bottom: 10px;"
-            @keyup.enter.native="getProductList"
+            @keyup.enter.native="handleProductSearch"
           />
           />
           <el-button
           <el-button
             type="primary"
             type="primary"
             size="small"    style="margin-left: 10px;"
             size="small"    style="margin-left: 10px;"
-            @click="getProductList"
+            @click="handleProductSearch"
           >搜索</el-button>
           >搜索</el-button>
           <el-table border width="100%" style="margin-top:5px;"  :data="productJson"  @selection-change="handleProductSelectionChange">
           <el-table border width="100%" style="margin-top:5px;"  :data="productJson"  @selection-change="handleProductSelectionChange">
             <el-table-column type="selection" width="55" align="center" />
             <el-table-column type="selection" width="55" align="center" />
@@ -453,12 +453,14 @@
             </el-table-column>
             </el-table-column>
             <el-table-column label="销量" align="center" prop="sales" />
             <el-table-column label="销量" align="center" prop="sales" />
             <el-table-column label="库存" align="center" prop="stock" />
             <el-table-column label="库存" align="center" prop="stock" />
-            <el-table-column label="商品类型" align="center" prop="productType" >
-              <template slot-scope="scope">
-                <el-tag prop="status" v-for="(item, index) in productTypeOptions"    v-if="scope.row.productType==item.dictValue">{{item.dictLabel}}</el-tag>
-              </template>
-            </el-table-column>
           </el-table>
           </el-table>
+          <pagination
+            v-show="productTotal > 0"
+            :total="productTotal"
+            :page.sync="productQueryParams.pageNum"
+            :limit.sync="productQueryParams.pageSize"
+            @pagination="getProductList"
+          />
         </el-form-item>
         </el-form-item>
 
 
 
 
@@ -579,6 +581,13 @@ export default {
     return {
     return {
       payTypeArr:[],
       payTypeArr:[],
       productJson:[],
       productJson:[],
+      productTotal: 0,
+      productNameSearch: null,
+      productQueryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        productName: null
+      },
       scheduleIdArr:[],
       scheduleIdArr:[],
       buyTypeArr:[],
       buyTypeArr:[],
       channelArr:[],
       channelArr:[],
@@ -844,15 +853,26 @@ export default {
       }, 500);
       }, 500);
     },
     },
     handleProductSelectionChange(selection) {
     handleProductSelectionChange(selection) {
-      // 将选中商品的ID保存到form.productIds中
       this.form.productIds = selection.map(item => item.productId);
       this.form.productIds = selection.map(item => item.productId);
     },
     },
+    handleProductSearch() {
+      this.productQueryParams.pageNum = 1;
+      this.productQueryParams.productName = this.productNameSearch;
+      this.getProductList();
+    },
     /** 查询商品列表 */
     /** 查询商品列表 */
     getProductList() {
     getProductList() {
+      const data = {
+        pageNum: this.productQueryParams.pageNum,
+        pageSize: this.productQueryParams.pageSize,
+        productName: this.productNameSearch
+      };
       this.loading = true;
       this.loading = true;
-      listStoreProduct(this.queryParams).then(response => {
-        this.productJson = response.rows;
-        this.total = response.total;
+      listStoreProduct(data).then(response => {
+        this.productJson = response.rows || [];
+        this.productTotal = response.total || 0;
+        this.loading = false;
+      }).catch(() => {
         this.loading = false;
         this.loading = false;
       });
       });
     },
     },
@@ -1150,19 +1170,15 @@ export default {
     /** 新增按钮操作 */
     /** 新增按钮操作 */
     handleAdd() {
     handleAdd() {
       this.reset();
       this.reset();
-      // 清空商品列表
       this.productJson = [];
       this.productJson = [];
-      // 清空用户搜索手机号
+      this.productTotal = 0;
       this.phone = null;
       this.phone = null;
-      // 清空用户列表
       this.users = [];
       this.users = [];
-      // 清空地址列表
       this.address = [];
       this.address = [];
-      // 清空就诊人列表
       this.patientList = [];
       this.patientList = [];
-      // 清空商品搜索名称
-      this.queryParams.productName = null;
-      // 重置表单
+      this.productNameSearch = null;
+      this.productQueryParams.pageNum = 1;
+      this.productQueryParams.productName = null;
       this.form = {
       this.form = {
         addressId: null,
         addressId: null,
         userId: null,
         userId: null,
@@ -1174,6 +1190,7 @@ export default {
       };
       };
       this.open = true;
       this.open = true;
       this.title = "添加订单";
       this.title = "添加订单";
+      this.getProductList();
     },
     },
     /** 修改按钮操作 */
     /** 修改按钮操作 */
     handleUpdate(row) {
     handleUpdate(row) {
@@ -1304,6 +1321,7 @@ export default {
         if (valid) {
         if (valid) {
           const data = {
           const data = {
             orderIds: this.approveForm.orderIds,
             orderIds: this.approveForm.orderIds,
+            orderType: 1,
             auditType: this.approveForm.auditType,
             auditType: this.approveForm.auditType,
             newTotalPrice: this.approveForm.newTotalPrice,
             newTotalPrice: this.approveForm.newTotalPrice,
             newPayPrice: this.approveForm.newPayPrice,
             newPayPrice: this.approveForm.newPayPrice,