Преглед изворни кода

销售后台 需求和bug修改

wangxy пре 1 дан
родитељ
комит
6e1a88457f

+ 8 - 0
src/api/course/courseWatchLog.js

@@ -112,6 +112,14 @@ export function exportCourseWatchLog(query) {
     params: query
   })
 }
+export function exportQwWatchLogAll(query) {
+  return request({
+    url: '/course/courseWatchLog/qwWatchLogAllStatisticsExport',
+    method: 'get',
+    params: query
+  })
+}
+
 export function statisticsExport(query) {
   return request({
     url: '/course/courseWatchLog/statisticsExport',

+ 7 - 0
src/api/course/qw/courseWatchLog.js

@@ -111,6 +111,13 @@ export function exportCourseWatchLog(query) {
     params: query
   })
 }
+export function exportQwWatchLogAll(query) {
+  return request({
+    url: '/qw/course/courseWatchLog/qwWatchLogAllStatisticsExport',
+    method: 'get',
+    params: query
+  })
+}
 
 export function watchLogStatisticsExport(query) {
   return request({

+ 15 - 0
src/api/store/package.js

@@ -86,3 +86,18 @@ export function watchLogReport(query) {
     params: query
   })
 }
+
+export function exportUserReport(query) {
+  return request({
+    url: '/store/store/statistics/userReportExport',
+    method: 'get',
+    params: query
+  })
+}
+export function exportWatchLogReport(query) {
+  return request({
+    url: '/store/store/statistics/watchLogReportExport',
+    method: 'get',
+    params: query
+  })
+}

+ 7 - 0
src/api/store/storeOrder.js

@@ -120,6 +120,13 @@ export function addOrder(data) {
     data: data
   })
 }
