|
|
@@ -0,0 +1,547 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-tabs v-model="activeStatus" @tab-click="handleTabClick">
|
|
|
+ <el-tab-pane label="全部" name="all"></el-tab-pane>
|
|
|
+ <el-tab-pane
|
|
|
+ v-for="item in statusOptions"
|
|
|
+ :key="item.dictValue"
|
|
|
+ :label="item.dictLabel"
|
|
|
+ :name="item.dictValue"
|
|
|
+ ></el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+
|
|
|
+ <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
|
|
|
+ <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="用户ID" prop="userId">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.userId"
|
|
|
+ placeholder="请输入用户ID"
|
|
|
+ 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="isPay">
|
|
|
+ <el-select v-model="queryParams.isPay" placeholder="请选择是否支付" clearable size="small">
|
|
|
+ <el-option label="是" value="1" />
|
|
|
+ <el-option label="否" value="0" />
|
|
|
+ </el-select>
|
|
|
+ </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="handleCreateTimeChange"
|
|
|
+ />
|
|
|
+ </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:externalOrder:create']"
|
|
|
+ >创建外部订单</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="['store:externalOrder:export']"
|
|
|
+ >导出</el-button>
|
|
|
+ </el-col>
|
|
|
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-table v-loading="loading" border :data="orderList">
|
|
|
+ <el-table-column label="外部订单号" align="center" prop="orderCode" width="180px" />
|
|
|
+ <el-table-column label="所属公司" align="center" prop="companyName" />
|
|
|
+ <el-table-column label="员工" align="center" prop="companyUserName" />
|
|
|
+ <el-table-column label="收货人" align="center" prop="userName" />
|
|
|
+ <el-table-column label="商品名称" align="center" prop="productNames" show-overflow-tooltip />
|
|
|
+ <el-table-column label="应收金额" align="center" prop="receivablePrice" />
|
|
|
+ <el-table-column label="实收金额" align="center" prop="payPrice" />
|
|
|
+ <el-table-column label="支付方式" align="center" prop="payType">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <dict-tag :options="payTypeOptions" :value="scope.row.payType" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="创建时间" align="center" prop="externalCreateTime" width="180" />
|
|
|
+ <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" class-name="small-padding fixed-width" fixed="right" width="100px">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ v-hasPermi="['store:externalOrder:query']"
|
|
|
+ @click="handleView(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-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="productList">
|
|
|
+ <el-input
|
|
|
+ v-model="productNameSearch"
|
|
|
+ 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="productName" />
|
|
|
+ <el-table-column label="售价" align="center" prop="price" >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span v-if="scope.row.price!=null">{{scope.row.price.toFixed(2)}}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="库存" align="center" prop="stock" />
|
|
|
+ </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="订单详情" v-if="detailOpen" :visible.sync="detailOpen" width="800px" append-to-body>
|
|
|
+ <el-descriptions :column="2" border>
|
|
|
+ <el-descriptions-item label="外部订单号">{{ detailData.orderCode }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="所属公司">{{ detailData.companyName }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="员工">{{ detailData.companyUserName }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="收货人">{{ detailData.userName }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="收货人电话">{{ detailData.userPhone }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="收货地址">{{ detailData.userAddress }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="实收金额">{{ detailData.payPrice }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="支付方式">
|
|
|
+ <dict-tag :options="payTypeOptions" :value="detailData.payType" />
|
|
|
+ </el-descriptions-item>
|
|
|
+ <el-descriptions-item label="订单状态">
|
|
|
+ <dict-tag :options="statusOptions" :value="detailData.status" />
|
|
|
+ </el-descriptions-item>
|
|
|
+ <el-descriptions-item label="创建时间">{{ detailData.externalCreateTime }}</el-descriptions-item>
|
|
|
+ </el-descriptions>
|
|
|
+ <el-divider content-position="left">商品信息</el-divider>
|
|
|
+ <el-table border :data="detailData.productList || []">
|
|
|
+ <el-table-column label="商品名称" align="center" prop="productName" />
|
|
|
+ <el-table-column label="商品价格" align="center" prop="price" />
|
|
|
+ <el-table-column label="数量" align="center" prop="num" />
|
|
|
+ <el-table-column label="小计" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ (scope.row.price * scope.row.num).toFixed(2) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog :title="user.title" v-if="user.open" :visible.sync="user.open" width="500px" append-to-body>
|
|
|
+ <add-external-user @addUser="addUser" />
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <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" />
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { listExternalOrder, createExternalOrder, getExternalOrder, exportExternalOrder } from "@/api/store/externalOrder";
|
|
|
+import { getCompanyList } from "@/api/company/company";
|
|
|
+import { listUserAddress } from "@/api/store/userAddress";
|
|
|
+import { listStoreProduct } from "@/api/store/storeProduct";
|
|
|
+import addExternalUserAddress from "@/views/store/components/addExternalUserAddress.vue";
|
|
|
+import addExternalUser from "@/views/store/components/addExternalUser.vue";
|
|
|
+import request from '@/utils/request';
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "ExternalOrder",
|
|
|
+ components: { addExternalUserAddress, addExternalUser },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ activeStatus: "all",
|
|
|
+ loading: true,
|
|
|
+ exportLoading: false,
|
|
|
+ showSearch: true,
|
|
|
+ total: 0,
|
|
|
+ orderList: [],
|
|
|
+ companyList: [],
|
|
|
+ createTime: null,
|
|
|
+ open: false,
|
|
|
+ title: "",
|
|
|
+ detailOpen: false,
|
|
|
+ detailData: {},
|
|
|
+ phone: null,
|
|
|
+ userloading: false,
|
|
|
+ users: [],
|
|
|
+ address: [],
|
|
|
+ addressloading: false,
|
|
|
+ productJson: [],
|
|
|
+ productNameSearch: null,
|
|
|
+ user: {
|
|
|
+ open: false,
|
|
|
+ title: "创建外部订单用户"
|
|
|
+ },
|
|
|
+ userAddress: {
|
|
|
+ open: false,
|
|
|
+ title: "创建收货地址"
|
|
|
+ },
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ orderCode: null,
|
|
|
+ userId: null,
|
|
|
+ userName: null,
|
|
|
+ userPhone: null,
|
|
|
+ isPay: null,
|
|
|
+ companyId: null,
|
|
|
+ status: null,
|
|
|
+ sTime: null,
|
|
|
+ eTime: null
|
|
|
+ },
|
|
|
+ form: {
|
|
|
+ addressId: null,
|
|
|
+ userId: null,
|
|
|
+ payType: null,
|
|
|
+ payMoney: null,
|
|
|
+ productIds: []
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ addressId: [{ required: true, message: "请选择收货地址", trigger: "change" }],
|
|
|
+ payType: [{ required: true, message: "支付方式不能为空", trigger: "change" }],
|
|
|
+ payMoney: [{ required: true, message: "支付金额不能为空", trigger: "blur" }]
|
|
|
+ },
|
|
|
+ payTypeOptions: [],
|
|
|
+ statusOptions: [],
|
|
|
+ userStatusOptions: []
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getList();
|
|
|
+ this.getCompanyList();
|
|
|
+ this.getDicts("sys_package_pay_type").then(response => {
|
|
|
+ this.payTypeOptions = response.data;
|
|
|
+ });
|
|
|
+ this.getDicts("sys_order_status").then(response => {
|
|
|
+ this.statusOptions = response.data;
|
|
|
+ });
|
|
|
+ this.getDicts("sys_company_status").then(response => {
|
|
|
+ this.userStatusOptions = response.data;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handleTabClick(tab) {
|
|
|
+ if (tab.name === "all") {
|
|
|
+ this.queryParams.status = null;
|
|
|
+ } else {
|
|
|
+ this.queryParams.status = tab.name;
|
|
|
+ }
|
|
|
+ this.handleQuery();
|
|
|
+ },
|
|
|
+ getList() {
|
|
|
+ this.loading = true;
|
|
|
+ listExternalOrder(this.queryParams).then(response => {
|
|
|
+ this.orderList = response.rows;
|
|
|
+ this.total = response.total;
|
|
|
+ this.loading = false;
|
|
|
+ }).catch(() => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getCompanyList() {
|
|
|
+ getCompanyList().then(response => {
|
|
|
+ this.companyList = response.data || [];
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleCreateTimeChange(val) {
|
|
|
+ if (val) {
|
|
|
+ this.queryParams.sTime = val[0];
|
|
|
+ this.queryParams.eTime = val[1];
|
|
|
+ } else {
|
|
|
+ this.queryParams.sTime = null;
|
|
|
+ this.queryParams.eTime = null;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleQuery() {
|
|
|
+ this.queryParams.pageNum = 1;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ resetQuery() {
|
|
|
+ this.resetForm("queryForm");
|
|
|
+ this.createTime = null;
|
|
|
+ this.queryParams.sTime = null;
|
|
|
+ this.queryParams.eTime = null;
|
|
|
+ this.handleQuery();
|
|
|
+ },
|
|
|
+ handleAdd() {
|
|
|
+ this.reset();
|
|
|
+ this.phone = null;
|
|
|
+ this.users = [];
|
|
|
+ this.address = [];
|
|
|
+ this.productJson = [];
|
|
|
+ this.productNameSearch = null;
|
|
|
+ this.open = true;
|
|
|
+ this.title = "创建外部订单";
|
|
|
+ },
|
|
|
+ reset() {
|
|
|
+ this.form = {
|
|
|
+ addressId: null,
|
|
|
+ userId: null,
|
|
|
+ payType: null,
|
|
|
+ payMoney: null,
|
|
|
+ productIds: []
|
|
|
+ };
|
|
|
+ this.resetForm("form");
|
|
|
+ },
|
|
|
+ cancel() {
|
|
|
+ this.open = false;
|
|
|
+ this.reset();
|
|
|
+ },
|
|
|
+ searchUser() {
|
|
|
+ if (this.phone == null || this.phone == "") {
|
|
|
+ this.msgError("请输入会员手机号");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var data = { phone: this.phone };
|
|
|
+ this.userloading = true;
|
|
|
+ this.users = [];
|
|
|
+ this.address = [];
|
|
|
+ request({
|
|
|
+ url: '/store/user/externalList',
|
|
|
+ method: 'get',
|
|
|
+ params: 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);
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ this.userloading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleAddUser() {
|
|
|
+ this.user.open = true;
|
|
|
+ },
|
|
|
+ addUser(phone) {
|
|
|
+ this.user.open = false;
|
|
|
+ this.phone = phone;
|
|
|
+ this.searchUser();
|
|
|
+ },
|
|
|
+ handleAddUserAddress() {
|
|
|
+ if (this.form.userId == null) {
|
|
|
+ this.msgError("请选择会员");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.userAddress.open = true;
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$refs.addExternalUserAddress.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() {
|
|
|
+ var data = {
|
|
|
+ productName: this.productNameSearch,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 100
|
|
|
+ };
|
|
|
+ listStoreProduct(data).then(response => {
|
|
|
+ this.productJson = response.rows;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleProductSelectionChange(selection) {
|
|
|
+ this.form.productIds = selection.map(item => item.productId);
|
|
|
+ },
|
|
|
+ submitForm() {
|
|
|
+ this.$refs["form"].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ if (this.form.userId == null) {
|
|
|
+ this.msgError("请选择会员");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.form.productIds.length === 0) {
|
|
|
+ this.msgError("请选择至少一个商品");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var submitData = {
|
|
|
+ addressId: this.form.addressId,
|
|
|
+ userId: this.form.userId,
|
|
|
+ payType: this.form.payType,
|
|
|
+ payMoney: parseFloat(this.form.payMoney) || 0,
|
|
|
+ productIds: this.form.productIds
|
|
|
+ };
|
|
|
+ createExternalOrder(submitData).then(response => {
|
|
|
+ if (response.code === 200) {
|
|
|
+ this.msgSuccess("创建成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleView(row) {
|
|
|
+ getExternalOrder(row.orderId).then(response => {
|
|
|
+ this.detailData = response.data;
|
|
|
+ this.detailOpen = true;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleExport() {
|
|
|
+ const queryParams = this.queryParams;
|
|
|
+ this.$confirm("是否确认导出外部订单数据项?", "警告", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(() => {
|
|
|
+ this.exportLoading = true;
|
|
|
+ return exportExternalOrder(queryParams);
|
|
|
+ }).then(response => {
|
|
|
+ this.download(response.msg);
|
|
|
+ this.exportLoading = false;
|
|
|
+ }).catch(() => {});
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|