Explorar el Código

add:积分订单

ct hace 2 semanas
padre
commit
fef15e2d8c

+ 97 - 0
src/api/store/integralOrder.js

@@ -0,0 +1,97 @@
+import request from '@/utils/request'
+
+// 查询积分商品订单列表
+export function listIntegralOrder(query) {
+  return request({
+    url: '/his/integralOrder/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询积分商品订单详细
+export function getIntegralOrder(orderId) {
+  return request({
+    url: '/his/integralOrder/' + orderId,
+    method: 'get'
+  })
+}
+export function getExpress(orderId) {
+  return request({
+    url: '/his/integralOrder/getExpress/' + orderId,
+    method: 'get'
+  })
+}
+
+
+
+
+
+
+
+
+// 导出积分商品订单
+export function exportIntegralOrder(query) {
+  return request({
+    url: '/his/integralOrder/export',
+    method: 'get',
+    params: query
+  })
+}
+
+
+// 查询收货人电话
+export function getOrderUserPhone(orderId) {
+  return request({
+    url: '/his/integralOrder/queryPhone/' + orderId,
+    method: 'get'
+  })
+}
+
+//取消订单
+export function cancelOrder(orderCode) {
+  return request({
+    url: '/his/integralOrder/cancelOrder',
+    method: 'post',
+    data: {orderCode}
+  })
+}
+//申请退款
+export function mandatoryRefunds(orderCode) {
+  return request({
+    url: '/his/integralOrder/mandatoryRefunds',
+    method: 'post',
+    data: {orderCode}
+  })
+}
+
+// 确认收货
+export function finishOrder(orderCode) {
+  return request({
+    url: '/his/integralOrder/finishOrder/' + orderCode,
+    method: 'get'
+  })
+}
+
+//获取城市
+export function getCitys(){
+  return request({
+    url: '/his/city/getCitys',
+    method: 'get'
+  })
+}
+//获取模版
+export function getIntegralTemplate(){
+  return request({
+    url: '/his/integralOrder/importUpdateOrderTemplate',
+    method: 'get'
+  })
+}
+
+// 获取订单操作记录
+export function getOrderLogs(orderId) {
+  return request({
+    url: '/his/integralOrder/order/' + orderId,
+    method: 'get'
+  })
+}

+ 658 - 0
src/views/store/integralOrder/index.vue

@@ -0,0 +1,658 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="订单编号" prop="orderCodes" >
+        <div class="tag-input-container">
+          <!-- 标签显示区域 -->
+          <div class="tags-wrapper" @click="focusInput">
+            <!-- 已添加的订单号标签 -->
+            <el-tag
+              v-for="(code, index) in queryParams.orderCodes"
+              :key="index"
+              closable
+              size="small"
+              @close="removeOrderCode(index)"
+              class="order-tag"
+              :class="{ 'tag-error': false }"
+            >
+              {{ code }}
+            </el-tag>
+
+            <!-- 输入框 -->
+            <el-input
+              ref="tagInput"
+              v-model="currentInput"
+              v-show="inputVisible || queryParams.orderCodes.length === 0"
+              :placeholder="queryParams.orderCodes.length === 0 ? '请输入订单号,按回车或逗号分隔' : '继续输入...'"
+              size="small"
+              class="tag-input"
+              @keydown.native="handleKeyDown"
+              @keyup.native="handleKeyUp"
+              @blur="handleInputConfirm"
+              @focus="inputVisible = true"
+              clearable
+            />
+
+            <!-- 添加按钮(当没有输入时显示) -->
+            <el-button
+              v-if="!inputVisible && queryParams.orderCodes.length > 0"
+              class="button-new-tag"
+              size="small"
+              @click="showInput"
+              icon="el-icon-plus"
+              type="text"
+            >
+              添加订单号
+            </el-button>
+          </div>
+
+          <!-- 输入提示 -->
+          <div class="input-tips">
+            <span class="tip-text">
+              支持:回车、逗号、空格分隔 |
+              已添加 {{ queryParams.orderCodes.length }} 个订单号
+              <span v-if="maxOrderCodes > 0"> (最多{{ maxOrderCodes }}个)</span>
+            </span>
+          </div>
+        </div>
+      </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-date-picker>
+              </el-form-item>
+<!--      <el-form-item label="销售公司" prop="companyId">-->
+<!--        <el-select v-model="queryParams.companyId" placeholder="销售公司"  size="small" @change="getAllUserlist(queryParams.companyId)" clearable>-->
+<!--          <el-option-->
+<!--            v-for="dict in qwCompanyList"-->
+<!--            :key="dict.companyId"-->
+<!--            :label="dict.companyName"-->
+<!--            :value="dict.companyId"-->
+<!--          />-->
+<!--        </el-select>-->
+<!--      </el-form-item>-->
+<!--      <el-form-item label="销售账号" prop="userId">-->
+<!--        <el-select v-model="queryParams.companyUserId" placeholder="销售账号"  size="small" clearable>-->
+<!--          <el-option-->
+<!--            v-for="dict in companyUserNameList"-->
+<!--            :key="dict.userId"-->
+<!--            :label="dict.userName"-->
+<!--            :value="dict.userId"-->
+<!--          />-->
+<!--        </el-select>-->
+<!--      </el-form-item>-->
+<!--      <el-form-item label="企微微信" prop="companyUserName">-->
+<!--        <el-select v-model="queryParams.qwUserId" placeholder="企微微信"  size="small" clearable>-->
+<!--          <el-option-->
+<!--            v-for="dict in qwUserList"-->
+<!--            :key="dict.id"-->
+<!--            :label="dict.qwUserName"-->
+<!--            :value="dict.id"-->
+<!--          />-->
+<!--        </el-select>-->
+<!--      </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-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" :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>{{ scope.row.goodsName }}</span>
+            <el-image
+              v-if="scope.row.goodsImage"
+              :src="scope.row.goodsImage"
+              style="width: 40px; height: 40px; margin-left: 8px;"
+              fit="cover"
+              :preview-src-list="[scope.row.goodsImage]"
+            />
+          </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="销售公司ID" align="center" prop="companyId" width="180"/>
+      <el-table-column label="销售ID" align="center" prop="companyUserId" width="180"/>
+      <el-table-column label="企业微信ID" align="center" prop="qwUserId" 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>
+<!--          <el-button-->
+<!--              size="mini"-->
+<!--              type="text"-->
+<!--              @click="cancelOrder(scope.row.orderCode)"-->
+<!--              v-if="scope.row.status === '1'"-->
+<!--            >取消订单-->
+<!--            </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="integralOrderDetails" />
+    </el-drawer>
+
+  </div>
+</template>
+
+<script>
+import {importTemplate,listIntegralOrder,getIntegralTemplate, getIntegralOrder, delIntegralOrder, addIntegralOrder, updateIntegralOrder, exportIntegralOrder,cancelOrder } from "@/api/store/integralOrder";
+import integralOrderDetails from '@/views/store/integralOrder/integralOrderDetails.vue';
+import { getToken } from "@/utils/auth";
+import {getCompanyList} from "@/api/company/company";
+import {getAllUserlist} from "@/api/company/companyUser";
+import {getQwUserInfo} from "@/api/qw/qwUser";
+
+export default {
+  name: "IntegralOrder",
+  components: { integralOrderDetails },
+  data() {
+    return {
+      show:{
+              open:false,
+            },
+      upload: {
+        // 是否显示弹出层
+        open: false,
+        // 弹出层标题
+        title: "",
+        // 是否禁用上传
+        isUploading: false,
+        // 是否更新已经存在的用户数据
+        updateSupport: 0,
+        // 设置上传的请求头部
+        headers: { Authorization: "Bearer " + getToken() },
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API + "/his/integralOrder/importData"
+      },
+      // 遮罩层
+      loading: true,
+      actName:"10",
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 积分商品订单表格数据
+      integralOrderList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 1:待发货;2:待收货;3:已完成字典
+      statusOptions: [],
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        orderCode: null,
+        orderCodes: [], // 添加订单号数组
+        userName: null,
+        userPhone: null,
+        integral: null,
+        status: null,
+        deliverySn: null,
+        createTime: null,
+        sTime:null,
+        eTime:null,
+        companyUserId:null,
+        qwUserId:null,
+        companyId:null,
+
+      },
+      // 最大订单号数量限制
+      maxOrderCodes: {
+        type: Number,
+        default: 50
+      },
+      // 输入框是否可见
+      inputVisible: false,
+      // 当前输入值
+      currentInput: '',
+       createTime:null,
+      qwCompanyList:[],
+      companyUserNameList:[],
+      qwUserList:[],
+      // 表单参数
+      form: {},
+
+    };
+  },
+  created() {
+    this.getList();
+    this.getDicts("sys_integral_order_status").then(response => {
+      this.statusOptions = response.data;
+    });
+
+
+    //获取企业
+    getCompanyList().then(response => {
+      this.qwCompanyList = response.data;
+    });
+  },
+  methods: {
+    handledetails(row){
+      this.show.open=true;
+      setTimeout(() => {
+        this.$refs.integralOrderDetails.getDetails(row.orderId)
+      }, 1);
+    },
+     //取消订单
+     cancelOrder(orderCode){
+      this.$confirm('确定取消此订单?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        console.log("orderCode",orderCode)
+        cancelOrder(orderCode).then(()=>{
+          this.$message({
+            type: 'success',
+            message: '取消成功!'
+          });
+          this.getList();
+        })
+      }).catch(() => {
+      });
+    },
+    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;
+          }
+
+        },
+
+    /** 查询积分商品订单列表 */
+    getList() {
+      this.loading = true;
+
+      // 直接传递订单编号数组给后端
+      listIntegralOrder(this.queryParams).then(response => {
+        // 解析itemJson字段,提取goodsName和图片
+        const processedData = response.rows.map(item => {
+          let goodsName = '';
+          let goodsImage = '';
+          try {
+            if (item.itemJson) {
+              const itemData = JSON.parse(item.itemJson);
+              // 如果itemJson是数组格式,取第一个商品的名称和图片
+              if (Array.isArray(itemData) && itemData.length > 0) {
+                goodsName = itemData[0].goodsName || '';
+                // 提取图片,优先使用imgUrl,如果没有则使用images的第一张
+                if (itemData[0].imgUrl) {
+                  goodsImage = itemData[0].imgUrl;
+                } else if (itemData[0].images && itemData[0].images.split(',').length > 0) {
+                  goodsImage = itemData[0].images.split(',')[0];
+                }
+              }
+              // 如果itemJson是对象格式,直接取goodsName和图片
+              else if (itemData.goodsName) {
+                goodsName = itemData.goodsName;
+                // 提取图片,优先使用imgUrl,如果没有则使用images的第一张
+                if (itemData.imgUrl) {
+                  goodsImage = itemData.imgUrl;
+                } else if (itemData.images && itemData.images.split(',').length > 0) {
+                  goodsImage = itemData.images.split(',')[0];
+                }
+              }
+            }
+          } catch (error) {
+            console.error('解析itemJson失败:', error);
+            goodsName = '';
+            goodsImage = '';
+          }
+
+          return {
+            ...item,
+            goodsName: goodsName,
+            goodsImage: goodsImage
+          };
+        });
+
+        this.integralOrderList = processedData;
+        this.total = response.total;
+        this.loading = false;
+      }).catch(error => {
+        console.error('查询订单列表失败:', error);
+        this.loading = false;
+        this.$message.error('查询订单列表失败');
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        orderId: null,
+        orderCode: null,
+        userId: null,
+        userName: null,
+        userPhone: null,
+        userAddress: null,
+        itemJson: null,
+        integral: null,
+        status: null,
+        deliveryCode: null,
+        deliveryName: null,
+        deliverySn: null,
+        deliveryTime: null,
+        createTime: null,
+        remark: null,
+        sTime:null,
+        eTime:null,
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.createTime=null;
+      this.queryParams.sTime=null;
+      this.queryParams.eTime=null;
+      this.queryParams.qwUserId=null;
+      this.queryParams.companyId=null;
+      this.queryParams.companyUserId=null;
+
+      // 清除订单号标签
+      this.queryParams.orderCodes = [];
+      this.currentInput = '';
+      this.inputVisible = false;
+
+      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();
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const orderIds = row.orderId || this.ids;
+      this.$confirm('是否确认删除积分商品订单编号为"' + orderIds + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delIntegralOrder(orderIds);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(() => {});
+    },
+
+    //选择企业后触发
+    getAllUserlist(companyId){
+      if(companyId){
+        getAllUserlist({companyId}).then(response => {
+          this.companyUserNameList=response.data;
+        });
+        //企业微信
+        getQwUserInfo({companyId}).then(response => {
+          this.qwUserList=response.data;
+        })
+      }
+    },
+
+    // 处理键盘按下事件
+    handleKeyDown(event) {
+      const { key, target } = event
+
+      // 处理退格键删除标签
+      if (key === 'Backspace' && !target.value && this.queryParams.orderCodes.length > 0) {
+        event.preventDefault()
+        this.removeOrderCode(this.queryParams.orderCodes.length - 1)
+      }
+
+      // 处理分隔符
+      if ([',', ',', ' ', 'Enter'].includes(key)) {
+        event.preventDefault()
+        this.handleInputConfirm()
+      }
+    },
+
+    // 处理键盘抬起事件(实时分割输入)
+    handleKeyUp(event) {
+      const value = event.target.value
+
+      // 检查是否包含分隔符
+      if (/[,,\s]/.test(value)) {
+        this.handleInputConfirm()
+      }
+    },
+
+    // 确认输入
+    handleInputConfirm() {
+      const inputValue = this.currentInput.trim()
+
+      if (inputValue) {
+        // 分割多个订单号
+        const codes = inputValue.split(/[,,\s]+/).filter(code => code.trim())
+
+        codes.forEach(code => {
+          this.addOrderCode(code.trim())
+        })
+      }
+
+      this.currentInput = ''
+    },
+
+    // 添加订单号
+    addOrderCode(code) {
+      if (!code) return
+
+      // 检查数量限制
+      if (this.maxOrderCodes > 0 && this.queryParams.orderCodes.length >= this.maxOrderCodes) {
+        this.$message.warning(`最多只能添加 ${this.maxOrderCodes} 个订单号`)
+        return
+      }
+
+      // 检查重复
+      if (this.queryParams.orderCodes.includes(code)) {
+        this.$message.warning(`订单号 "${code}" 已存在`)
+        return
+      }
+
+      // 添加到列表
+      this.queryParams.orderCodes.push(code)
+    },
+
+    // 删除订单号
+    removeOrderCode(index) {
+      this.queryParams.orderCodes.splice(index, 1)
+    },
+
+    // 显示输入框
+    showInput() {
+      this.inputVisible = true
+      this.$nextTick(() => {
+        this.$refs.tagInput.focus()
+      })
+    },
+    // 聚焦输入框
+    focusInput() {
+      if (!this.inputVisible) {
+        this.showInput()
+      }
+    },
+  }
+};
+</script>
+
+<style scoped>
+.tag-input-container {
+  min-width: 445px;
+}
+
+.tags-wrapper {
+  min-height: 32px;
+  padding: 4px 8px;
+  border: 1px solid #dcdfe6;
+  border-radius: 4px;
+  cursor: text;
+  display: flex;
+  flex-wrap: wrap;
+  align-items: center;
+  gap: 4px;
+  transition: border-color 0.2s;
+}
+
+.tags-wrapper:hover {
+  border-color: #c0c4cc;
+}
+
+.tags-wrapper:focus-within {
+  border-color: #409eff;
+  box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
+}
+
+.order-tag {
+  margin: 2px;
+  flex-shrink: 0;
+}
+
+.tag-error {
+  background-color: #fef0f0;
+  border-color: #fbc4c4;
+  color: #f56c6c;
+}
+
+.tag-input {
+  border: none;
+  outline: none;
+  flex: 1;
+  min-width: 120px;
+}
+
+.tag-input >>> .el-input__inner {
+  border: none;
+  padding: 0;
+  height: 24px;
+  line-height: 24px;
+}
+
+.button-new-tag {
+  height: 24px;
+  line-height: 22px;
+  padding: 0 8px;
+  margin: 2px;
+}
+
+.input-tips {
+  margin-top: 4px;
+  font-size: 12px;
+  color: #909399;
+}
+
+.tip-text {
+  display: flex;
+  align-items: center;
+  gap: 8px;
+}
+</style>

+ 556 - 0
src/views/store/integralOrder/integralOrderDetails.vue

@@ -0,0 +1,556 @@
+<template>
+  <div style="background-color: #f0f2f5; padding-bottom: 20px; min-height: 100%; ">
+    <div style="padding: 20px; background-color: #fff;">
+      积分订单详情
+    </div>
+    <div class="contentx" v-if="item != null">
+      <div class="desct"> 积分订单信息</div>
+      <div class="order-status" v-if="item != null && item.status != 5">
+        <el-steps :active="getStepActive(item.status)" align-center finish-status="success">
+          <el-step title="待支付"></el-step>
+          <el-step title="待发货"></el-step>
+          <el-step title="待收货"></el-step>
+          <el-step title="已完成"></el-step>
+        </el-steps>
+      </div>
+      <el-card shadow="never" style="margin-top: 15px">
+        <div class="operate-container" v-if="item != null">
+          <span style="margin-left: 20px" class="color-danger">订单状态:
+            <el-tag prop="status" v-for="(ite, index) in statusOptions" v-if="item.status == ite.dictValue">{{
+              ite.dictLabel }}</el-tag>
+          </span>
+          <div class="operate-button-container" v-if="item.deliverySn != null"
+            v-hasPermi="['his:integralOrder:express']">
+            <el-button size="mini" @click="showExpress()">查看物流</el-button>
+          </div>
+        </div>
+        <div class="desct">
+          基本信息
+        </div>
+        <el-descriptions title="" :column="3" border>
+          <el-descriptions-item label="订单编号"><span v-if="item != null">{{ item.orderCode
+              }}</span></el-descriptions-item>
+          <el-descriptions-item label="会员ID"><span v-if="item != null">{{ item.userId }}</span></el-descriptions-item>
+          <el-descriptions-item label="会员"><span v-if="item.nickName != null">{{ item.nickName }}({{ item.phone
+              }})</span></el-descriptions-item>
+          <el-descriptions-item label="用户名称"><span v-if="item != null">{{ item.userName }}</span></el-descriptions-item>
+          <el-descriptions-item label="用户电话"><span v-if="item != null">{{ item.userPhone }}</span>
+            <el-button icon="el-icon-search" size="mini" @click="handlePhone()" style="margin-left: 20px;" circle
+              v-hasPermi="['his:integralOrder:queryPhone']"></el-button>
+          </el-descriptions-item>
+          <el-descriptions-item label="用户地址"><span v-if="item != null">{{ item.userAddress
+              }}</span></el-descriptions-item>
+          <el-descriptions-item label="支付积分"><span v-if="item != null">{{ item.integral }}</span></el-descriptions-item>
+          <el-descriptions-item label="状态"><span v-if="item != null"> <dict-tag :options="statusOptions"
+                :value="item.status" /></span></el-descriptions-item>
+          <el-descriptions-item label="快递公司编号"><span v-if="item != null">{{ item.deliveryCode
+              }}</span></el-descriptions-item>
+          <el-descriptions-item label="快递名称"><span v-if="item != null">{{ item.deliveryName
+              }}</span></el-descriptions-item>
+          <el-descriptions-item label="快递单号"><span v-if="item != null">{{ item.deliverySn
+              }}</span></el-descriptions-item>
+          <!-- <el-descriptions-item label="物流状态"><span v-if="item != null">{{ item.deliveryType
+              }}</span></el-descriptions-item> -->
+          <el-descriptions-item label="物流状态" ><dict-tag :options="deliveryStatusOptions" :value="item.deliveryStatus"/></el-descriptions-item>
+
+          <el-descriptions-item label="物流跟踪状态" ><span v-if="item!=null"><dict-tag :options="deliveryTypeOptions" :value="item.deliveryType"/> </span></el-descriptions-item>
+
+          <el-descriptions-item label="发货时间"><span v-if="item != null">{{ item.deliveryTime
+              }}</span></el-descriptions-item>
+          <el-descriptions-item label="提交时间"><span v-if="item != null">{{ item.createTime
+              }}</span></el-descriptions-item>
+        </el-descriptions>
+      </el-card>
+
+    </div>
+    <div class="contentx" v-if="item != null" style="padding-bottom: 70px;">
+      <div class="desct">
+        商品信息
+      </div>
+      <el-table border v-if="prod != null" :data="prod" size="small" style="margin-top: 20px">
+        <el-table-column label="商品图片" align="center">
+          <template slot-scope="scope">
+            <img :src="scope.row.imgUrl" style="height: 80px">
+          </template>
+        </el-table-column>
+        <el-table-column label="商品名称" align="center">
+          <template slot-scope="scope">
+            <p>{{ scope.row.goodsName }}</p>
+          </template>
+        </el-table-column>
+        <el-table-column label="积分" align="center">
+          <template slot-scope="scope">
+            <p>¥{{ scope.row.integral }}</p>
+          </template>
+        </el-table-column>
+        <el-table-column label="金额" align="center">
+          <template slot-scope="scope">
+            <p>¥{{ scope.row.cash || 0 }}</p>
+          </template>
+        </el-table-column>
+
+      </el-table>
+    </div>
+
+    <!-- 操作记录 -->
+    <div class="contentx" v-if="item != null" style="padding-bottom: 70px;">
+      <div class="desct">
+        操作记录
+      </div>
+      <el-table :data="orderLogs" border style="width: 100%; margin-top: 20px;" v-loading="logsLoading">
+        <!-- <el-table-column prop="changeType" label="操作类型" align="center" width="120">
+        </el-table-column> -->
+        <el-table-column prop="changeTime" label="操作时间" align="center" width="180">
+          <template slot-scope="scope">
+            {{ parseTime(scope.row.changeTime) }}
+          </template>
+        </el-table-column>
+        <el-table-column prop="changeMessage" label="操作备注" align="center">
+        </el-table-column>
+        <!-- <el-table-column prop="operator" label="操作员" align="center" width="120">
+        </el-table-column> -->
+
+      </el-table>
+    </div>
+
+    <el-dialog :title="expressDialog.title" :visible.sync="expressDialog.open" width="600px" append-to-body>
+      <div style="margin-bottom: 10px; text-align: right;">
+        <el-button type="primary" size="small" @click="syncExpressInfo" :loading="syncLoading">同步物流信息</el-button>
+      </div>
+      <el-table style="margin-top: 20px;width: 100%" ref="orderHistoryTable" :data="traces" border v-loading="tableLoading">
+        <el-table-column label="操作时间" width="160" align="center">
+          <template slot-scope="scope">
+            {{ scope.row.AcceptTime }}
+          </template>
+        </el-table-column>
+        <el-table-column label="位置" align="center">
+          <template slot-scope="scope">
+            {{ scope.row.Location }}
+          </template>
+        </el-table-column>
+        <el-table-column label="描述" align="center">
+          <template slot-scope="scope">
+            {{ scope.row.AcceptStation }}
+          </template>
+        </el-table-column>
+      </el-table>
+    </el-dialog>
+
+  </div>
+</template>
+
+<script>
+import { getExpress,mandatoryRefunds,getCitys,finishOrder, listIntegralOrder, sendgoods, getIntegralOrder, delIntegralOrder, addIntegralOrder, updateIntegralOrder, exportIntegralOrder, getOrderUserPhone, getOrderLogs } from "@/api/store/integralOrder";
+export default {
+  name: "integralOrderDetails",
+  data() {
+    return {
+      deliveryStatusOptions:[],
+      selectedExpress: null,
+      expressDialog: {
+        title: "物流信息",
+        open: false,
+      },
+      editOrder: {
+        title: "修改订单",
+        open: false,
+      },
+      editForm: {
+        orderId: null,
+        status: null,
+        userAddress: null, // 这个字段将存储拼接后的完整地址
+        remark: "",
+        loginAccount: null,
+        // 新增快递相关字段
+        deliveryName: null,
+        deliveryCode: null,
+        deliverySn: null
+      },
+      editRules: {
+        deliveryName: [
+          { required: false, message: '请输入快递名称', trigger: 'blur' }
+        ],
+        deliveryCode: [
+          { required: false, message: '请输入快递公司编号', trigger: 'blur' }
+        ],
+        deliverySn: [
+          { required: false, message: '请输入快递单号', trigger: 'blur' }
+        ]
+      },
+      item: null,
+      express: null,
+      traces: [],
+      rules: {
+        deliveryCode: [
+          { required: true, message: '请输入快递公司编号', trigger: 'blur' }
+        ],
+        deliveryName: [
+          { required: true, message: '请输入快递名称', trigger: 'blur' }
+        ],
+        deliverySn: [
+          { required: true, message: '请输入快递单号', trigger: 'blur' }
+        ],
+        selectedAccount: [  // 添加这一项
+          { required: true, message: '请选择代服账号', trigger: 'change' }
+        ]
+      },
+      sendVisible: false,
+      form: {
+        deliveryCode: null,
+        deliveryName: null,
+        deliverySn: null,
+        orderId: null,
+        loginAccount: null  // 在 form 中也添加这个字段
+      },
+      tableData: [], // 清空模拟数据,改为空数组
+      selectedRow: null,
+      editSelectedRow: null, // 修改订单弹窗选中的行
+      queryParams: { // 查询参数
+        pageNum: 1,
+        pageSize: 10
+      },
+      total: 0, // 总条数,
+      expressOptions: [], // 物流产品字典
+      editSelectedExpress: null,
+      // 地址选择相关数据
+      provinceOptions: [], // 省列表
+      cityOptions: [], // 市列表
+      districtOptions: [], // 区列表
+      selectedProvince: null, // 选中的省
+      selectedCity: null, // 选中的市
+      selectedDistrict: null, // 选中的区
+      detailAddress: '', // 详细地址
+      deliveryTypeOptions:[],
+      // 操作记录相关数据
+      orderLogs: [], // 订单操作记录
+      logsLoading: false, // 操作记录加载状态
+      syncLoading: false, // 同步物流信息按钮加载状态
+      tableLoading: false // 物流信息表格加载状态
+    }
+  },
+  created() {
+    this.getDicts("sys_integral_order_status").then(response => {
+      this.statusOptions = response.data;
+    });
+    this.getDicts("df_account_express").then(response => {
+      this.expressOptions = response.data;
+    });
+    this.getDicts("sys_store_order_delivery_status").then(response => {
+          this.deliveryStatusOptions = response.data;
+    });
+    this.getDicts("sys_delivery_type").then(response => {
+              this.deliveryTypeOptions = response.data;
+            });
+  },
+  watch: {
+    selectedExpress(newVal) {
+      console.log('选中的快递:', newVal); // 调试用
+      if (newVal && newVal.name && newVal.code) {
+        this.form.deliveryName = newVal.name;
+        this.form.deliveryCode = newVal.code;
+      } else {
+        this.form.deliveryName = '';
+        this.form.deliveryCode = '';
+      }
+    },
+    // 新增:修改订单弹窗的快递选择监听
+    editSelectedExpress(newVal) {
+      console.log('修改订单弹窗选中的快递:', newVal);
+      if (newVal && newVal.name && newVal.code) {
+        this.editForm.deliveryName = newVal.name;
+        this.editForm.deliveryCode = newVal.code;
+      } else {
+        this.editForm.deliveryName = '';
+        this.editForm.deliveryCode = '';
+      }
+    },
+    'editOrder.open': function (newVal) {
+      if (!newVal) {
+        // 修改订单弹窗关闭时清理选择状态
+        this.editSelectedRow = null;
+        if (this.$refs.editAccountTable) {
+          this.$refs.editAccountTable.setCurrentRow();
+        }
+      }
+    },
+    'expressDialog.open': function (newVal) {
+      if (!newVal) {
+        // 查看物流弹窗关闭时清理数据
+        this.express = null;
+        this.traces = [];
+      }
+    },
+  },
+  methods: {
+    getStepActive(status) {
+      const statusMap = {
+        4: 1, // 待支付 -> 激活第1步(显示到待支付)
+        1: 2, // 待发货 -> 激活第2步(显示到待发货)
+        2: 3, // 待收货 -> 激活第3步(显示到待收货)
+        3: 4  // 已完成 -> 激活第4步(全部完成)
+      };
+      return statusMap[status] || 0;
+    },
+    handlePhone() {
+      const orderId = this.item.orderId;
+      getOrderUserPhone(orderId).then(response => {
+        this.item.userPhone = response.userPhone;
+      })
+    },
+
+
+
+
+
+    showSend() {
+      // 重置表单和选择状态
+      this.form = {
+        deliveryCode: null,
+        deliveryName: null,
+        deliverySn: null,
+        orderId: null,
+        loginAccount: null
+      };
+      this.selectedExpress = null;
+      this.selectedRow = null;
+
+      this.sendVisible = true;
+    },
+    showExpress() {
+      this.expressDialog.open = true;
+      this.loadExpressInfo();
+    },
+    // 加载物流信息
+    loadExpressInfo() {
+      this.tableLoading = true;
+      getExpress(this.item.orderId).then(response => {
+        this.express = response.data;
+        if (this.express != null && this.express.Traces != null) {
+          this.traces = this.express.Traces
+        } else {
+          this.traces = [];
+        }
+        this.tableLoading = false;
+      }).catch(error => {
+        this.traces = [];
+        this.tableLoading = false;
+        console.error('获取物流信息失败:', error);
+      });
+    },
+    // 同步物流信息
+    syncExpressInfo() {
+      this.syncLoading = true;
+      this.loadExpressInfo();
+      this.syncLoading = false;
+    },
+    sendGoods() {
+      // 手动验证所有必填字段
+      if (!this.selectedRow) {
+        this.msgError('请选择代服账号');
+        return;
+      }
+
+      if (!this.form.deliveryName || !this.form.deliveryCode) {
+        this.msgError('请选择快递公司');
+        return;
+      }
+
+      if (!this.form.deliverySn) {
+        this.msgError('请输入快递单号');
+        return;
+      }
+
+      // 所有验证通过,直接发送
+      this.form.orderId = this.item.orderId;
+      sendgoods(this.form).then(response => {
+        this.msgSuccess("发货成功");
+        this.sendVisible = false;
+        getIntegralOrder(this.item.orderId).then(response => {
+          this.item = response.data;
+          this.$parent.$parent.getList();
+        });
+
+        this.form = {
+          deliveryCode: null,
+          deliveryName: null,
+          deliverySn: null,
+          orderId: null,
+          loginAccount: null
+        };
+        this.selectedRow = null;
+      });
+    },
+    getDetails(orderId) {
+      this.item = null;
+      this.orderLogs = []; // 清空操作记录
+      getIntegralOrder(orderId).then(response => {
+        this.item = response.data;
+        this.prod = [JSON.parse(this.item.itemJson)][0];
+        // 获取操作记录
+        this.getOrderLogsData();
+      });
+    },
+    // 代服账号选择变化
+    handleAccountSelectionChange(currentRow, oldRow) {
+      this.selectedRow = currentRow;
+      if (currentRow) {
+        this.form.loginAccount = currentRow.loginAccount;
+      }
+    },
+    // 修改订单弹窗的代服账号选择
+    handleEditAccountSelectionChange(currentRow, oldRow) {
+      this.editSelectedRow = currentRow;
+      if (currentRow) {
+        this.editForm.loginAccount = currentRow.loginAccount;
+      }
+    },
+
+    handlePageChange(page) {
+      this.queryParams.pageNum = page;
+      this.getAccountList();
+    },
+    // 取消订单
+    applyRefund() {
+      this.$confirm('确定要取消该订单吗?取消后订单将无法恢复。', '取消订单确认', {
+        confirmButtonText: '确定取消',
+        cancelButtonText: '再想想',
+        type: 'warning',
+        confirmButtonClass: 'el-button--danger'
+      }).then(() => {
+        this.cancelOrder();
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消操作'
+        });
+      });
+    },
+
+    // 执行取消订单请求
+    cancelOrder() {
+      const orderCode = this.item.orderCode;
+      mandatoryRefunds(orderCode).then(response => {
+        if (response.code === 200) {
+          this.msgSuccess("取消订单成功");
+          // 刷新订单详情
+          this.getDetails(this.item.orderId);
+          // 刷新父组件列表(如果有)
+          if (this.$parent && this.$parent.$parent && this.$parent.$parent.getList) {
+            this.$parent.$parent.getList();
+          }
+        } else {
+          this.msgError(response.msg || "取消订单失败");
+        }
+      }).catch(error => {
+        this.msgError("取消订单失败");
+        console.error('取消订单失败:', error);
+      });
+    },
+    // 完成订单
+    handleFinishOrder() {
+      this.$confirm('确定要完成该订单吗?完成后订单状态将变为已完成。', '完成订单确认', {
+        confirmButtonText: '确定完成',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        // 用户点击确定
+        this.executeFinishOrder();
+      }).catch(() => {
+        // 用户点击取消
+        this.$message({
+          type: 'info',
+          message: '已取消操作'
+        });
+      });
+    },
+
+    // 执行完成订单请求
+    executeFinishOrder() {
+      const orderCode = this.item.orderCode;
+      console.log("请问请问",orderCode)
+      finishOrder(orderCode).then(response => {
+        if (response.code === 200) {
+          this.msgSuccess("订单完成成功");
+          // 刷新订单详情
+          this.getDetails(this.item.orderId);
+          // 刷新父组件列表(如果有)
+          if (this.$parent && this.$parent.$parent && this.$parent.$parent.getList) {
+            this.$parent.$parent.getList();
+          }
+        } else {
+          this.msgError(response.msg || "订单完成失败");
+        }
+      }).catch(error => {
+        this.msgError("订单完成失败");
+        console.error('完成订单失败:', error);
+      });
+    },
+    // 获取订单操作记录
+    getOrderLogsData() {
+      if (!this.item || !this.item.orderId) {
+        return;
+      }
+
+      this.logsLoading = true;
+      getOrderLogs(this.item.orderId).then(response => {
+        if (response.code === 200) {
+          // 按照时间升序排列
+          this.orderLogs = response.data.sort((a, b) => {
+            return new Date(a.changeTime) - new Date(b.changeTime);
+          });
+        } else {
+          this.orderLogs = [];
+        }
+        this.logsLoading = false;
+      }).catch(error => {
+        this.orderLogs = [];
+        this.logsLoading = false;
+        console.error('获取操作记录失败:', error);
+      });
+    }
+  }
+}
+</script>
+<style>
+.contentx {
+  height: 100%;
+  background-color: #fff;
+  padding: 0px 20px 20px;
+
+
+  margin: 20px;
+}
+
+.el-descriptions-item__label.is-bordered-label {
+  font-weight: normal;
+}
+
+.el-descriptions-item__content {
+  max-width: 150px;
+  min-width: 100px;
+}
+
+.desct {
+  padding-top: 20px;
+  padding-bottom: 20px;
+  color: #524b4a;
+  font-weight: bold;
+}
+
+.operate-container {
+  background: #F2F6FC;
+  height: 60px;
+  margin: -20px -20px 0;
+  line-height: 60px;
+}
+
+.order-content {
+  margin: 10px;
+
+}
+
+.operate-button-container {
+  float: right;
+  margin-right: 20px
+}
+</style>