+export function createOrderByManually(data) {
+  return request({
+    url: '/store/storeOrder/createOrderByManually',
+    method: 'post',
+    data: data
+  })
+}
 
 // 修改订单
 export function updateOrder(data) {

+ 27 - 2
src/views/course/courseUserStatistics/qw/statistics.vue

@@ -19,6 +19,20 @@
       </el-form-item>
     </el-form>
 
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
     <el-table border v-loading="loading" :data="courseWatchLogList" @selection-change="handleSelectionChange"  show-summary height="600">
       <el-table-column type="selection" width="55" align="center" />
         <el-table-column label="员工名称" align="center" prop="qwUserName" />
@@ -451,7 +465,18 @@
 </template>
 
 <script>
-import { listCourseWatchLog, getCourseWatchLog, delCourseWatchLog, addCourseWatchLog, updateCourseWatchLog, exportCourseWatchLog,statisticsList,qwWatchLogStatisticsList,qwWatchLogAllStatisticsList } from "@/api/course/qw/courseWatchLog";
+import {
+  listCourseWatchLog,
+  getCourseWatchLog,
+  delCourseWatchLog,
+  addCourseWatchLog,
+  updateCourseWatchLog,
+  exportCourseWatchLog,
+  statisticsList,
+  qwWatchLogStatisticsList,
+  qwWatchLogAllStatisticsList,
+  exportQwWatchLogAll
+} from "@/api/course/qw/courseWatchLog";
 import { courseList,videoList } from '@/api/course/courseRedPacketLog'
 export default {
   name: "CourseWatchLog",
@@ -664,7 +689,7 @@ export default {
           type: "warning"
         }).then(() => {
           this.exportLoading = true;
-          return exportCourseWatchLog(queryParams);
+          return exportQwWatchLogAll(queryParams);
         }).then(response => {
           this.download(response.msg);
           this.exportLoading = false;

+ 26 - 2
src/views/course/courseUserStatistics/statistics.vue

@@ -49,6 +49,19 @@
         <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="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
 
     <el-table border v-loading="loading" :data="courseWatchLogList" @selection-change="handleSelectionChange"  show-summary height="600">
       <el-table-column type="selection" width="55" align="center" />
@@ -485,7 +498,18 @@
 </template>
 
 <script>
-import { listCourseWatchLog, getCourseWatchLog, delCourseWatchLog, addCourseWatchLog, updateCourseWatchLog, exportCourseWatchLog,statisticsList,qwWatchLogStatisticsList,qwWatchLogAllStatisticsList } from "@/api/course/courseWatchLog";
+import {
+  listCourseWatchLog,
+  getCourseWatchLog,
+  delCourseWatchLog,
+  addCourseWatchLog,
+  updateCourseWatchLog,
+  exportCourseWatchLog,
+  statisticsList,
+  qwWatchLogStatisticsList,
+  qwWatchLogAllStatisticsList,
+  exportQwWatchLogAll
+} from "@/api/course/courseWatchLog";
 import { courseList,videoList } from '@/api/course/courseRedPacketLog'
 import {getUserList} from "@/api/company/companyUser";
 export default {
@@ -709,7 +733,7 @@ export default {
           type: "warning"
         }).then(() => {
           this.exportLoading = true;
-          return exportCourseWatchLog(queryParams);
+          return exportQwWatchLogAll(queryParams);
         }).then(response => {
           this.download(response.msg);
           this.exportLoading = false;

+ 21 - 9
src/views/index.vue

@@ -84,7 +84,7 @@
         </el-col>
 
 
-        <el-col :xs="24" :sm="24" :md="6" :lg="6" :xl="6" class="propertyboxtitle">
+        <el-col  v-if="isAdmin" :xs="24" :sm="24" :md="6" :lg="6" :xl="6" class="propertyboxtitle">
           <div class="property_title">
             红包概览
           </div>
@@ -1042,6 +1042,7 @@ export default {
     })
   },
   created() {
+    console.log('当前权限',this.$store.state.user.roles)
     // 检查是否是首次登录
     if (localStorage.getItem('isFirstLogin') === 'true') {
       this.$message.warning('请先设置密码');
@@ -1050,6 +1051,11 @@ export default {
     }
     this.refresh();
   },
+  computed: {
+    isAdmin() {
+      return this.$store.state.user.roles && this.$store.state.user.roles.includes('admin');
+    }
+  },
   methods: {
     handleUserType(){
       if(this.userTypeText === '会员'){
@@ -1169,15 +1175,21 @@ export default {
         }
       });
 
-      // 获取红包概览
-      redPacketInfo().then(res=>{
-        if(res.code === 200){
-          if(res.data){
-            this.redBalance = res.data.redBalance;
-            this.redTodayComsumption = res.data.redTodayComsumption;
+      if (this.isAdmin) {
+        // 获取红包概览
+        redPacketInfo().then(res => {
+          if (res.code === 200) {
+            if (res.data) {
+              this.redBalance = res.data.redBalance;
+              this.redTodayComsumption = res.data.redTodayComsumption;
+            }
           }
-        }
-      })
+        });
+      } else {
+        // Reset values for non-admin users
+        this.redBalance = 0;
+        this.redTodayComsumption = 0;
+      }
 
       trafficLog().then(res=>{
         if(res.code === 200) {

+ 29 - 2
src/views/statistics/userReport.vue

@@ -68,7 +68,19 @@
         <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="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
 
     <el-table v-loading="loading" border :data="packageList">
       <el-table-column label="会员id" align="center" prop="userId" />
@@ -167,7 +179,7 @@ import {
   addPackage,
   updatePackage,
   exportPackage,
-  userReport
+  userReport, exportUserReport
 } from "@/api/store/package";
 import { getAllFollowTempName } from "@/api/store/followTemp";
 import { allIcd } from "@/api/store/icd";
@@ -180,6 +192,7 @@ import { getAllCateList } from "@/api/store/packageCate";
 import { Loading } from 'element-ui';
 import {getCompanyList} from "@/api/company/company";
 import {selectDeptTree} from "@/api/company/companyDept";
+import {exportQwWatchLogAll} from "@/api/course/qw/courseWatchLog";
 export default {
   name: "Package",
   components: {Treeselect},
@@ -489,6 +502,20 @@ export default {
       this.startTime = null;
       this.endTime = null;
     },
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有会员积分数据项?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        this.exportLoading = true;
+        return exportUserReport(queryParams);
+      }).then(response => {
+        this.download(response.msg);
+        this.exportLoading = false;
+      }).catch(() => {});
+    },
     xdChange() {
       if (this.createTime != null) {
         this.queryParams.sTime = this.createTime[0];

+ 29 - 3
src/views/statistics/watchlogReport.vue

@@ -76,6 +76,19 @@
       </el-form-item>
     </el-form>
 
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
 
     <el-table v-loading="loading" border :data="packageList">
       <el-table-column label="会员id" align="center" prop="userId" />
@@ -88,7 +101,6 @@
       <el-table-column label="小节名称" align="center" prop="videoTitle" />
       <el-table-column label="看课状态" align="center" prop="watchStatus" />
       <el-table-column label="播放时长" align="center" prop="duration" />
-      <el-table-column label="看课时间" align="center" prop="courseTime" />
       <el-table-column label="完课时间" align="center" prop="finishTime" />
       <el-table-column label="答题状态" align="center" prop="answerStatus" />
       <el-table-column label="红包金额" align="center" prop="redPacketAmount" />
@@ -176,7 +188,7 @@ import {
   addPackage,
   updatePackage,
   exportPackage,
-  userReport, watchLogReport
+  userReport, watchLogReport, exportUserReport, exportWatchLogReport
 } from "@/api/store/package";
 import { getAllFollowTempName } from "@/api/store/followTemp";
 import { allIcd } from "@/api/store/icd";
@@ -361,7 +373,7 @@ export default {
         orderSTime: null,
         orderETime: null,
         deptId: null,
-        dimension: 'user'
+          dimension: 'user'
       },
       // 表单参数
       form: {},
@@ -586,6 +598,20 @@ export default {
       this.queryParams.eTime = null;
       this.queryParams.orderETime= null;
     },
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出看课统计数据项?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        this.exportLoading = true;
+        return exportWatchLogReport(queryParams);
+      }).then(response => {
+        this.download(response.msg);
+        this.exportLoading = false;
+      }).catch(() => {});
+    },
     xdChange() {
       if (this.createTime != null) {
         this.queryParams.sTime = this.createTime[0];

+ 34 - 3
src/views/statistics/watchlogReportCompany.vue

@@ -75,6 +75,19 @@
         <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="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
 
 
     <el-table v-loading="loading" border :data="packageList">
@@ -89,7 +102,6 @@
       <el-table-column label="完课数" align="center" prop="finishedCount" />
       <el-table-column label="未完课" align="center" prop="unfinishedCount" />
       <el-table-column label="完课率" align="center" prop="completionRate" />
-      <el-table-column label="看课时间" align="center" prop="courseTime" />
       <el-table-column label="未看数" align="center" prop="notWatchedCount" />
       <el-table-column label="未答题人数" align="center" prop="notAnsweredCount" />
       <el-table-column label="红包金额" align="center" prop="redPacketAmount" />
@@ -177,7 +189,7 @@ import {
   addPackage,
   updatePackage,
   exportPackage,
-  userReport, watchLogReport
+  userReport, watchLogReport, exportWatchLogReport
 } from "@/api/store/package";
 import { getAllFollowTempName } from "@/api/store/followTemp";
 import { allIcd } from "@/api/store/icd";
@@ -451,12 +463,17 @@ export default {
       this.packageList.forEach(item => {
         this.calculatedTotalData.finishedCount += Number(item.finishedCount) || 0;
         this.calculatedTotalData.unfinishedCount += Number(item.unfinishedCount) || 0;
-        this.calculatedTotalData.completionRate += Number(item.completionRate) || 0;
         this.calculatedTotalData.notWatchedCount += Number(item.notWatchedCount) || 0;
         this.calculatedTotalData.notAnsweredCount += Number(item.notAnsweredCount) || 0;
         this.calculatedTotalData.redPacketAmount += Number(item.redPacketAmount) || 0;
         this.calculatedTotalData.historyOrderCount += Number(item.historyOrderCount) || 0;
       });
+      const totalCount = this.calculatedTotalData.finishedCount + this.calculatedTotalData.unfinishedCount;
+      if (totalCount > 0) {
+        this.calculatedTotalData.completionRate = (this.calculatedTotalData.finishedCount / totalCount * 100).toFixed(2) + '%';
+      } else {
+        this.calculatedTotalData.completionRate = '0%';
+      }
     },
     getTreeselect(companyId) {
       const query = { companyId: companyId };
@@ -588,6 +605,20 @@ export default {
       this.queryParams.orderSTime= null;
       this.queryParams.orderETime= null;
     },
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出看课统计(部门)数据项?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        this.exportLoading = true;
+        return exportWatchLogReport(queryParams);
+      }).then(response => {
+        this.download(response.msg);
+        this.exportLoading = false;
+      }).catch(() => {});
+    },
     xdChange() {
       if (this.createTime != null) {
         this.queryParams.sTime = this.createTime[0];

+ 34 - 3
src/views/statistics/watchlogReportdept.vue

@@ -76,6 +76,19 @@
       </el-form-item>
     </el-form>
 
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
 
     <el-table v-loading="loading" border :data="packageList">
       <el-table-column label="所属销售部门" align="center" prop="salesDept"/>
@@ -89,7 +102,6 @@
       <el-table-column label="完课数" align="center" prop="finishedCount" />
       <el-table-column label="未完课" align="center" prop="unfinishedCount" />
       <el-table-column label="完课率" align="center" prop="completionRate" />
-      <el-table-column label="看课时间" align="center" prop="courseTime" />
       <el-table-column label="未看数" align="center" prop="notWatchedCount" />
       <el-table-column label="未答题人数" align="center" prop="notAnsweredCount" />
       <el-table-column label="红包金额" align="center" prop="redPacketAmount" />
@@ -177,7 +189,7 @@ import {
   addPackage,
   updatePackage,
   exportPackage,
-  userReport, watchLogReport
+  userReport, watchLogReport, exportWatchLogReport
 } from "@/api/store/package";
 import { getAllFollowTempName } from "@/api/store/followTemp";
 import { allIcd } from "@/api/store/icd";
@@ -451,12 +463,17 @@ export default {
       this.packageList.forEach(item => {
         this.calculatedTotalData.finishedCount += Number(item.finishedCount) || 0;
         this.calculatedTotalData.unfinishedCount += Number(item.unfinishedCount) || 0;
-        this.calculatedTotalData.completionRate += Number(item.completionRate) || 0;
         this.calculatedTotalData.notWatchedCount += Number(item.notWatchedCount) || 0;
         this.calculatedTotalData.notAnsweredCount += Number(item.notAnsweredCount) || 0;
         this.calculatedTotalData.redPacketAmount += Number(item.redPacketAmount) || 0;
         this.calculatedTotalData.historyOrderCount += Number(item.historyOrderCount) || 0;
       });
+      const totalCount = this.calculatedTotalData.finishedCount + this.calculatedTotalData.unfinishedCount;
+      if (totalCount > 0) {
+        this.calculatedTotalData.completionRate = (this.calculatedTotalData.finishedCount / totalCount * 100).toFixed(2) + '%';
+      } else {
+        this.calculatedTotalData.completionRate = '0%';
+      }
     },
     getTreeselect(companyId) {
       const query = { companyId: companyId };
@@ -587,6 +604,20 @@ export default {
       this.queryParams.orderSTime= null;
       this.queryParams.orderETime= null;
     },
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出看课统计(公司)数据项?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        this.exportLoading = true;
+        return exportWatchLogReport(queryParams);
+      }).then(response => {
+        this.download(response.msg);
+        this.exportLoading = false;
+      }).catch(() => {});
+    },
     xdChange() {
       if (this.createTime != null) {
         this.queryParams.sTime = this.createTime[0];

+ 22 - 0
src/views/store/components/packageOrderDetails2.vue

@@ -69,6 +69,28 @@
        </el-card>
      </div>
 
+    <div class="contentx" v-if="item!=null">
+      <div class="desct">
+        收货信息
+      </div>
+      <el-descriptions   :column="3" border  >
+        <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-descriptions-item>
+        <el-descriptions-item label="收货人地址"  >
+                <span v-if="item!=null">
+                  {{item.userAddress}}
+                </span>
+        </el-descriptions-item>
+      </el-descriptions>
+    </div>
 
 
    <div class="contentx" v-if="item!=null">

+ 374 - 21
src/views/store/storeOrder/list.vue

@@ -52,7 +52,7 @@
               />
         </el-select>
       </el-form-item>
-		
+
       <el-form-item label="结算状态" prop="deliveryPayStatus">
         <el-select style="width:220px" v-model="queryParams.deliveryPayStatus" placeholder="请选择物流结算状态" clearable size="small" >
         <el-option
@@ -140,7 +140,7 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-	
+
       <el-form-item label="加密电话" prop="userPhoneMk">
         <el-input
           v-model="queryParams.userPhoneMk"
@@ -221,8 +221,8 @@
 	<el-form-item label="入账时间" prop="tuiMoneyTime">
 	      <el-date-picker v-model="tuiMoneyTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="changeTime"></el-date-picker>
 	</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>
@@ -231,7 +231,13 @@
 
     <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:storeOrder:addManually']"
+        >创建订单</el-button>
         <el-button
           type="warning"
           plain
@@ -305,17 +311,197 @@
       :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"  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="patientId">
+          <el-row>
+            <el-col>
+              <el-button plain  type="primary" icon="el-icon-plus"  @click="handleAddUserPatient()">添加就诊人</el-button>
+            </el-col>
+          </el-row>
+          <el-radio-group v-model="form.patientId" style="width:100%">
+            <el-table border  style="margin-top:5px;"  v-loading="patientLoading" :data="patientList">
+              <el-table-column label="ID" align="center"  >
+                <template slot-scope="scope">
+                  <el-radio :label="scope.row.patientId"></el-radio>
+                </template>
+              </el-table-column>
+              <el-table-column label="患者姓名" align="center" prop="patientName" />
+              <el-table-column label="所属会员" align="center" width="150px">
+                <template slot-scope="scope">
+                  <div v-if="scope.row.nickName!=null"> {{scope.row.nickName}}-{{scope.row.phone}}</div>
+                </template>
+              </el-table-column>
+              <el-table-column label="身份证号" align="center" prop="idCard" width="170px"/>
+              <el-table-column label="出生年月" align="center" prop="birthday" width="180">
+                <template slot-scope="scope">
+                  <span>{{ parseTime(scope.row.birthday, '{y}-{m}-{d}') }}</span>
+                </template>
+              </el-table-column>
+              <el-table-column label="性别" align="center" prop="sex" >
+                <template slot-scope="scope">
+                  <dict-tag :options="sexOptions" :value="scope.row.sex"/>
+                </template>
+              </el-table-column>
+              <el-table-column label="体重G" align="center" prop="weight" />
+              <el-table-column label="手机号" align="center" prop="mobile" />
+              <el-table-column label="状态" align="center" prop="status" >
+                <template slot-scope="scope">
+                  <dict-tag :options="userStatusOptions" :value="scope.row.status"/>
+                </template>
+              </el-table-column>
+              <el-table-column label="与本人关系" align="center" prop="relation" />
+              <el-table-column label="肝功能是否异常" align="center" prop="liverUnusual" />
+              <el-table-column label="肾功能是否异常" align="center" prop="renalUnusual" />
+              <el-table-column label="过敏史" align="center" prop="historyAllergic" />
+              <el-table-column label="家族病史" align="center" prop="familyMedHistory" />
+              <el-table-column label="个人病史" align="center" prop="selfMedHistory" />
+            </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="productName" />
+            <el-table-column label="分类" align="center" prop="cateName" />
+            <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="sales" />
+            <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-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-drawer
         :with-header="false"
         size="75%"
          :title="show.title" :visible.sync="show.open">
      <storeOrderDetails  ref="Details" />
    </el-drawer>
+    <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="userPatient.title" v-if="userPatient.open"  :visible.sync="userPatient.open" width="800px" append-to-body>
+      <add-patient ref="addPatient"   @addUserPatient="addUserPatient" />
+    </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 { listOrder, getOrder, delOrder, addOrder, updateOrder, exportOrder,importTemplate } from "@/api/store/storeOrder";
+import {
+  listOrder,
+  getOrder,
+  delOrder,
+  addOrder,
+  updateOrder,
+  exportOrder,
+  importTemplate,
+  createOrderByManually
+} from "@/api/store/storeOrder";
 import storeOrderDetails from '../components/storeOrderDetails.vue';
 import { getTcmScheduleList } from "@/api/company/tcmScheduleReport";
 import { getToken } from "@/utils/auth";
@@ -324,16 +510,28 @@ import { treeselect } from "@/api/company/companyDept";
 import Treeselect from "@riophae/vue-treeselect";
 import { getTask } from "@/api/common";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import {userList} from "@/api/store/user";
+import {listUserAddress} from "@/api/store/userAddress";
+import {getPackage, packageList} from "@/api/store/package";
+import {listStoreProduct} from "@/api/store/storeProduct";
+import addUser from "@/views/store/components/addUser.vue";
+import addUserAddress from "@/views/store/components/addUserAddress.vue";
+import addPatient from "@/views/store/components/addPatient.vue";
+import {listPatient} from "@/api/store/patient";
 export default {
   name: "Order",
-  components: { storeOrderDetails ,Treeselect},
+  components: {addPatient, addUserAddress, addUser, storeOrderDetails ,Treeselect},
   data() {
     return {
       payTypeArr:[],
+      productJson:[],
       scheduleIdArr:[],
       buyTypeArr:[],
       channelArr:[],
       qwSubjectArr:[],
+      packageTypeOptions:[],
+      productTypeOptions:[],
+      payTypeOptions:[],
       // 部门树选项
       deptOptions: [],
       deptName:undefined,
@@ -359,6 +557,8 @@ export default {
       total: 0,
       // 订单表格数据
       orderList: [],
+      phone:null,
+      userStatusOptions:[],
       // 弹出层标题
       title: "",
       createTime:null,
@@ -366,6 +566,14 @@ export default {
 	  deliveryImportTime:null,
 	  deliverySendTime:null,
 	  tuiMoneyTime:null,
+      userloading :false,
+      users:[],
+      address:[],
+      packageList:[],
+      packageSubTypeOptions: [],
+      patientList:[],
+      addressloading:false,
+      patientLoading:false,
       // 是否显示弹出层
       open: false,
       // 查询参数
@@ -425,7 +633,27 @@ export default {
       		source:null,
       },
       // 表单参数
-      form: {},
+      form: {
+        addressId:null,
+        userId:null,
+        packageId:null,
+        patientId:null,
+        payType:null,
+        payMoney:null,
+        productIds: []
+      },
+      userPatient:{
+        open:false,
+        title:"创建病人"
+      },
+      user:{
+        open:false,
+        title:"创建会员"
+      },
+      userAddress:{
+        open:false,
+        title:"创建收货地址"
+      },
       // 表单校验
       rules: {
       },
@@ -465,6 +693,9 @@ export default {
         this.orderBuyTypeOptions.push({dictLabel: "无",
             dictValue: "-1"})
       });
+    this.getDicts("sys_product_type").then(response => {
+      this.productTypeOptions = response.data;
+    });
 	  this.getDicts("sys_order_source").then(response => {
 	    this.sourceOptions = response.data;
 	  });
@@ -477,6 +708,18 @@ export default {
     this.getDicts("sys_order_status").then(response => {
         this.orderOptions = response.data;
       });
+    this.getDicts("sys_company_status").then(response => {
+      this.userStatusOptions = response.data;
+    });
+    this.getDicts("sys_package_type").then(response => {
+      this.packageTypeOptions = response.data;
+    });
+    this.getDicts("sys_package_sub_type").then(response => {
+      this.packageSubTypeOptions = response.data;
+    });
+    this.getDicts("sys_package_pay_type").then(response => {
+      this.payTypeOptions = response.data;
+    });
     this.getDicts("sys_order_pay").then(response => {
         this.payStatusOptions = response.data;
       });
@@ -509,6 +752,29 @@ export default {
 
   },
   methods: {
+    handleAddUserPatient(){
+      if(this.form.userId==null){
+        this.msgError("请选择会员");
+        return;
+      }
+      this.userPatient.open=true;
+      setTimeout(() => {
+        this.$refs.addPatient.init(this.form.userId);
+      }, 500);
+    },
+    handleProductSelectionChange(selection) {
+      // 将选中商品的ID保存到form.productIds中
+      this.form.productIds = selection.map(item => item.productId);
+    },
+    /** 查询商品列表 */
+    getProductList() {
+      this.loading = true;
+      listStoreProduct(this.queryParams).then(response => {
+        this.productJson = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
    /** 查询部门下拉树结构 */
    getTreeselect() {
       treeselect().then((response) => {
@@ -525,6 +791,70 @@ export default {
       this.queryParams.deptId = data.id;
       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)
+          this.getPatentList(this.form.userId)
+        }
+      });
+    },
+    addUser(phone){
+      this.user.open=false;
+      this.phone=phone;
+      this.searchUser();
+    },
+    addUserPatient(){
+      this.userPatient.open=false;
+      //获取地址
+      this.getPatentList(this.form.userId);
+    },
+    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;
+      });
+    },
+    getPatentList(userId){
+      var data={userId:userId}
+      this.patientLoading = true;
+      this.patientList=[];
+      listPatient(data).then(response => {
+        this.patientList = response.rows;
+        this.patientLoading = false;
+      });
+    },
+    handleAddUser(){
+      this.user.open=true;
+    },
     /** 导入按钮操作 */
     handleImport() {
         this.upload.title = "商品导入";
@@ -617,6 +947,7 @@ export default {
         userId: null,
         userName: null,
         userPhone: null,
+        phone: null,
         userAddress: null,
         cartId: null,
         totalNum: null,
@@ -738,6 +1069,28 @@ export default {
     /** 新增按钮操作 */
     handleAdd() {
       this.reset();
+      // 清空商品列表
+      this.productJson = [];
+      // 清空用户搜索手机号
+      this.phone = null;
+      // 清空用户列表
+      this.users = [];
+      // 清空地址列表
+      this.address = [];
+      // 清空就诊人列表
+      this.patientList = [];
+      // 清空商品搜索名称
+      this.queryParams.productName = null;
+      // 重置表单
+      this.form = {
+        addressId: null,
+        userId: null,
+        packageId: null,
+        patientId: null,
+        payType: null,
+        payMoney: null,
+        productIds: []
+      };
       this.open = true;
       this.title = "添加订单";
     },
@@ -755,19 +1108,19 @@ export default {
     submitForm() {
       this.$refs["form"].validate(valid => {
         if (valid) {
-          if (this.form.orderId != null) {
-            updateOrder(this.form).then(response => {
-              this.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addOrder(this.form).then(response => {
-              this.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
-          }
+          createOrderByManually(this.form).then(response => {
+            this.msgSuccess("新增成功");
+            this.open = false;
+            this.form={
+              addressId:null,
+              userId:null,
+              packageId:null,
+              patientId:null,
+              payType:null,
+              productIds: []
+            }
+            this.getList();
+          })
         }
       });
     },