|
@@ -0,0 +1,607 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div class="app-container">
|
|
|
|
|
+ <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
|
|
+ <el-form-item label="订单编号" prop="orderCode">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="queryParams.orderCode"
|
|
|
|
|
+ placeholder="请输入订单编号"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="用户名称" prop="userName">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="queryParams.userName"
|
|
|
|
|
+ placeholder="请输入用户名称"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="用户电话" prop="userPhone">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="queryParams.userPhone"
|
|
|
|
|
+ placeholder="请输入用户电话"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+
|
|
|
|
|
+ <el-form-item label="状态" prop="status">
|
|
|
|
|
+ <el-select v-model="queryParams.status" placeholder="状态" clearable size="small">
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="dict in statusOptions"
|
|
|
|
|
+ :key="dict.dictValue"
|
|
|
|
|
+ :label="dict.dictLabel"
|
|
|
|
|
+ :value="dict.dictValue"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="快递单号" prop="deliverySn">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="queryParams.deliverySn"
|
|
|
|
|
+ placeholder="请输入快递单号"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+
|
|
|
|
|
+ <el-form-item label="提交时间" prop="createTime">
|
|
|
|
|
+ <el-date-picker
|
|
|
|
|
+ v-model="createTime"
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ style="width: 220px"
|
|
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
|
|
+ type="daterange"
|
|
|
|
|
+ range-separator="-"
|
|
|
|
|
+ start-placeholder="开始日期"
|
|
|
|
|
+ end-placeholder="结束日期"
|
|
|
|
|
+ @change="change"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+
|
|
|
|
|
+ <el-form-item>
|
|
|
|
|
+ <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
|
|
+ <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+
|
|
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
|
|
+ <el-col :span="1.5">
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ icon="el-icon-plus"
|
|
|
|
|
+ size="mini"
|
|
|
|
|
+ @click="handleAdd"
|
|
|
|
|
+ v-hasPermi="['his:integralOrder:addManually']"
|
|
|
|
|
+ >创建订单</el-button>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="1.5">
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ type="warning"
|
|
|
|
|
+ plain
|
|
|
|
|
+ icon="el-icon-download"
|
|
|
|
|
+ size="mini"
|
|
|
|
|
+ :loading="exportLoading"
|
|
|
|
|
+ @click="handleExport"
|
|
|
|
|
+ v-hasPermi="['his:integralOrder:export']"
|
|
|
|
|
+ >导出</el-button>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+
|
|
|
|
|
+ <el-tabs type="card" v-model="actName" @tab-click="handleClickX">
|
|
|
|
|
+ <el-tab-pane label="全部订单" name="10"></el-tab-pane>
|
|
|
|
|
+ <el-tab-pane v-for="(item,index) in statusOptions" :key="index" :label="item.dictLabel" :name="item.dictValue"></el-tab-pane>
|
|
|
|
|
+ </el-tabs>
|
|
|
|
|
+
|
|
|
|
|
+ <el-table v-loading="loading" border :data="integralOrderList" @selection-change="handleSelectionChange">
|
|
|
|
|
+ <el-table-column type="selection" width="55" align="center" />
|
|
|
|
|
+ <el-table-column label="订单编号" align="center" prop="orderCode" />
|
|
|
|
|
+ <el-table-column label="商品信息" align="center" width="200">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <div style="display: flex; align-items: center; justify-content: center;">
|
|
|
|
|
+ <span style="white-space: pre-line; text-align: left;">{{ scope.row.goodsName }}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="用户名称" align="center" prop="userName" />
|
|
|
|
|
+ <el-table-column label="用户电话" align="center" prop="userPhone" />
|
|
|
|
|
+ <el-table-column label="用户地址" align="center" prop="userAddress" show-overflow-tooltip />
|
|
|
|
|
+ <el-table-column label="支付积分" align="center" prop="integral" />
|
|
|
|
|
+ <el-table-column label="支付金额" align="center" prop="payMoney" />
|
|
|
|
|
+ <el-table-column label="状态" align="center" prop="status">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <dict-tag :options="statusOptions" :value="scope.row.status"/>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="快递公司编号" align="center" prop="deliveryCode" />
|
|
|
|
|
+ <el-table-column label="快递名称" align="center" prop="deliveryName" />
|
|
|
|
|
+ <el-table-column label="快递单号" align="center" prop="deliverySn" />
|
|
|
|
|
+ <el-table-column label="发货时间" align="center" prop="deliveryTime" width="180"/>
|
|
|
|
|
+ <el-table-column label="提交时间" align="center" prop="createTime" width="180"/>
|
|
|
|
|
+ <el-table-column label="备注" align="center" prop="remark" show-overflow-tooltip/>
|
|
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ size="mini"
|
|
|
|
|
+ type="text"
|
|
|
|
|
+ @click="handledetails(scope.row)"
|
|
|
|
|
+ >详情</el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+
|
|
|
|
|
+ <pagination
|
|
|
|
|
+ v-show="total>0"
|
|
|
|
|
+ :total="total"
|
|
|
|
|
+ :page.sync="queryParams.pageNum"
|
|
|
|
|
+ :limit.sync="queryParams.pageSize"
|
|
|
|
|
+ @pagination="getList"
|
|
|
|
|
+ />
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 订单详情抽屉 -->
|
|
|
|
|
+ <el-drawer
|
|
|
|
|
+ :with-header="false"
|
|
|
|
|
+ size="75%"
|
|
|
|
|
+ :title="show.title"
|
|
|
|
|
+ :visible.sync="show.open"
|
|
|
|
|
+ >
|
|
|
|
|
+ <integralOrderDetails ref="Details" />
|
|
|
|
|
+ </el-drawer>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 创建订单对话框 -->
|
|
|
|
|
+ <el-dialog :title="title" v-if="open" :visible.sync="open" width="1000px" append-to-body :close-on-click-modal="false">
|
|
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
|
|
|
|
+ <el-form-item label="会员信息" prop="userId">
|
|
|
|
|
+ <el-row>
|
|
|
|
|
+ <el-col>
|
|
|
|
|
+ <el-input placeholder="请输入会员手机号" style="width:240px;" v-model="phone"/>
|
|
|
|
|
+ <el-button plain style="margin-left:10px;" @click="searchUser()">查询</el-button>
|
|
|
|
|
+ <el-button plain style="margin-left:10px;" icon="el-icon-plus" type="primary" @click="handleAddUser()">添加会员</el-button>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+ <el-table border style="margin-top:5px;" v-loading="userloading" :data="users">
|
|
|
|
|
+ <el-table-column label="ID" align="center" prop="userId" />
|
|
|
|
|
+ <el-table-column label="会员头像" align="center" width="80">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <el-popover placement="right" title="" trigger="hover">
|
|
|
|
|
+ <img slot="reference" :src="scope.row.avatar" width="50">
|
|
|
|
|
+ <img :src="scope.row.avatar" style="max-width: 120px;">
|
|
|
|
|
+ </el-popover>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="昵称" align="center" prop="nickName" />
|
|
|
|
|
+ <el-table-column label="手机号" align="center" prop="phone" />
|
|
|
|
|
+ <el-table-column label="状态" align="center" prop="status">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <el-tag prop="status" v-for="(item, index) in userStatusOptions" :key="index" v-if="scope.row.status==item.dictValue">{{item.dictLabel}}</el-tag>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="收货信息" prop="addressId">
|
|
|
|
|
+ <el-row>
|
|
|
|
|
+ <el-col>
|
|
|
|
|
+ <el-button plain type="primary" icon="el-icon-plus" @click="handleAddUserAddress()">添加收货地址</el-button>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+ <el-radio-group v-model="form.addressId" style="width:100%">
|
|
|
|
|
+ <el-table border style="margin-top:5px;" v-loading="addressloading" :data="address">
|
|
|
|
|
+ <el-table-column label="ID" align="center">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <el-radio :label="scope.row.addressId"></el-radio>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="收货人姓名" align="center" prop="realName" />
|
|
|
|
|
+ <el-table-column label="收货人所在省" align="center" prop="province" />
|
|
|
|
|
+ <el-table-column label="收货人所在市" align="center" prop="city" />
|
|
|
|
|
+ <el-table-column label="收货人所在区" align="center" prop="district" />
|
|
|
|
|
+ <el-table-column label="收货人详细地址" align="center" prop="detail" />
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+ </el-radio-group>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="商品信息" prop="product">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="queryParams.productName"
|
|
|
|
|
+ placeholder="请输入商品名称搜索"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ style="width: 300px; margin-bottom: 10px;"
|
|
|
|
|
+ @keyup.enter.native="getProductList"
|
|
|
|
|
+ />
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ style="margin-left: 10px;"
|
|
|
|
|
+ @click="getProductList"
|
|
|
|
|
+ >搜索</el-button>
|
|
|
|
|
+ <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 label="商品图片" align="center" width="120">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <el-popover placement="right" title="" trigger="hover">
|
|
|
|
|
+ <img slot="reference" :src="scope.row.imgUrl" width="100">
|
|
|
|
|
+ <img :src="scope.row.imgUrl" style="max-width: 150px;">
|
|
|
|
|
+ </el-popover>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="商品名称" show-overflow-tooltip align="center" prop="goodsName" />
|
|
|
|
|
+ <el-table-column label="积分" align="center" prop="integral" />
|
|
|
|
|
+ <el-table-column label="金额" align="center" prop="cash">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <span v-if="scope.row.cash!=null">{{scope.row.cash.toFixed(2)}}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="支付方式" prop="payType">
|
|
|
|
|
+ <el-select v-model="form.payType" placeholder="请选择支付方式" clearable size="small">
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in payTypeOptions"
|
|
|
|
|
+ :key="item.dictValue"
|
|
|
|
|
+ :label="item.dictLabel"
|
|
|
|
|
+ :value="item.dictValue"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="支付金额" prop="payMoney">
|
|
|
|
|
+ <el-input v-model="form.payMoney" placeholder="请输入支付金额" clearable size="small" style="width: 200px;" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
|
+ <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
|
|
+ <el-button @click="cancel">取 消</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 添加会员弹窗 -->
|
|
|
|
|
+ <el-dialog :title="user.title" v-if="user.open" :visible.sync="user.open" width="500px" append-to-body>
|
|
|
|
|
+ <add-user @addUser="addUser" />
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 添加收货地址弹窗 -->
|
|
|
|
|
+ <el-dialog :title="userAddress.title" v-if="userAddress.open" :visible.sync="userAddress.open" width="800px" append-to-body>
|
|
|
|
|
+ <add-user-address ref="addUserAddress" @addUserAddress="addUserAddress" />
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<script>
|
|
|
|
|
+import { listIntegralOrder, getIntegralOrder, exportIntegralOrder, createOrderByManually, getCheckinPrizeGoodsList } from "@/api/his/integralOrder";
|
|
|
|
|
+import { userList } from "@/api/store/user";
|
|
|
|
|
+import { listUserAddress } from "@/api/store/userAddress";
|
|
|
|
|
+import integralOrderDetails from './components/integralOrderDetails.vue';
|
|
|
|
|
+import addUser from "@/views/store/components/addUser.vue";
|
|
|
|
|
+import addUserAddress from "@/views/store/components/addUserAddress.vue";
|
|
|
|
|
+
|
|
|
|
|
+export default {
|
|
|
|
|
+ name: "IntegralOrder",
|
|
|
|
|
+ components: { integralOrderDetails, addUser, addUserAddress },
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ show: {
|
|
|
|
|
+ open: false,
|
|
|
|
|
+ title: "订单详情"
|
|
|
|
|
+ },
|
|
|
|
|
+ // 遮罩层
|
|
|
|
|
+ loading: true,
|
|
|
|
|
+ actName: "10",
|
|
|
|
|
+ // 导出遮罩层
|
|
|
|
|
+ exportLoading: false,
|
|
|
|
|
+ // 选中数组
|
|
|
|
|
+ ids: [],
|
|
|
|
|
+ // 非单个禁用
|
|
|
|
|
+ single: true,
|
|
|
|
|
+ // 非多个禁用
|
|
|
|
|
+ multiple: true,
|
|
|
|
|
+ // 显示搜索条件
|
|
|
|
|
+ showSearch: true,
|
|
|
|
|
+ // 总条数
|
|
|
|
|
+ total: 0,
|
|
|
|
|
+ // 积分商品订单表格数据
|
|
|
|
|
+ integralOrderList: [],
|
|
|
|
|
+ // 状态字典
|
|
|
|
|
+ statusOptions: [],
|
|
|
|
|
+ // 查询参数
|
|
|
|
|
+ queryParams: {
|
|
|
|
|
+ pageNum: 1,
|
|
|
|
|
+ pageSize: 10,
|
|
|
|
|
+ orderCode: null,
|
|
|
|
|
+ userName: null,
|
|
|
|
|
+ userPhone: null,
|
|
|
|
|
+ integral: null,
|
|
|
|
|
+ status: null,
|
|
|
|
|
+ deliverySn: null,
|
|
|
|
|
+ createTime: null,
|
|
|
|
|
+ sTime: null,
|
|
|
|
|
+ eTime: null,
|
|
|
|
|
+ productName: null
|
|
|
|
|
+ },
|
|
|
|
|
+ createTime: null,
|
|
|
|
|
+ // 创建订单相关
|
|
|
|
|
+ open: false,
|
|
|
|
|
+ title: "",
|
|
|
|
|
+ phone: null,
|
|
|
|
|
+ userloading: false,
|
|
|
|
|
+ users: [],
|
|
|
|
|
+ address: [],
|
|
|
|
|
+ addressloading: false,
|
|
|
|
|
+ productJson: [],
|
|
|
|
|
+ payTypeOptions: [],
|
|
|
|
|
+ userStatusOptions: [],
|
|
|
|
|
+ // 表单参数
|
|
|
|
|
+ form: {
|
|
|
|
|
+ addressId: null,
|
|
|
|
|
+ userId: null,
|
|
|
|
|
+ payType: null,
|
|
|
|
|
+ payMoney: null,
|
|
|
|
|
+ goodsIds: []
|
|
|
|
|
+ },
|
|
|
|
|
+ // 表单校验
|
|
|
|
|
+ rules: {},
|
|
|
|
|
+ // 添加会员弹窗
|
|
|
|
|
+ user: {
|
|
|
|
|
+ open: false,
|
|
|
|
|
+ title: "创建会员"
|
|
|
|
|
+ },
|
|
|
|
|
+ // 添加收货地址弹窗
|
|
|
|
|
+ userAddress: {
|
|
|
|
|
+ open: false,
|
|
|
|
|
+ title: "创建收货地址"
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
|
|
+ created() {
|
|
|
|
|
+ this.getList();
|
|
|
|
|
+ this.getDicts("sys_integral_order_status").then(response => {
|
|
|
|
|
+ this.statusOptions = response.data;
|
|
|
|
|
+ });
|
|
|
|
|
+ this.getDicts("sys_company_status").then(response => {
|
|
|
|
|
+ this.userStatusOptions = response.data;
|
|
|
|
|
+ });
|
|
|
|
|
+ this.getDicts("sys_package_pay_type").then(response => {
|
|
|
|
|
+ this.payTypeOptions = response.data;
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ change() {
|
|
|
|
|
+ if (this.createTime != null) {
|
|
|
|
|
+ this.queryParams.sTime = this.createTime[0];
|
|
|
|
|
+ this.queryParams.eTime = this.createTime[1];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.queryParams.sTime = null;
|
|
|
|
|
+ this.queryParams.eTime = null;
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ handledetails(row) {
|
|
|
|
|
+ this.show.open = true;
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ this.$refs.Details.getDetails(row.orderId);
|
|
|
|
|
+ }, 1);
|
|
|
|
|
+ },
|
|
|
|
|
+ /** 查询积分商品订单列表 */
|
|
|
|
|
+ getList() {
|
|
|
|
|
+ this.loading = true;
|
|
|
|
|
+ listIntegralOrder(this.queryParams).then(response => {
|
|
|
|
|
+ const processedData = response.rows.map(item => {
|
|
|
|
|
+ let goodsName = '';
|
|
|
|
|
+ try {
|
|
|
|
|
+ if (item.itemJson) {
|
|
|
|
|
+ const itemData = JSON.parse(item.itemJson);
|
|
|
|
|
+ if (Array.isArray(itemData) && itemData.length > 0) {
|
|
|
|
|
+ const goodsInfoList = itemData
|
|
|
|
|
+ .filter(goods => goods.goodsName)
|
|
|
|
|
+ .map(goods => {
|
|
|
|
|
+ const name = goods.goodsName || '';
|
|
|
|
|
+ const itemNum = goods.num || 1;
|
|
|
|
|
+ return `${name},数量:${itemNum}个`;
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ if (goodsInfoList.length > 0) {
|
|
|
|
|
+ goodsName = goodsInfoList.join('\n');
|
|
|
|
|
+ } else if (itemData[0].goodsName) {
|
|
|
|
|
+ const firstItem = itemData[0];
|
|
|
|
|
+ goodsName = `${firstItem.goodsName || ''},数量:${firstItem.num || 1}个`;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (itemData.goodsName) {
|
|
|
|
|
+ goodsName = `${itemData.goodsName},数量:${itemData.num || 1}个`;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('解析itemJson失败:', error);
|
|
|
|
|
+ goodsName = '';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return {
|
|
|
|
|
+ ...item,
|
|
|
|
|
+ goodsName: goodsName
|
|
|
|
|
+ };
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ this.integralOrderList = processedData;
|
|
|
|
|
+ this.total = response.total;
|
|
|
|
|
+ this.loading = false;
|
|
|
|
|
+ }).catch(error => {
|
|
|
|
|
+ console.error('查询订单列表失败:', error);
|
|
|
|
|
+ this.loading = false;
|
|
|
|
|
+ this.$message.error('查询订单列表失败');
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ /** 搜索按钮操作 */
|
|
|
|
|
+ handleQuery() {
|
|
|
|
|
+ this.queryParams.pageNum = 1;
|
|
|
|
|
+ this.getList();
|
|
|
|
|
+ },
|
|
|
|
|
+ /** 重置按钮操作 */
|
|
|
|
|
+ resetQuery() {
|
|
|
|
|
+ this.resetForm("queryForm");
|
|
|
|
|
+ this.createTime = null;
|
|
|
|
|
+ this.queryParams.sTime = null;
|
|
|
|
|
+ this.queryParams.eTime = null;
|
|
|
|
|
+ this.handleQuery();
|
|
|
|
|
+ },
|
|
|
|
|
+ // 多选框选中数据
|
|
|
|
|
+ handleSelectionChange(selection) {
|
|
|
|
|
+ this.ids = selection.map(item => item.orderId);
|
|
|
|
|
+ this.single = selection.length !== 1;
|
|
|
|
|
+ this.multiple = !selection.length;
|
|
|
|
|
+ },
|
|
|
|
|
+ handleClickX(tab, event) {
|
|
|
|
|
+ if (tab.name == "10") {
|
|
|
|
|
+ this.queryParams.status = null;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.queryParams.status = tab.name;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.handleQuery();
|
|
|
|
|
+ },
|
|
|
|
|
+ /** 导出按钮操作 */
|
|
|
|
|
+ handleExport() {
|
|
|
|
|
+ const queryParams = this.queryParams;
|
|
|
|
|
+ this.$confirm('是否确认导出所有积分商品订单数据项?', "警告", {
|
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
|
+ type: "warning"
|
|
|
|
|
+ }).then(() => {
|
|
|
|
|
+ this.exportLoading = true;
|
|
|
|
|
+ return exportIntegralOrder(queryParams);
|
|
|
|
|
+ }).then(response => {
|
|
|
|
|
+ this.download(response.msg);
|
|
|
|
|
+ this.exportLoading = false;
|
|
|
|
|
+ }).catch(() => {});
|
|
|
|
|
+ },
|
|
|
|
|
+ // ========== 创建订单相关方法 ==========
|
|
|
|
|
+ /** 新增按钮操作 */
|
|
|
|
|
+ handleAdd() {
|
|
|
|
|
+ this.reset();
|
|
|
|
|
+ this.productJson = [];
|
|
|
|
|
+ this.phone = null;
|
|
|
|
|
+ this.users = [];
|
|
|
|
|
+ this.address = [];
|
|
|
|
|
+ this.queryParams.productName = null;
|
|
|
|
|
+ this.form = {
|
|
|
|
|
+ addressId: null,
|
|
|
|
|
+ userId: null,
|
|
|
|
|
+ payType: null,
|
|
|
|
|
+ payMoney: null,
|
|
|
|
|
+ goodsIds: []
|
|
|
|
|
+ };
|
|
|
|
|
+ this.open = true;
|
|
|
|
|
+ this.title = "创建订单";
|
|
|
|
|
+ },
|
|
|
|
|
+ // 取消按钮
|
|
|
|
|
+ cancel() {
|
|
|
|
|
+ this.open = false;
|
|
|
|
|
+ this.reset();
|
|
|
|
|
+ },
|
|
|
|
|
+ // 表单重置
|
|
|
|
|
+ reset() {
|
|
|
|
|
+ this.form = {
|
|
|
|
|
+ addressId: null,
|
|
|
|
|
+ userId: null,
|
|
|
|
|
+ payType: null,
|
|
|
|
|
+ payMoney: null,
|
|
|
|
|
+ goodsIds: []
|
|
|
|
|
+ };
|
|
|
|
|
+ this.resetForm("form");
|
|
|
|
|
+ },
|
|
|
|
|
+ /** 提交按钮 */
|
|
|
|
|
+ submitForm() {
|
|
|
|
|
+ this.$refs["form"].validate(valid => {
|
|
|
|
|
+ if (valid) {
|
|
|
|
|
+ createOrderByManually(this.form).then(response => {
|
|
|
|
|
+ this.msgSuccess("新增成功");
|
|
|
|
|
+ this.open = false;
|
|
|
|
|
+ this.form = {
|
|
|
|
|
+ addressId: null,
|
|
|
|
|
+ userId: null,
|
|
|
|
|
+ payType: null,
|
|
|
|
|
+ payMoney: null,
|
|
|
|
|
+ goodsIds: []
|
|
|
|
|
+ };
|
|
|
|
|
+ this.getList();
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ // 查询会员
|
|
|
|
|
+ searchUser() {
|
|
|
|
|
+ if (this.phone == null || this.phone == "") {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ var data = { phone: this.phone };
|
|
|
|
|
+ this.userloading = true;
|
|
|
|
|
+ this.users = [];
|
|
|
|
|
+ this.address = [];
|
|
|
|
|
+ userList(data).then(response => {
|
|
|
|
|
+ this.users = response.rows;
|
|
|
|
|
+ this.userloading = false;
|
|
|
|
|
+ if (this.users != null && this.users.length == 1) {
|
|
|
|
|
+ this.form.userId = this.users[0].userId;
|
|
|
|
|
+ this.getAddressList(this.form.userId);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ // 添加会员回调
|
|
|
|
|
+ addUser(phone) {
|
|
|
|
|
+ this.user.open = false;
|
|
|
|
|
+ this.phone = phone;
|
|
|
|
|
+ this.searchUser();
|
|
|
|
|
+ },
|
|
|
|
|
+ // 打开添加会员弹窗
|
|
|
|
|
+ handleAddUser() {
|
|
|
|
|
+ this.user.open = true;
|
|
|
|
|
+ },
|
|
|
|
|
+ // 打开添加收货地址弹窗
|
|
|
|
|
+ handleAddUserAddress() {
|
|
|
|
|
+ if (this.form.userId == null) {
|
|
|
|
|
+ this.msgError("请选择会员");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.userAddress.open = true;
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ this.$refs.addUserAddress.init(this.form.userId);
|
|
|
|
|
+ }, 500);
|
|
|
|
|
+ },
|
|
|
|
|
+ // 添加收货地址回调
|
|
|
|
|
+ addUserAddress() {
|
|
|
|
|
+ this.userAddress.open = false;
|
|
|
|
|
+ this.getAddressList(this.form.userId);
|
|
|
|
|
+ },
|
|
|
|
|
+ // 获取地址列表
|
|
|
|
|
+ getAddressList(userId) {
|
|
|
|
|
+ var data = { userId: userId };
|
|
|
|
|
+ this.addressloading = true;
|
|
|
|
|
+ this.address = [];
|
|
|
|
|
+ listUserAddress(data).then(response => {
|
|
|
|
|
+ this.address = response.rows;
|
|
|
|
|
+ this.addressloading = false;
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ // 查询商品列表
|
|
|
|
|
+ getProductList() {
|
|
|
|
|
+ if (!this.form.userId) {
|
|
|
|
|
+ this.msgWarning("请先选择会员");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ const params = {
|
|
|
|
|
+ userIds: [this.form.userId]
|
|
|
|
|
+ };
|
|
|
|
|
+ if (this.queryParams.productName) {
|
|
|
|
|
+ params.goodsName = this.queryParams.productName;
|
|
|
|
|
+ }
|
|
|
|
|
+ getCheckinPrizeGoodsList(params).then(response => {
|
|
|
|
|
+ this.productJson = response.rows || response.data || [];
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ // 商品选择变化
|
|
|
|
|
+ handleProductSelectionChange(selection) {
|
|
|
|
|
+ this.form.goodsIds = selection.map(item => item.goodsId);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+</script>
|