Browse Source

Merge branch 'test' of mangpiao/mp-ui-pc into master

mangpiao 2 years ago
parent
commit
4f83db3fac

+ 9 - 0
src/api/business/coupon.js

@@ -42,3 +42,12 @@ export function setCouponStatus(data) {
     data
   })
 }
+
+//获取全部优惠券 不分页
+export function getCouponAllList(data) {
+  return request({
+    url: '/api/v1/mp/admin/coupon/list',
+    method: 'post',
+    data
+  })
+}

+ 28 - 0
src/api/business/inventory.js

@@ -0,0 +1,28 @@
+import request from '@/utils/request'
+
+//列表
+export function getInventoryList(urlParams, data) {
+  return request({
+    url: '/api/v1/mp/admin/channel/goods/list',
+    method: 'post',
+    data,
+    urlParams
+  })
+}
+
+//详情
+export function getInventoryDetail(orderId) {
+  return request({
+    url: `/api/v1/mp/admin/channel/goods/detail/${orderId}`,
+    method: 'post',
+  })
+}
+
+//推送结算订单
+export function storeInventory(data) {
+  return request({
+    url: `/api/v1/mp/admin/channel/goods/push/settle/order`,
+    method: 'post',
+    data
+  })
+}

+ 46 - 0
src/api/business/order.js

@@ -210,3 +210,49 @@ export function setBatchShip(data, config = {}) {
     }
   })
 }
+
+// 采购订单
+export function getStoreList(urlParams, data) {
+  return request({
+      url: '/api/v1/mp/admin/channel/goods/order/list',
+      method: 'post',
+      data,
+      urlParams
+  })
+}
+
+// 采购订单导出
+export function storeOrderExport(data) {
+  return request({
+    url: '/api/v1/mp/admin/channel/goods/order/export',
+    method: 'post',
+    data
+  })
+}
+
+// 用户订单详情
+export function storeDetail(data) {
+  return request({
+    url: '/api/v1/mp/admin/channel/goods/order/detail',
+    method: 'post',
+    data
+  })
+}
+
+// 采购订单发货
+export function storeOrderShip(data) {
+  return request({
+    url: '/api/v1/mp/admin/channel/goods/order/ship',
+    method: 'post',
+    data
+  })
+}
+
+// 修改采购订单发货信息
+export function storeOrderShipUpdate(data) {
+  return request({
+    url: '/api/v1/mp/admin/channel/goods/order/ship/update',
+    method: 'post',
+    data
+  })
+}

+ 20 - 1
src/router/index.js

@@ -192,6 +192,19 @@ export const constantRoutes = [
       }
     ],
   },
+  {
+    path: '/inventory',
+    component: Layout,
+    hidden: true,
+    children: [
+      {
+        path: 'detail',
+        component: (resolve) => require(['@/views/business/inventory/detail'], resolve),
+        name: 'InventoryDetail',
+        meta: { title: '库存订单查看', activeMenu: '/goods/inventory', noCache: true }
+      }
+    ],
+  },
   {
     path: '/exchange',
     component: Layout,
@@ -207,7 +220,7 @@ export const constantRoutes = [
         path: 'detailCode',
         component: (resolve) => require(['@/views/business/exchange/addCode'], resolve),
         name: 'ExchangeDetail',
-        meta: { title: '查看兑换码', activeMenu: '/goods/exchange' }
+        meta: { title: '查看兑换码', activeMenu: '/goods/exchange', noCache: true }
       }
     ],
   },
@@ -326,6 +339,12 @@ export const constantRoutes = [
         component: (resolve) => require(['@/views/order/userTicket/detail'], resolve),
         name: 'UserTicketDetail',
         meta: { title: '盲票销售订单查看' , activeMenu: '/order/userTicket', noCache: true }
+      },
+      {
+        path: 'store/query',
+        component: (resolve) => require(['@/views/order/store/detail'], resolve),
+        name: 'StoreDetail',
+        meta: { title: '采购订单查看' , activeMenu: '/order/store', noCache: true }
       }
     ]
   },

+ 27 - 9
src/views/business/coupon/add.vue

@@ -8,12 +8,13 @@
             <el-input v-model="addData.title" :readonly="readonly" placeholder="请输入券名称" :maxlength="32" show-word-limit />
           </el-form-item>
           <el-form-item label="使用场景:" prop="type">
-            <el-radio-group v-model="addData.type" :disabled="readonly || addData.status === 'on' || addData.status === 'off'">
+            <el-radio-group v-model="addData.type" @input="typeChange" :disabled="readonly || addData.status === 'on' || addData.status === 'off'">
               <el-radio :label="2">门店消费</el-radio>
               <el-radio :label="1">盲票购买</el-radio>
+              <el-radio :label="4">采购商品核销</el-radio>
             </el-radio-group>
           </el-form-item>
-          <el-form-item v-if="addData.type === 1" label="是否新用户注册发放:">
+          <el-form-item v-if="addData.type != 2 && addData.type != 4" label="是否新用户注册发放:">
             <el-switch :disabled="readonly" v-model="addData.isNewUserCoupon" :active-value="1" :inactive-value="0" />
           </el-form-item>
           <el-form-item label="券金额:" prop="discount">
@@ -29,14 +30,14 @@
           <!-- <el-form-item label="图片:" prop="picUrl">
             <Upload :value="addData.picUrl ? [{ fileName: addData.picUrl }] : []" @input="addData.picUrl = $event[0] ? $event[0].fileName : ''" :limit="1" />
           </el-form-item> -->
-          <el-form-item v-if="addData.type === 2" label="门店默认承担比例:" prop="channelSharedRate">
+          <el-form-item v-if="addData.type != 1" label="门店默认承担比例:" prop="channelSharedRate">
             <el-input v-model="addData.channelSharedRate" :readonly="readonly" type="number" placeholder="请输入门店默认承担比例">
               <template slot="append">%</template>
             </el-input>
             <div class="tip">若门店承担100%,则核销后公司不需要打款给门店,依此类推。</div>
           </el-form-item>
 
-          <el-form-item label="最低消费金额:" prop="minOrderAmt">
+          <el-form-item label="最低消费金额:" v-if="addData.type != 4" prop="minOrderAmt">
             <el-input v-model="addData.minOrderAmt" :readonly="readonly" type="number" placeholder="请输入可使用的最低消费金额">
               <template slot="append">元</template>
             </el-input>
@@ -62,10 +63,10 @@
           <el-form-item label="使用说明:" prop="description">
             <el-input type="textarea" rows="4" :readonly="readonly" v-model="addData.description" placeholder="请输入使用说明 对用户可见" />
           </el-form-item>
-          <el-form-item v-if="addData.type === 2" label="使用范围:" prop="useArea">
+          <el-form-item v-if="addData.type != 1" label="使用范围:" prop="useArea">
             <el-radio-group v-model="addData.useArea" :disabled="readonly || addData.status === 'on' || addData.status === 'off'">
-              <el-radio :label="2">进票门店</el-radio>
-              <el-radio :label="1">指定门店</el-radio>
+              <el-radio :label="2" :disabled="addData.type == 4">进票门店</el-radio>
+              <el-radio :label="1" :disabled="addData.type == 4">指定门店</el-radio>
               <el-radio :label="0">所有门店</el-radio>
             </el-radio-group>
           </el-form-item>
@@ -82,7 +83,7 @@
     </el-row>
     <el-row :gutter="18">
       <el-col :span="18" :offset="2">
-        <div v-if="addData.useArea === 1 && addData.type === 1" style="padding: 0 20px">
+        <div v-if="addData.useArea === 1 && addData.type != 2" style="padding: 0 20px">
           <el-table :data="addData.ticketBoxList" height="300px">
             <el-table-column label="盲票ID" prop="boxId" min-width="90" />
             <el-table-column label="盲票图片" prop="picUrl" align="center">
@@ -116,7 +117,7 @@
           <br>
           <el-button v-if="!readonly" type="primary" size="small" plain @click="funSelectShow">选择盲票</el-button> <span style="margin-left: 10px">已选盲票({{ addData.ticketBoxList.length }})</span>
         </div>
-        <div v-if="addData.useArea === 1 && addData.type === 2" style="padding: 0 20px">
+        <div v-if="addData.useArea === 1 && addData.type != 1" style="padding: 0 20px">
           <el-table :data="channelList" height="300px">
             <el-table-column label="门店编号" prop="channelId" min-width="90" />
             <el-table-column label="门店名称" prop="name" />
@@ -247,6 +248,13 @@ export default {
     }
   },
   methods: {
+    typeChange(e) {
+      if(e == 4) {
+        this.addData.useArea = 0
+      }else {
+        this.addData.useArea = ''
+      }
+    },
     funSelectShow() {
       this.excludeBoxIds = this.addData.ticketBoxList.map(item => { return item.boxId })
       this.selectShow = true
@@ -279,6 +287,16 @@ export default {
           })
           return
         }
+      } else if (this.addData.type == 4) {
+        this.addData.minOrderAmt = null
+        this.addData.isNewUserCoupon = null
+        if (this.addData.useArea !== 2 && this.addData.useArea !== 0 && this.addData.useArea !== 1) {
+          this.$message({
+            message: '请选择使用范围!',
+            type: 'warning'
+          })
+          return
+        }
       }
       this.$refs.addItem.validate((valid, items) => {
         if (valid) {

+ 1 - 0
src/views/business/coupon/index.vue

@@ -14,6 +14,7 @@
           <el-option label="全部" value="" />
           <el-option label="盲票购买" :value="1" />
           <el-option label="门店消费" :value="2" />
+          <el-option label="采购商品核销" :value="4" />
         </el-select>
       </el-form-item>
       <el-form-item label="是否新用户注册发放">

+ 10 - 1
src/views/business/exchange/components/CouponAdd.vue

@@ -17,6 +17,14 @@
           @keyup.enter.native="getCouponList"
         />
         <div class="ge"></div>
+        <div>使用场景:</div>
+        <el-select v-model="type" placeholder="请选择使用场景" clearable @keyup.enter.native="getCouponList">
+          <el-option label="全部" value=""/>
+          <el-option label="门店消费" :value="2"/>
+          <el-option label="盲票购买" :value="1"/>
+          <el-option label="采购商品核销" :value="4"/>
+        </el-select>
+        <div class="ge"></div>
         <el-button
           type="primary"
           icon="el-icon-search"
@@ -106,6 +114,7 @@ export default {
   data() {
     return {
       loading: false,
+      type: '',
       couponTitle: "", // 券名称
       couponList: [], // 卡券列表
       couponTotal: 0, // 卡券总数
@@ -129,7 +138,7 @@ export default {
           "&pageSize=" +
           this.pageParams.pageSize +
           "&",
-        { title: this.couponTitle, status: "on" }
+        { title: this.couponTitle,type: this.type, status: "on" }
       ).then((res) => {
         this.couponList = res.rows.map((item) => {
           return {

+ 13 - 4
src/views/business/exchange/components/GoodsAdd.vue

@@ -66,14 +66,23 @@
           </template>
         </el-table-column>
         <el-table-column label="商品名称" prop="title" min-width="85" />
+        <el-table-column label="商品价格" min-width="85">
+          <template slot-scope="scope">
+            <div>¥{{ $numberFormat(scope.row.value) }}</div>
+          </template>
+        </el-table-column>
         <el-table-column label="商品类型" min-width="85">
           <template slot-scope="scope">
-            <div>{{ scope.row.type == 1 ? '实物商品':'卡密商品' }}</div>
+            <div v-if="scope.row.type == 1">实物商品</div>
+            <div v-if="scope.row.type == 2">卡密商品</div>
+            <div v-if="scope.row.type == 3">采购商品</div>
           </template>
         </el-table-column>
-        <el-table-column label="商品价格" min-width="85">
+        <el-table-column label="是否支持兑换" prop="exchangeShow" min-width="85">
           <template slot-scope="scope">
-            <div>¥{{ $numberFormat(scope.row.value) }}</div>
+            <div v-if="scope.row.exchangeShow == 1">支持兑换</div>
+            <div v-else-if="scope.row.exchangeShow == 0">不支持兑换</div>
+            <div v-else-if="scope.row.exchangeShow == 2">盲票商品</div>
           </template>
         </el-table-column>
         <el-table-column label="商品库存" prop="quantity" width="80" />
@@ -135,7 +144,7 @@ export default {
           "&pageSize=" +
           this.pageParams.pageSize +
           "&",
-        { title: this.goodsTitle, type: this.queryParams.type, status: "on", minValue: this.queryParams.minValue?accMul(this.queryParams.minValue, 100):this.queryParams.minValue, maxValue: this.queryParams.maxValue?accMul(this.queryParams.maxValue, 100):this.queryParams.maxValue,}
+        { isExcludePurchaseGoods: true,title: this.goodsTitle, type: this.queryParams.type, status: "on", minValue: this.queryParams.minValue?accMul(this.queryParams.minValue, 100):this.queryParams.minValue, maxValue: this.queryParams.maxValue?accMul(this.queryParams.maxValue, 100):this.queryParams.maxValue,}
       ).then((res) => {
         this.goodsList = res.rows.map((item) => {
           return {

+ 1 - 1
src/views/business/exchange/index.vue

@@ -75,7 +75,7 @@
       </el-table-column>
       <el-table-column label="激活日期" prop="activationTime">
         <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.activationTime) }}</span>
+          <span>{{ parseTime(scope.row.activationTime)||'--' }}</span>
         </template>
       </el-table-column>
       <el-table-column label="状态" prop="status" align="center">

+ 117 - 10
src/views/business/goods/add.vue

@@ -1,13 +1,14 @@
 <template>
   <div class="app-container goods-add">
     <el-divider content-position="left">商品信息</el-divider>
-    <el-form ref="addItem" :rules="rules" :model="addData" label-width="120px">
+    <el-form ref="addItem" :rules="rules" :model="addData" label-width="130px">
       <el-row :gutter="40" style="width: 500px">
         <el-col :span="23">
           <el-form-item label="商品类型:" prop="type">
-            <el-radio-group v-model="addData.type" :disabled="addData.goodsId ? true : false">
+            <el-radio-group v-model="addData.type" :disabled="addData.goodsId ? true : false" @input="typeChange">
               <el-radio :label="1">实物商品</el-radio>
               <el-radio :label="2">卡密商品</el-radio>
+              <el-radio :label="3">采购商品</el-radio>
             </el-radio-group>
           </el-form-item>
         </el-col>
@@ -36,8 +37,8 @@
             <!--            <div class="tip">关闭则不再兑换大厅显示,不支持盲豆兑换。</div>-->
             <el-radio-group v-model="addData.exchangeShow">
               <el-radio :label="0">不支持</el-radio>
-              <el-radio :label="1">支持</el-radio>
-              <el-radio :label="2">盲票商品</el-radio>
+              <el-radio :label="1" :disabled="addData.type == '3'">支持</el-radio>
+              <el-radio :label="2" :disabled="addData.type == '3'">盲票商品</el-radio>
             </el-radio-group>
           </el-form-item>
         </el-col>
@@ -68,6 +69,27 @@
 
         </el-col>
       </el-row>
+      <el-row :gutter="40" style="width: 600px" v-if="addData.type == '3'">
+        <el-col :span="23">
+          <el-form-item label="关联采购优惠券:" prop="refId">
+            <el-select
+              v-model="addData.refId" :disabled="addData.goodsId ? true : false"
+              placeholder="请选择采购优惠券"
+              filterable
+              clearable>
+              <el-option :label="item.title" :value="item.couponId" v-for="(item, index) in CouponList" :key="index">
+                <div>
+                  <span style="float: left; width: 130px; overflow: hidden; text-overflow: ellipsis;">{{ item.title }} </span>
+                  <span style="float: left; width: 110px; overflow: hidden; text-overflow: ellipsis;">¥{{ $numberFormat(item.discount) }}</span>
+                  <span style="float: right;">{{ item.channelSharedRate }}%</span>
+                </div>
+              </el-option>
+            </el-select>
+            <div class="tip">根据优惠券名称查询(优惠券名称--价格--门店承担比例)</div>
+          </el-form-item>
+        </el-col>
+      </el-row>
+
       <el-row :gutter="40" style="width: 500px">
         <el-col :span="23">
           <el-form-item label="商品采购链接:">
@@ -100,7 +122,7 @@
       <el-divider content-position="left">价格库存</el-divider>
       <el-row>
         <el-col :span="23">
-          <el-form-item label="启用多SKU:" v-if="addData.type == '1'">
+          <el-form-item label="启用多SKU:" v-if="addData.type == '1' || addData.type == '3'">
             <el-switch
               v-model="addData.multiSku"
               :active-value="1"
@@ -110,11 +132,16 @@
         </el-col>
       </el-row>
       <el-row>
-        <el-col :span="22">
+        <el-col :span="22" v-if="addData.type != 3">
           <el-form-item prop="skuList">
             <Spec ref="spec" @valid="update" :multiSku="addData.multiSku"/>
           </el-form-item>
         </el-col>
+        <el-col :span="22" v-else>
+          <el-form-item prop="skuList">
+            <SpeTwo ref="spec" @valid="update" :multiSku="addData.multiSku"/>
+          </el-form-item>
+        </el-col>
       </el-row>
 
       <el-row v-if="addData.multiSku === 0" :gutter="40" style="width: 600px">
@@ -125,6 +152,22 @@
             </el-input>
           </el-form-item>
         </el-col>
+        <el-col :span="23">
+          <el-form-item label="采购成本:" prop="purchaseCost" v-if="addData.type == '3'">
+            <el-input v-model="addData.purchaseCost" type="number" placeholder="请输入采购成本">
+              <template slot="append">元</template>
+            </el-input>
+            <div class="tip">注:指展示给经销商采购的成本,即商品的结算价格</div>
+          </el-form-item>
+        </el-col>
+        <el-col :span="23">
+          <el-form-item label="零售价:" prop="purchasePrice" v-if="addData.type == '3'">
+            <el-input v-model="addData.purchasePrice" type="number" placeholder="请输入零售价">
+              <template slot="append">元</template>
+            </el-input>
+            <div class="tip">注:指商品铺设给经销商的价格,仅作记录</div>
+          </el-form-item>
+        </el-col>
         <el-col :span="23">
           <el-form-item label="盲豆兑换数量:" prop="exchangePrice">
             <el-input v-model="addData.exchangePrice" type="number" placeholder="请输入盲豆数量">
@@ -160,7 +203,7 @@
           </el-form-item>
         </el-col>
         <el-col :span="23">
-          <el-form-item label="库存:" prop="quantity" v-if="addData.type == '1'">
+          <el-form-item label="库存:" prop="quantity" v-if="addData.type == '1' || addData.type == '3'">
             <el-input v-model="addData.quantity" type="number" placeholder="请输入商品库存">
               <template slot="append">件</template>
             </el-input>
@@ -199,8 +242,10 @@
 import Upload from '@/components/DragImageUpload'
 import WangEditor from '@/components/WangEditor'
 import Spec from './components/spec'
+import SpeTwo from './components/spec2'
 import TinyEditor from '@/components/TinyEditor'
 import {getGoodsDetail, addGoods} from '@/api/business/goods'
+import {getCouponAllList} from '@/api/business/coupon'
 import {goodsCategoryListTree} from '@/api/business/category'
 import {getSupplierList} from '@/api/business/supplier'
 import {goodsTagItems} from '@/api/business/tag'
@@ -214,6 +259,7 @@ export default {
     WangEditor,
     Upload,
     Spec,
+    SpeTwo,
     AddSupplier,
   },
   data() {
@@ -222,6 +268,7 @@ export default {
       id: this.$route.query.id,
       goodsCategoryItemsList: [],
       SupplierList: [],
+      CouponList: [],
       goodsTagItemsList: [],
       addData: {
         type: 1,
@@ -238,8 +285,25 @@ export default {
         supplierId: [{required: true, message: '请选择供应商', trigger: 'change'}],
         exchangeShow: [{required: true, message: '请选择是否支持盲豆兑换', trigger: 'change'}],
         multiSku: [{required: true, message: '请选择SKU类型', trigger: 'change'}],
+        refId: [{required: true, message: '请选择关联采购优惠券', trigger: 'change'}],
         value: [
-          {required: true, message: '请输商品入价格', trigger: 'blur'},
+          {required: true, message: '请输入商品价格', trigger: 'blur'},
+          {
+            pattern: /^([1-9]\d*(\.\d{1,2})?|([0](\.([0][1-9]|[1-9]\d{0,1}))))$/,
+            message: "请输入正确的金额,最多两位小数",
+            trigger: ["blur", "change"]
+          }
+        ],
+        purchaseCost: [
+        {required: true, message: '请输入采购成本', trigger: 'blur'},
+          {
+            pattern: /^([1-9]\d*(\.\d{1,2})?|([0](\.([0][1-9]|[1-9]\d{0,1}))))$/,
+            message: "请输入正确的金额,最多两位小数",
+            trigger: ["blur", "change"]
+          }
+        ],
+        purchasePrice: [
+          {required: true, message: '请输入零售价', trigger: 'blur'},
           {
             pattern: /^([1-9]\d*(\.\d{1,2})?|([0](\.([0][1-9]|[1-9]\d{0,1}))))$/,
             message: "请输入正确的金额,最多两位小数",
@@ -273,7 +337,6 @@ export default {
         ],
         description: [{required: true, message: '请输入商品详情', trigger: 'blur'}]
       },
-
     }
   },
   computed: {
@@ -322,7 +385,10 @@ export default {
           exchangeShow,
           multiSku,
           value,
+          refId,
           exchangePrice,
+          purchaseCost,
+          purchasePrice,
           originPrice,
           discountRate,
           cost,
@@ -337,10 +403,13 @@ export default {
         } = res.data
         this.addData = {
           value: accDiv(value, 100),
+          purchaseCost: type == '3' ? accDiv(purchaseCost, 100) : '',
+          purchasePrice: type == '3' ? accDiv(purchasePrice, 100) : '',
           cost: cost == '' || cost == null ? '' : accDiv(cost, 100),
           goodsId,
           title,
           type,
+          refId: refId ? Number(refId): '',
           goodsCode,
           picUrl,
           merchantInfo,
@@ -366,10 +435,45 @@ export default {
             this.$refs.spec.setSkuList(skuList)
           })
         }
+        this.getCouponList(refId)
       })
+    }else {
+      this.getCouponList()
     }
   },
   methods: {
+    typeChange(e) {
+      if(e == 2) {
+        this.addData.quantity = ''
+        this.addData.multiSku = 0
+        this.addData.purchaseCost = ''
+        this.addData.purchasePrice = ''
+        this.addData.refId = ''
+      }else if(e == 1){
+        this.addData.useLink = ''
+        this.addData.purchaseCost = ''
+        this.addData.purchasePrice = ''
+        this.addData.refId = ''
+      }else if(e == 3){
+        this.addData.useLink = ''
+        this.addData.exchangeShow = 0
+      }
+    },
+    // 获取采购优惠券下拉列表
+    getCouponList(refId) {
+      let data = {
+        type: 4,
+        status: "on",
+        isExcludePurchaseCoupon: true,
+      }
+      if(refId) {
+        data.couponId = refId
+      }
+      getCouponAllList(data).then(response => {
+        this.CouponList = response.rows || [];
+      });
+    },
+
     getGoodsCategoryItems() {
       goodsCategoryListTree("", {}).then(res => {
         this.goodsCategoryItemsList = res && res.rows
@@ -405,14 +509,17 @@ export default {
       this.$refs.addItem.validate((valid, items) => {
         if (valid) {
           this.addData.skuList = skuList
-          const {value, categoryId, cost, exchangePrice, description, ...rest} = this.addData
+          const {value, type, categoryId, purchaseCost, purchasePrice, cost, exchangePrice, description, ...rest} = this.addData
           addGoods({
             ...rest, ...{
               value: accMul(value, 100),
+              purchaseCost: type == '3' ? accMul(purchaseCost, 100) : '',
+              purchasePrice: type == '3' ? accMul(purchasePrice, 100) : '',
               cost: cost == '' || cost == null ? '' : accMul(cost, 100),
               exchangePrice: accMul(exchangePrice, 1),
               description: encodeURI(description),
               categoryId: categoryId[1],
+              type,
             }
           }).then(res => {
             if (res.code === 0) {

+ 2 - 2
src/views/business/goods/components/spec.vue

@@ -70,14 +70,14 @@
               <el-input v-model="sku.valueY" />
             </el-form-item>
           </td>
-          <td>
+          <td class="pd">
             <el-form-item :prop="`skuList.${index}.exchange`" :rules="exchangeRules">
 <!--              <p>{{ (sku.valueY * 10).toFixed(0) }}</p>-->
               <el-input v-model="sku.exchange" />
             </el-form-item>
           </td>
 <!--          1111111111111111111111-->
-          <td>
+          <td class="pd">
             <el-form-item :prop="`skuList.${index}.discountRate`" :rules="discountRateRules">
               <!--              <p>{{ (sku.valueY * 10).toFixed(0) }}</p>-->
               <el-input v-model="sku.discountRate" />

+ 399 - 0
src/views/business/goods/components/spec2.vue

@@ -0,0 +1,399 @@
+<template>
+  <div v-if="multiSku === 1" style="padding: 16px 0px">
+    <el-form ref="spec" :model="{ specList }" :inline="false" label-width="80px" @submit.native.prevent>
+      <div v-for="(spec, index) in specList" :key="index" style="margin-bottom: 20px">
+        <el-row style="margin-bottom: 10px">
+          <el-col :span="8">
+            <el-form-item :label="`规格项${index + 1}`" :prop="`specList.${index}.name`" :rules="{ required: true, message: '请输入规格名称', trigger: 'blur' }">
+              <el-input v-model="spec.name" :disabled="!spec.edit" @keyup.enter.native="checkSpecName(spec)" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="16">
+            <el-button v-if="spec.edit" type="text" style="margin-left: 10px" @click="checkSpecName(spec)">确定</el-button>
+            <template v-else>
+              <el-button type="text" style="margin-left: 10px" @click="spec.edit = true">编辑</el-button>
+              <el-button type="text" class="del" style="margin-left: 10px" @click="specList.splice(index, 1)">删除</el-button>
+            </template>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-form-item :prop="`specList.${index}.vals`">
+            <el-col :span="24">
+              <el-tag v-for="(tag, index) in spec.vals" :key="index" closable style="margin-right: 10px" @close="spec.vals.splice(index, 1)">{{ tag }}</el-tag>
+              <el-input v-if="spec.editVals" v-model="specValTmp" v-focus style="display: inline-block;width: 120px; margin-right: 10px" size="mini" @keyup.enter.native="checkSpecVal(spec, `specList.${index}.vals`)" />
+              <el-button v-if="!spec.edit&&!spec.editVals" type="text" style="margin-left: 10px" icon="el-icon-plus" size="small" @click="spec.editVals = true">添加规格值</el-button>
+              <el-button v-if="spec.editVals" type="text" @click="checkSpecVal(spec, `specList.${index}.vals`)">确认</el-button>
+              <el-button v-if="spec.editVals" type="text" @click="spec.editVals = false;specValTmp = ''">取消</el-button>
+            </el-col>
+          </el-form-item>
+        </el-row>
+      </div>
+    </el-form>
+    <el-button type="primary" size="small" plain @click="specList.push({ name: '', vals: [], edit: true, editVals: false })" :disabled="!!specList.find(item => item.edit)" style="margin-bottom: 10px">添加规格</el-button>
+    <el-button type="primary" size="small" style="margin-bottom: 10px;margin-left: 10px" :disabled="specList.length === 0 || !!specList.find(item => item.edit)" @click="genSku">{{ skuList.length > 0 ? '重新生成SKU表格' : '生成SKU表格' }}</el-button>
+    <br>
+    <el-form ref="sku" :model="{ skuList }" :inline="false">
+      <table v-if="skuList instanceof Array && skuList.length > 0" class="spec-table" border="1" bordercolor="#CCC">
+        <tr>
+          <th :colspan="specListTmp.length">商品规格</th>
+          <th rowspan="2" class="required"><span>*</span>SKU主图</th>
+          <th rowspan="2" class="required"><span>*</span>名称</th>
+          <th rowspan="2" class="required"><span>*</span>价格(元)</th>
+          <th rowspan="2" class="required"><span>*</span>采购成本(元)</th>
+          <th rowspan="2" class="required"><span>*</span>零售价(元)</th>
+          <th rowspan="2" class="required"><span>*</span>兑换盲豆数量</th>
+          <th rowspan="2" class="required"><span>*</span>回收折扣(%)</th>
+          <th rowspan="2">盲豆划线价</th>
+          <th rowspan="2">商品成本(元)</th>
+          <th rowspan="2">SKU编码</th>
+          <th rowspan="2" class="required"><span>*</span>库存</th>
+          <th rowspan="2">启用</th>
+        </tr>
+        <tr>
+          <th v-for="(spec, index) in specListTmp" :key="index" style="width: 80px">{{ spec.name }}</th>
+        </tr>
+        <!-- k1:v1;k2:v2 -->
+        <tr v-for="(sku, index) in skuList" :key="index">
+          <td v-for="(spec, i) in specListTmp" :key="i" style="min-width: 50px">
+            {{ formatObj(sku.properties)[spec.name] }}
+          </td>
+          <td>
+            <el-form-item :prop="`skuList.${index}.picUrlArr`" :rules="{ required: true, message: '请上传SKU图片', trigger: ['blur', 'change'] }" style="display:flex ;width: 76px;height: 80px">
+              <Upload v-model="sku.picUrlArr" :limit="1" style="width: 100%" @change="$refs.sku.validateField([`skuList.${index}.picUrlArr`])" />
+            </el-form-item>
+          </td>
+          <td class="pd">
+            <el-form-item :prop="`skuList.${index}.name`" :rules="{ required: true, message: '名称不能为空', trigger: 'blur' }">
+              <el-input v-model="sku.name" />
+            </el-form-item>
+          </td>
+          <td class="pd">
+            <el-form-item :prop="`skuList.${index}.valueY`" :rules="valueYRules">
+              <el-input v-model="sku.valueY" />
+            </el-form-item>
+          </td>
+          <td class="pd">
+            <el-form-item :prop="`skuList.${index}.purchaseCostY`" :rules="purchaseCostYRules">
+              <el-input v-model="sku.purchaseCostY" />
+            </el-form-item>
+          </td>
+          <td class="pd">
+            <el-form-item :prop="`skuList.${index}.purchasePriceY`" :rules="purchasePriceYRules">
+              <el-input v-model="sku.purchasePriceY" />
+            </el-form-item>
+          </td>
+          <td class="pd">
+            <el-form-item :prop="`skuList.${index}.exchange`" :rules="exchangeRules">
+<!--              <p>{{ (sku.valueY * 10).toFixed(0) }}</p>-->
+              <el-input v-model="sku.exchange" />
+            </el-form-item>
+          </td>
+<!--          1111111111111111111111-->
+          <td class="pd">
+            <el-form-item :prop="`skuList.${index}.discountRate`" :rules="discountRateRules">
+              <!--              <p>{{ (sku.valueY * 10).toFixed(0) }}</p>-->
+              <el-input v-model="sku.discountRate" />
+            </el-form-item>
+          </td>
+          <td class="pd">
+            <el-form-item :prop="`skuList.${index}.originPrice`">
+              <el-input v-model="sku.originPrice" />
+            </el-form-item>
+          </td>
+          <td class="pd">
+            <el-form-item :prop="`skuList.${index}.costY`" :rules="costYRules">
+              <el-input v-model="sku.costY" />
+            </el-form-item>
+          </td>
+          <td class="pd">
+            <el-form-item :prop="`skuList.${index}.skuCode`">
+              <el-input v-model="sku.skuCode" />
+            </el-form-item>
+          </td>
+          <td class="pd">
+            <el-form-item :prop="`skuList.${index}.quantity`" :rules="{ required: true, message: '请输入库存', trigger: 'blur' }">
+              <el-input-number style="width: 130px;" v-model="sku.quantity" :min="0" @change="$event === 0 ? sku.status = false : sku.status = true" />
+            </el-form-item>
+          </td>
+          <td style="padding: 0px 10px">
+            <el-form-item :prop="`skuList.${index}.status`">
+              <el-switch v-model="sku.status" active-color="#13ce66" inactive-color="#ff4949" @change="!$event ? sku.quantity = 0 : sku.quantity = 1" />
+            </el-form-item>
+          </td>
+        </tr>
+      </table>
+    </el-form>
+  </div>
+</template>
+<script>
+import Upload from '@/components/ImageUpload'
+import { accMul, accDiv } from '@/utils/util'
+export default {
+  name: 'Spec',
+  components: {
+    Upload
+  },
+  props: {
+    multiSku: {
+      type: Number,
+      default: 0
+    },
+    sku: {
+      type: Array,
+      default: () => []
+    }
+  },
+  data() {
+    return {
+      specList: [],
+      specListTmp: [],
+      skuList: [],
+      specValTmp: '',
+      specifications: [],
+      valueYRules: [
+        { required: true, message: '请输入价格', trigger: 'blur' },
+        { pattern: /^([1-9]\d*(\.\d{1,2})?|([0](\.([0][1-9]|[1-9]\d{0,1}))))$/, message: "请输入正确的金额,最多两位小数", trigger: ["blur", "change"]}],
+      purchaseCostYRules: [
+        { required: true, message: '请输入采购成本', trigger: 'blur' },
+        { pattern: /^([1-9]\d*(\.\d{1,2})?|([0](\.([0][1-9]|[1-9]\d{0,1}))))$/, message: "请输入正确的金额,最多两位小数", trigger: ["blur", "change"]}],
+      purchasePriceYRules: [
+        { required: true, message: '请输入零售价', trigger: 'blur' },
+        { pattern: /^([1-9]\d*(\.\d{1,2})?|([0](\.([0][1-9]|[1-9]\d{0,1}))))$/, message: "请输入正确的金额,最多两位小数", trigger: ["blur", "change"]}],
+      costYRules: [
+        { required: false, message: '请输入商品成本', trigger: 'blur' },
+        { pattern: /^([1-9]\d*(\.\d{1,2})?|([0](\.([0][1-9]|[1-9]\d{0,1}))))$/, message: "请输入正确的金额,最多两位小数", trigger: ["blur", "change"] }],
+      exchangeRules: [
+        { required: true,message:'请输入盲豆数量', trigger: 'blur' },
+        { pattern: /^([1-9]\d*)$/, message: "请输入正确的盲豆数量", trigger: ["blur", "change"] }
+      ],
+      discountRateRules: [
+        { required: true,message:'请输入回收折扣', trigger: 'blur' },
+        { pattern: /^([0-9]\d*(\.\d{1,2})?|([0](\.([0][1-9]|[1-9]\d{0,1}))))$/, message: "请输入正确的折扣,最多两位小数", trigger: ["blur", "change"] }
+      ]
+    }
+  },
+  directives: {
+    focus: {
+      inserted: function (el) {
+        el.querySelector('input').focus()
+      }
+    }
+  },
+  methods: {
+    setSkuList(sku) {
+      let specObj = {}
+      sku.forEach(item => {
+        item.properties.split(';').forEach(p => {
+          const key = p.split(':')[0]
+          // console.log(specObj[key] instanceof Array)
+          if (!specObj[key]) {
+            specObj[key] = []
+            // console.log(specObj[key])
+          }
+          specObj[key].push(p.split(':')[1])
+        })
+      })
+      this.specList = Object.keys(specObj).map(key => {
+        return {
+          name: key,
+          vals: [...new Set(specObj[key])],
+          edit: false,
+          editVals: false
+        }
+      })
+      this.specListTmp = JSON.parse(JSON.stringify(this.specList))
+      this.skuList = sku.map(item => {
+        this.$set(item, 'valueY', accDiv(item.value, 100))
+        this.$set(item, 'purchaseCostY', accDiv(item.purchaseCost,100))
+        this.$set(item, 'purchasePriceY', accDiv(item.purchasePrice,100))
+        this.$set(item, 'exchange', accDiv(item.exchangePrice,1))
+        this.$set(item, 'originPrice', accDiv(item.originPrice,1))
+        this.$set(item, 'discountRate', accDiv(item.discountRate,1))
+        this.$set(item, 'costY', item.cost == null ? '' : accDiv(item.cost, 100) )
+        this.$set(item, 'picUrlArr', item.picUrl.split(',').map(item => { return { fileName: item }}))
+        this.$set(item, 'status', !!item.quantity)
+        return item
+      })
+    },
+    formatObj(properties) {
+      if (properties) {
+        let obj = {}
+        properties.split(';').forEach(item => {
+          obj[item.split(':')[0]] = item.split(':')[1]
+        })
+        return obj
+      }
+      return {}
+    },
+    checkSpecVal(spec, prop) {
+      if (!this.specValTmp) {
+        this.$message.warning('请输入规格值')
+        return
+      }
+      if (spec.vals.find(item => item === this.specValTmp)) {
+        this.$message.warning('规格值已存在')
+        return
+      }
+      spec.vals.push(this.specValTmp)
+      this.specValTmp = ''
+      spec.editVals = false
+      this.$refs.spec.validateField([prop])
+    },
+    checkSpecName(spec) {
+      if (this.specList.filter(item => item.name === spec.name).length > 1) {
+        this.$message.warning('规格名已存在')
+      } else {
+        spec.edit = false
+      }
+    },
+    genSku() {
+      this.$refs.spec.validate((valid, items) => {
+        if (valid) {
+          this.genSkuList()
+        }
+      })
+    },
+    genSkuList() {
+      let specificationsTmp = []
+      this.specList.forEach(spec => {
+        spec.vals.forEach(val => {
+          specificationsTmp.push({
+            specification: spec.name,
+            value: val
+          })
+        })
+      })
+      var specValues = []
+      var spec = specificationsTmp[0].specification
+      var values = []
+      values.push(0)
+
+      for (var i = 1; i < specificationsTmp.length; i++) {
+        const aspec = specificationsTmp[i].specification
+
+        if (aspec === spec) {
+          values.push(i)
+        } else {
+          specValues.push(values)
+          spec = aspec
+          values = []
+          values.push(i)
+        }
+      }
+      specValues.push(values)
+      var productsIndex = 0
+      var skuList = []
+      var combination = []
+      var n = specValues.length
+      for (var s = 0; s < n; s++) {
+        combination[s] = 0
+      }
+      var index = 0
+      var isContinue = false
+      do {
+        var specifications = []
+        var properties = ''
+        for (var x = 0; x < n; x++) {
+          var z = specValues[x][combination[x]]
+          specifications.push(specificationsTmp[z].value)
+          properties = `${properties ? (properties + ';') : ''}${specificationsTmp[z].specification}:${specificationsTmp[z].value}`
+        }
+        skuList[productsIndex] = {
+          idx: productsIndex,
+          name: specifications.toString(),
+          picUrlArr: [],
+          valueY: 0.00,
+          purchaseCostY: 0.00,
+          purchasePriceY: 0.00,
+          costY: '',
+          skuCode:'',
+          originPrice: 0,
+          discountRate: '',
+          quantity: 0,
+          status: true,
+          properties
+        }
+        productsIndex++
+
+        index++
+        combination[n - 1] = index
+        for (var j = n - 1; j >= 0; j--) {
+          if (combination[j] >= specValues[j].length) {
+            combination[j] = 0
+            index = 0
+            if (j - 1 >= 0) {
+              combination[j - 1] = combination[j - 1] + 1
+            }
+          }
+        }
+        isContinue = false
+        for (var p = 0; p < n; p++) {
+          if (combination[p] !== 0) {
+            isContinue = true
+          }
+        }
+      } while (isContinue)
+      this.skuList = skuList
+      this.specListTmp = JSON.parse(JSON.stringify(this.specList))
+    },
+    getSkuList() {
+      if (this.skuList.length === 0) {
+        this.$message.warning('请完善规格并生成sku表格')
+        return false
+      }
+      this.$refs.sku.validate((valid, items) => {
+        if (valid) {
+          this.skuList.forEach(item => {
+            const { valueY,exchange, purchaseCostY,purchasePriceY,costY, originPrice, discountRate } = item
+            item.value = accMul(valueY, 100)
+            item.purchaseCost = accMul(purchaseCostY, 100)
+            item.purchasePrice = accMul(purchasePriceY, 100)
+            item.exchangePrice = accMul(exchange, 1)
+            item.originPrice = accMul(originPrice, 1)
+            item.discountRate = accMul(discountRate, 1)
+            item.cost = costY == '' ? '' : accMul(costY, 100)
+            item.picUrl = item.picUrlArr.map(item => { return item.fileName }).toString()
+          })
+          this.$emit('valid', this.skuList)
+        } else {
+          if (items && Object.keys(items).length>0) {
+            this.$message({
+              message: items[Object.keys(items)[0]][0].message,
+              type: 'warning'
+            })
+          }
+        }
+      })
+    }
+  }
+}
+</script>
+<style lang="scss" scoped>
+.spec-table {
+  border-collapse: collapse;
+  width: 100%;
+  line-height: 32px;
+  color: #606266;
+  font-size: 14px;
+  th {
+    background-color: #ECECEC;
+  }
+  td {
+    text-align: center;
+  }
+  .pd {
+    padding: 10px;
+  }
+  .required {
+    position: relative;
+    span {
+      position: relative;
+      top: -6px;
+      left: 2px;
+      font-size: 10px;
+      color: red;
+    }
+  }
+
+}
+</style>

+ 3 - 1
src/views/business/goods/index.vue

@@ -25,6 +25,7 @@
           <el-option label="全部" value=""/>
           <el-option label="实物商品" value="1"/>
           <el-option label="卡密商品" value="2"/>
+          <el-option label="采购商品" value="3"/>
         </el-select>
       </el-form-item>
       <el-form-item label="商品分类" prop="categoryIdList">
@@ -149,6 +150,7 @@
         <template slot-scope="{row}">
           <span v-if="row.type == '1'">实物商品</span>
           <span v-if="row.type == '2'">卡密商品</span>
+          <span v-if="row.type == '3'">采购商品</span>
         </template>
       </el-table-column>
       <el-table-column label="盲豆兑换数量" prop="exchangePrice" sortable="custom" min-width="125"/>
@@ -170,7 +172,7 @@
       </el-table-column>
       <el-table-column fixed="right" align="center" label="操作" width="140">
         <template slot-scope="{row}">
-          <el-button  v-hasPermi="['business:goods:edit']" type="text" @click="toAssociation(row.goodsId)">查看关联盲票</el-button>
+          <el-button  v-hasPermi="['business:goods:edit']" type="text" v-if="row.type != 3" @click="toAssociation(row.goodsId)">查看关联盲票</el-button>
           <!-- <el-button v-hasPermi="['business:goods:query']" type="text">查看</el-button> -->
           <el-button v-hasPermi="['business:goods:edit']" type="text" @click="handleCamilo(row.goodsId)" v-if="row.type === 2">
             查看卡密

+ 114 - 0
src/views/business/inventory/components/InventoryGoods.vue

@@ -0,0 +1,114 @@
+<template>
+  <div>
+    <el-dialog title="结算采购订单" :visible.sync="inventoryShow" width="500px" :before-close="close">
+      <el-form :model="form" ref="form" :rules="rules" label-width="150px">
+        <el-form-item label="订单号:">
+          <span>{{ inventoryInfo.orderId }}</span>
+        </el-form-item>
+        <el-form-item label="总库存:">
+          <span>{{ inventoryInfo.totalQuantity }}件</span>
+        </el-form-item>
+        <el-form-item label="已核销:">
+          <span>{{ inventoryInfo.totalVerifyQty }}件</span>
+        </el-form-item>
+        <el-form-item label="需结算:">
+          <span>{{ inventoryInfo.totalRemainQty }}件</span>
+        </el-form-item>
+        <el-form-item label="采购成本:">
+          <span>¥{{ $numberFormat(inventoryInfo.items[0].purchaseCost) }}</span>
+        </el-form-item>
+        <el-form-item label="门店应付金额:">
+          <span>¥{{ $numberFormat(inventoryInfo.totalPurchaseCost) }}</span>
+        </el-form-item>
+        <el-form-item label="实际结算金额:" prop="settleAmt">
+          <el-input v-model="form.settleAmt" type="number" style="width: 180px" placeholder="请输入金额">
+              <template slot="append">元</template>
+            </el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="close">取 消</el-button>
+        <el-button type="primary" :disabled="loading" @click="saveClick">向门店发送账单</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+<script>
+import {accDiv, accMul} from '@/utils/util'
+import { storeInventory } from "@/api/business/inventory";
+export default {
+  props: {
+    // 弹框显示
+    inventoryShow: {
+      type: Boolean,
+      default: false,
+    },
+    // 订单详情
+    inventoryInfo: {
+      type: Object,
+      default: {},
+    },
+  },
+  created() {
+    this.form.settleAmt = this.inventoryInfo.totalPurchaseCost/100
+  },
+  data() {
+    return {
+      info: {},
+      loading: false,
+      form: {
+        settleAmt: "",
+      },
+      rules: {
+        settleAmt: [
+          { required: true, message: "请输入金额", trigger: "blur" },
+          {
+            pattern: /^([1-9]\d*(\.\d{1,2})?|([0](\.([0][1-9]|[1-9]\d{0,1}))))$/,
+            message: "请输入正确的金额,最多两位小数",
+            trigger: ["blur", "change"]
+          }
+        ],
+      },
+    };
+  },
+  methods: {
+    // 关闭发货弹框
+    close() {
+      this.$emit("close");
+      this.loading = false;
+    },
+
+    // 确认
+    saveClick() {
+      this.loading = true;
+      const form = this.$refs["form"];
+      form.validate((valid) => {
+        if (valid) {
+          let data = {
+            settleAmt: accMul(this.form.settleAmt, 100),
+            orderId: this.inventoryInfo.orderId,
+          };
+          storeInventory(data)
+            .then((res) => {
+              if (res.code == 0) {
+                this.msgSuccess("发送成功");
+                this.close();
+              }
+            })
+            .catch(() => {
+              this.loading = false;
+            });
+        } else {
+          this.loading = false;
+          // 提示第一个error
+          this.getFormErrorMessage(form);
+          return false;
+        }
+      });
+    },
+
+  },
+};
+</script>
+<style>
+</style>

+ 275 - 0
src/views/business/inventory/detail.vue

@@ -0,0 +1,275 @@
+<template>
+  <div class="app-container">
+    <!-- 基本信息 -->
+    <el-row :gutter="10">
+      <el-col :span="22" :offset="1">
+        <div class="info-title">基本信息</div>
+        <el-col :span="8" :offset="1" :xs="{span: 24, offset: 0}">
+          <div class="title">手机号码:{{ info.tel }}</div>
+        </el-col>
+        <el-col :span="8" :xs="{span: 24, offset: 0}">
+          <div class="title">门店名称:{{ info.channelName }}</div>
+        </el-col>
+      </el-col>
+    </el-row>
+
+    <!-- 库存信息 -->
+    <el-row :gutter="10" >
+      <el-col :span="22" :offset="1">
+        <div class="info-title">库存信息</div>
+        <el-col :span="8" :offset="1" :xs="{span: 24, offset: 0}">
+          <div class="title">总库存:{{ info.totalQuantity }}</div>
+        </el-col>
+        <el-col :span="7" :xs="{span: 24, offset: 0}">
+          <div class="title">已核销:{{ info.totalVerifyQty }}</div>
+        </el-col>
+        <el-col :span="8" :xs="{span: 24, offset: 0}">
+          <div class="title">剩余库存:{{ info.totalRemainQty }}</div>
+        </el-col>
+        <el-col :span="8" :offset="1" :xs="{span: 24, offset: 0}">
+          <div class="title">采购成本:¥{{ $numberFormat(info.items && info.items[0].purchaseCost) }}</div>
+        </el-col>
+        <el-col :span="7" :xs="{span: 24, offset: 0}" v-if="(status && status.value == 2) || (status && status.value == 3)">
+          <div class="title">结算库存:{{ info.totalSettleQty }}</div>
+        </el-col>
+        <el-col :span="8" :offset="1" :xs="{span: 24, offset: 0}" v-if="(status && status.value == 2) || (status && status.value == 3)">
+          <div class="title">门店应付金额:¥{{ $numberFormat(info.totalPurchaseCost) }}</div>
+        </el-col>
+        <el-col :span="7" :xs="{span: 24, offset: 0}" v-if="(status && status.value == 2) || (status && status.value == 3)">
+          <div class="title">实际结算金额:¥{{ $numberFormat(info.payAmount) }}</div>
+        </el-col>
+      </el-col>
+    </el-row>
+
+    <!-- 订单状态 -->
+    <el-row :gutter="10">
+      <el-col :span="22" :offset="1">
+        <div class="info-title">状态</div>
+        <el-col :span="24" :offset="1" :xs="{span: 24, offset: 0}">
+          <div class="title">状态:{{ status.desc }}</div>
+        </el-col>
+        <el-col :span="24" :offset="1" :xs="{span: 24, offset: 0}" v-if="status && status.value == 2">
+          <div class="title">支付金额:¥{{ $numberFormat(info.payAmount) }}</div>
+        </el-col>
+        <el-col :span="24" :offset="1" :xs="{span: 24, offset: 0}" v-if="(status && status.value == 2) || (status && status.value == 3)">
+          <div class="title">发起结算时间:{{ parseTime(info.pushTime) }}</div>
+        </el-col>
+        <el-col :span="24" :offset="1" :xs="{span: 24, offset: 0}" v-if="status && status.value == 2">
+          <div class="title">结算时间:{{ parseTime(info.settleTime) || '--' }}</div>
+        </el-col>
+        <el-col :span="24" :offset="1" :xs="{span: 24, offset: 0}" style="margin-bottom: 10px;">
+          <el-button
+        v-if="status && status.value == 1"
+          v-hasPermi="['business:channelGoodsOrder:push']"
+          type="primary"
+          @click="toInventory()"
+        >去结算</el-button>
+        </el-col>
+        
+      </el-col>
+    </el-row>
+
+        <!-- 商品信息 -->
+    <el-row :gutter="10">
+      <el-col :span="22" :offset="1">
+         <div class="info">
+      <div class="info-title">商品信息</div>
+      <div class="info-table">
+        <el-table :data="list">
+          <el-table-column label="商品信息" min-width="200">
+            <div slot-scope="{ row }" class="flex">
+              <el-image
+                style="width: 100px; height: 100px"
+                :src="row.picUrl"
+                :preview-src-list="[row.picUrl]"
+              />
+              <div class="txt">{{ row.title }}</div>
+            </div>
+          </el-table-column>
+          <el-table-column label="规格" min-width="100">
+            <template slot-scope="{ row }">
+              <div>{{ row.properties || "--" }}</div>
+            </template>
+          </el-table-column>
+          <el-table-column label="采购成本(单价)" prop="purchaseCost" min-width="80">
+            <template slot-scope="{ row }">
+              <div>¥{{ $numberFormat(row.purchaseCost) }}</div>
+            </template>
+          </el-table-column>
+            <el-table-column label="库存" prop="quantity" min-width="80"/>
+            <el-table-column label="已核销" prop="verifyQty" min-width="80"/>
+            <el-table-column label="剩余库存" prop="remainQty" min-width="80"/>
+        </el-table>
+      </div>
+    </div>
+      </el-col>
+    </el-row>
+    <!-- 结算 -->
+    <inventory-goods :inventory-show="inventoryShow" :inventory-info="info" @close="close" v-if="inventoryShow"/>
+  </div>
+</template>
+<script>
+import { getInventoryDetail } from "@/api/business/inventory";
+import { publicFileGetUrl } from "@/api/common";
+import InventoryGoods from "./components/InventoryGoods";
+export default {
+  name: "InventoryDetail",
+  components: {
+    InventoryGoods,
+  },
+  data() {
+    return {
+      // 订单ID
+      orderId: "",
+      // 订单详情
+      info: {},
+      // 订单状态
+      status: {},
+      // 商品信息列表
+      list: [],
+      // 结算显示
+      inventoryShow: false,
+    };
+  },
+  created() {
+    this.orderId = this.$route.query.id;
+    this.getDetail();
+  },
+  activated() {
+    const orderId = this.$route.query.id;
+    if (orderId != null && orderId != this.orderId) {
+      this.orderId = orderId;
+      this.getDetail();
+    }
+  },
+  methods: {
+    // 订单详情
+    getDetail() {
+      getInventoryDetail(this.orderId).then((res) => {
+        if (res.code == 0) {
+          this.info = res.data;
+          this.status = JSON.parse(res.data.status);
+          res.data.items &&
+            res.data.items.forEach((item) => {
+              let picUrlArr = item.picUrl.split(",");
+              item.picUrl = publicFileGetUrl + picUrlArr[0];
+            });
+          this.list = res.data.items;
+        }
+      });
+    },
+
+    // 点击发货
+    toInventory() {
+      this.inventoryShow = true;
+    },
+
+    // 发货关闭
+    close() {
+      this.inventoryShow = false;
+      this.getDetail();
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+.title {
+  line-height: 30px;
+  text-align: left;
+}
+.edit-express {
+  color: #409eff;
+  cursor: pointer;
+}
+
+.info {
+  margin-bottom: 10px;
+  &-title {
+    font-size: 14px;
+    margin-bottom: 20px;
+    font-weight: bold;
+  }
+  &-item {
+    padding-left: 50px;
+    &-content {
+      display: flex;
+
+      &-one {
+        display: flex;
+        margin-bottom: 10px;
+
+        .title {
+          //width: 100px;
+        }
+
+        .txt {
+          //width: 200px;
+        }
+      }
+    }
+
+    &-logistics {
+      margin-bottom: 20px;
+      .logistics-title {
+        text-align: left;
+        font-weight: bold;
+        margin-bottom: 20px;
+      }
+      .info {
+        display: flex;
+        margin-bottom: 10px;
+        &-one {
+          display: flex;
+        }
+        .tit {
+          line-height: 22px;
+          //width: 100px;
+        }
+        .txt {
+          line-height: 22px;
+          //width: 200px;
+        }
+        .edit-express{
+          color: #409eff;
+          cursor: pointer;
+        }
+      }
+      .goods {
+        margin: 10px 0;
+        &-item {
+          display: flex;
+          border-bottom: 1px solid #f3eeee;
+          img {
+            width: 100px;
+            height: 100px;
+          }
+          .info {
+            padding-left: 20px;
+            display: flex;
+            flex-direction: column;
+            height: 100px;
+            justify-content: space-between;
+          }
+        }
+      }
+    }
+  }
+  &-amt {
+    margin-top: 10px;
+    &-price {
+      span {
+        display: inline-block;
+        width: 80px;
+        margin-bottom: 20px;
+      }
+    }
+  }
+}
+.flex {
+  display: flex;
+  align-items: center;
+  .txt {
+    margin-left: 20px;
+  }
+}
+</style>

+ 325 - 0
src/views/business/inventory/index.vue

@@ -0,0 +1,325 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="90px">
+      <el-form-item label="门店" prop="channelId">
+        <el-select v-model="queryParams.channelId" placeholder="请选择门店" style="width: 100%;" filterable clearable :filter-method="dataFilter" @change="pageParams.pageNum = 1;handleQuery()">
+          <el-option v-for="(item) in siteList" :key="item.channelId" :label="item.name" :value="item.channelId">
+            <div>
+              <span style="float: left;">{{item.name}} </span>
+              <span style="float: right;">{{item.mobile}}</span>
+            </div>
+          </el-option>
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="商品名称">
+        <el-input v-model="queryParams.title" placeholder="请输入商品名称" clearable size="small" style="width: 240px" @change="pageParams.pageNum = 1;handleQuery()" />
+      </el-form-item>
+      <el-form-item label="订单号">
+        <el-input v-model="queryParams.orderId" placeholder="输入订单编号" clearable size="small" style="width: 240px" @change="pageParams.pageNum = 1;handleQuery()" />
+      </el-form-item>
+      <el-form-item label="入库时间">
+        <el-date-picker v-model="tradeTimeArr" type="datetimerange" size="small" value-format="timestamp" range-separator="至" start-placeholder="时间选择" end-placeholder="时间选择" @change="tardeTime">
+        </el-date-picker>
+      </el-form-item>
+      <!-- <el-form-item label="手机号码">
+        <el-input v-model="queryParams.tel" placeholder="输入手机号" clearable size="small" style="width: 240px" @change="pageParams.pageNum = 1;handleQuery()" />
+      </el-form-item> -->
+      <el-form-item label="状态">
+        <el-select v-model="queryParams.settleStatus" placeholder="请选择" clearable @change="pageParams.pageNum = 1;handleQuery()">
+          <el-option label="全部" value="" />
+          <el-option label="未结算" value="1" />
+          <el-option label="结算中" value="3" />
+          <el-option label="已结算" value="2" />
+          <el-option label="核销完成" value="4" />
+        </el-select>
+      </el-form-item>
+      <br>
+      <el-form-item label="剩余库存">
+        <el-input v-model="queryParams.minStock" placeholder="最小值" @change="pageParams.pageNum = 1;handleQuery()" clearable @keyup.enter.native="pageParams.pageNum = 1;handleQuery()" />
+      </el-form-item>
+      <el-form-item label="-" label-width="6px">
+        <el-input v-model="queryParams.maxStock" placeholder="最大值" @change="pageParams.pageNum = 1;handleQuery()" clearable @keyup.enter.native="pageParams.pageNum = 1;handleQuery()" />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="pageParams.pageNum = 1;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">
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+    <!-- 列表 -->
+    <el-table ref="table" v-loading="loading" :data="list">
+      <!-- 展开盲票组列表 -->
+      <el-table-column type="expand">
+        <template slot-scope="{ row }">
+          <el-table :data="row.items" row-key="itemId">
+            <el-table-column label="商品图片" min-width="80">
+              <div slot-scope="{ row }">
+                <el-image style="width: 100px; height: 100px" :src="row.picUrl" :preview-src-list="[row.picUrl]" />
+              </div>
+            </el-table-column>
+            <el-table-column label="商品名称" prop="title" min-width="80" />
+            <el-table-column label="规格" min-width="100">
+              <template slot-scope="{ row }">
+                <div>{{ row.properties || "--" }}</div>
+              </template>
+            </el-table-column>
+            <el-table-column label="采购成本(单价)" prop="purchaseCost" min-width="80" >
+              <template slot-scope="{ row }">
+                <div>¥{{ $numberFormat(row.purchaseCost) }}</div>
+              </template>
+            </el-table-column>
+            <el-table-column label="库存" prop="quantity" min-width="80" />
+            <el-table-column label="已核销" prop="verifyQty" min-width="80" />
+            <el-table-column label="剩余库存" prop="remainQty" min-width="80" />
+          </el-table>
+        </template>
+      </el-table-column>
+      <!-- 不展开列表 -->
+      <el-table-column label="订单号" prop="orderId" min-width="110" />
+      <el-table-column label="入库时间" min-width="110">
+        <template slot-scope="{ row }">
+          <div>{{ row.items && row.items[0] && parseTime(row.items[0].createdTime) }}</div>
+        </template>
+      </el-table-column>
+      <el-table-column label="门店(手机号)" prop="channelName" min-width="120" >
+        <template slot-scope="{ row }">
+          <div>{{ row.channelName+'('+row.mobile+')' }}</div>
+        </template>
+      </el-table-column>
+      <el-table-column label="总库存" prop="totalQuantity" min-width="50" />
+      <el-table-column label="总已核销" prop="totalVerifyQty" min-width="50" />
+      <el-table-column label="剩余总库存" prop="totalRemainQty" min-width="55" />
+      <!-- <el-table-column label="总采购成本" min-width="70">
+        <template slot-scope="{ row }">
+          <div>¥{{ $numberFormat(row.totalPurchaseCost) }}</div>
+        </template>
+      </el-table-column> -->
+      <el-table-column label="结算库存" prop="totalSettleQty" min-width="50" />
+      <el-table-column label="状态" align="center">
+        <template slot-scope="{ row }">
+          <div>
+            <el-tag :type="row.status.value == 1? 'success' : 'info'" v-if="row.status">{{
+                row.status.desc
+              }}
+            </el-tag>
+            <el-tag type="info" v-else>--</el-tag>
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" width="80">
+        <template slot-scope="{ row }">
+          <div>
+            <el-button v-hasPermi="['business:channelGoods:query']" type="text" @click="getDetail(row)">查看详情
+            </el-button>
+            <el-button v-hasPermi="['business:channelGoodsOrder:push']" v-if="row.status && row.status.value == 1" type="text" @click="toInventory(row)">去结算
+            </el-button>
+          </div>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <el-dialog title="提示" :visible.sync="dialogVisible" width="60%" :before-close="handleClose">
+      <div v-html="responseData"></div>
+      <span slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
+      </span>
+    </el-dialog>
+
+    <!-- 分页 -->
+    <pagination v-show="total > 0" :total="total" :page.sync="pageParams.pageNum" :limit.sync="pageParams.pageSize" @pagination="getList" />
+
+    <!-- 结算 -->
+    <inventory-goods :inventory-show="inventoryShow" :inventory-info="info" @close="close" v-if="inventoryShow"/>
+  </div>
+</template>
+<script>
+import { getInventoryList } from "@/api/business/inventory";
+import { listAllSaleSite } from "@/api/admin/salesite";
+import { publicFileGetUrl } from "@/api/common";
+import InventoryGoods from "./components/InventoryGoods";
+export default {
+  name: "Inventory",
+  components: {
+    InventoryGoods,
+  },
+  data() {
+    return {
+      loading: false,
+      showSearch: true,
+      dialogVisible: false,
+      // 筛选
+      queryParams: {
+        minStock: "",
+        maxStock: "",
+        channelId: "",
+        title: "",
+        orderId: "",
+        startTime: "",
+        endTime: "",
+        settleStatus: "",
+        tel: "",
+      },
+      // 分页
+      pageParams: {
+        pageNum: 1,
+        pageSize: 10,
+      },
+      // 总条数
+      total: 0,
+      list: [],
+      // 门店
+      merchantArr: [],
+      // 下单时间
+      tradeTimeArr: [],
+      // 结算弹窗显示
+      inventoryShow: false,
+      // 订单详情
+      info: {},
+      fileSaveUrl: '',
+      reqData: {},
+      responseData: '',
+      siteList: [],
+      siteCopyList: [],
+    };
+  },
+  created() {
+    this.getList();
+    this.getSaleSiteList()
+  },
+  methods: {
+    // 获取门店下拉列表
+    getSaleSiteList() {
+      listAllSaleSite({}).then(response => {
+        this.siteList = response.data || [];
+        this.siteCopyList = response.data || [];
+      });
+    },
+    dataFilter(val) {
+      if (val) { //val存在
+        this.siteList = this.siteCopyList.filter((item) => {
+          if (!!~item.mobile.indexOf(val) || !!~item.mobile.toUpperCase().indexOf(val.toUpperCase())
+            || !!~item.name.indexOf(val) || !!~item.name.indexOf(val)) {
+            return true
+          }
+        })
+      } else { //val为空时,还原数组
+        this.siteList = this.siteCopyList;
+      }
+    },
+    handleClose(done) {
+      this.$confirm('确认关闭?')
+        .then(_ => {
+          done();
+        })
+        .catch(_ => {
+        });
+    },
+    // 订单列表
+    getList() {
+      let data = {
+        ...this.queryParams,
+      }
+      this.loading = true;
+      getInventoryList(
+        "pageNum=" +
+        this.pageParams.pageNum +
+        "&pageSize=" +
+        this.pageParams.pageSize +
+        "&",
+        data
+      )
+        .then((res) => {
+          this.loading = false;
+          if (res.code == 0) {
+            res.rows.forEach((item) => {
+              let items = item.items;
+              items.forEach((item) => {
+                let picUrlArr = item.picUrl.split(",");
+                item.picUrl = publicFileGetUrl + picUrlArr[0];
+              });
+              item.status = JSON.parse(item.status);
+            });
+            this.total = res.total;
+            this.list = res.rows;
+          }
+        })
+        .catch(() => {
+          this.loading = false;
+        });
+    },
+
+    //搜索
+    handleQuery() {
+      this.siteList = this.siteCopyList;
+      this.pageParams.pageNum = 1;
+      this.getList();
+    },
+
+    // 重置
+    resetQuery() {
+      this.queryParams = {
+        minStock: "",
+        maxStock: "",
+        channelId: "",
+        title: "",
+        orderId: "",
+        startTime: "",
+        endTime: "",
+        settleStatus: "",
+        tel: "",
+      };
+      this.tradeTimeArr = [];
+      this.getList();
+    },
+
+    // 选择下单时间
+    tardeTime(e) {
+      if (e) {
+        this.queryParams.startTime = e[0];
+        this.queryParams.endTime = e[1];
+        this.pageParams.pageNum = 1
+        this.handleQuery();
+      } else {
+        this.queryParams.startTime = "";
+        this.queryParams.endTime = "";
+        this.pageParams.pageNum = 1
+        this.handleQuery();
+      }
+    },
+
+    // 查看详情
+    getDetail(row) {
+      this.$router.push({ name: "InventoryDetail", query: { id: row.orderId } });
+    },
+
+    // 点击去结算
+    toInventory(row) {
+      this.info = row;
+      this.inventoryShow = true;
+    },
+
+    // 关闭结算
+    close() {
+      this.inventoryShow = false;
+      this.getList();
+    },
+
+  },
+};
+</script>
+<style lang="scss" scoped>
+::v-deep .el-tabs--border-card > .el-tabs__content {
+  padding: 0;
+}
+</style>
+<style  lang="scss">
+.msgbox {
+  width: 60%;
+}
+</style>

+ 10 - 1
src/views/business/marketing/components/CouponAdd.vue

@@ -17,6 +17,14 @@
           @keyup.enter.native="getCouponList"
         />
         <div class="ge"></div>
+        <div>使用场景:</div>
+        <el-select v-model="type" placeholder="请选择使用场景" clearable @keyup.enter.native="getCouponList">
+          <el-option label="全部" value=""/>
+          <el-option label="门店消费" :value="2"/>
+          <el-option label="盲票购买" :value="1"/>
+          <el-option label="采购商品核销" :value="4"/>
+        </el-select>
+        <div class="ge"></div>
         <el-button
           type="primary"
           icon="el-icon-search"
@@ -106,6 +114,7 @@ export default {
   data() {
     return {
       loading: false,
+      type: '',
       couponTitle: "", // 券名称
       couponList: [], // 卡券列表
       couponTotal: 0, // 卡券总数
@@ -129,7 +138,7 @@ export default {
           "&pageSize=" +
           this.pageParams.pageSize +
           "&",
-        { title: this.couponTitle, status: "on" }
+        { title: this.couponTitle,type: this.type, status: "on" }
       ).then((res) => {
         this.couponList = res.rows.map((item) => {
           return {

+ 23 - 2
src/views/business/marketing/components/GoodsAdd.vue

@@ -22,7 +22,14 @@
         <div style="width: 20px;text-align: center">-</div>
 <!--        <el-input v-model="maxValue" placeholder="最高价格" clearable @keyup.enter.native="pageParams.pageNum = 1;getList()" />-->
         <el-input style="width: 220px" v-model="queryParams.maxValue"  @clear="queryParams.pageNum = 1;getGoodsList()" placeholder="最高价格" clearable @keyup.enter.native="queryParams.pageNum = 1;getGoodsList()"/>
-
+      </div>
+      <div class="dialog-search">
+        <div>商品类型:</div>
+        <el-select v-model="queryParams.type" placeholder="请选择商品类型" clearable @change="queryParams.pageNum = 1;getGoodsList()">
+          <el-option label="全部" value=""/>
+          <el-option label="实物商品" value="1"/>
+          <el-option label="卡密商品" value="2"/>
+        </el-select>
         <div class="ge"></div>
         <el-button
           type="primary"
@@ -67,6 +74,20 @@
             <div>¥{{ $numberFormat(scope.row.value) }}</div>
           </template>
         </el-table-column>
+        <el-table-column label="商品类型" prop="type" min-width="85">
+          <template slot-scope="scope">
+            <div v-if="scope.row.type == 1">实物商品</div>
+            <div v-else-if="scope.row.type == 2">卡密商品</div>
+            <div v-else-if="scope.row.type == 3">采购商品</div>
+          </template>
+        </el-table-column>
+        <el-table-column label="是否支持兑换" prop="exchangeShow" min-width="85">
+          <template slot-scope="scope">
+            <div v-if="scope.row.exchangeShow == 1">支持兑换</div>
+            <div v-else-if="scope.row.exchangeShow == 0">不支持兑换</div>
+            <div v-else-if="scope.row.exchangeShow == 2">盲票商品</div>
+          </template>
+        </el-table-column>
         <el-table-column label="商品库存" prop="quantity" width="80" />
       </el-table>
       <pagination
@@ -126,7 +147,7 @@ export default {
           "&pageSize=" +
           this.pageParams.pageSize +
           "&",
-        { title: this.goodsTitle,  status: "on", minValue: this.queryParams.minValue?accMul(this.queryParams.minValue, 100):this.queryParams.minValue, maxValue: this.queryParams.maxValue?accMul(this.queryParams.maxValue, 100):this.queryParams.maxValue,}
+        { isExcludePurchaseGoods: true, type: this.queryParams.type, title: this.goodsTitle,  status: "on", minValue: this.queryParams.minValue?accMul(this.queryParams.minValue, 100):this.queryParams.minValue, maxValue: this.queryParams.maxValue?accMul(this.queryParams.maxValue, 100):this.queryParams.maxValue,}
       ).then((res) => {
         this.goodsList = res.rows.map((item) => {
           return {

+ 10 - 1
src/views/business/ticket/components/CouponAdd.vue

@@ -17,6 +17,14 @@
           @keyup.enter.native="getCouponList"
         />
         <div class="ge"></div>
+        <div>使用场景:</div>
+        <el-select v-model="type" placeholder="请选择使用场景" clearable @keyup.enter.native="getCouponList">
+          <el-option label="全部" value=""/>
+          <el-option label="门店消费" :value="2"/>
+          <el-option label="盲票购买" :value="1"/>
+          <el-option label="采购商品核销" :value="4"/>
+        </el-select>
+        <div class="ge"></div>
         <el-button
           type="primary"
           icon="el-icon-search"
@@ -110,6 +118,7 @@ export default {
   data() {
     return {
       loading: false,
+      type: '',
       couponTitle: "", // 券名称
       couponList: [], // 卡券列表
       couponTotal: 0, // 卡券总数
@@ -133,7 +142,7 @@ export default {
           "&pageSize=" +
           this.pageParams.pageSize +
           "&",
-        { title: this.couponTitle, status: "on" }
+        { title: this.couponTitle,type: this.type, status: "on" }
       ).then((res) => {
         this.couponList = res.rows.map((item) => {
           return {

+ 15 - 1
src/views/business/ticket/components/GoodsAdd.vue

@@ -23,6 +23,12 @@
         <el-input type="number" style="width: 220px" v-model="queryParams.maxValue" @clear="pageParams.pageNum = 1;getGoodsList()"
                   placeholder="最高价格" clearable @keyup.enter.native="pageParams.pageNum = 1;getGoodsList()"/>
         <br>
+        <div>商品类型:</div>
+        <el-select v-model="queryParams.type" placeholder="请选择商品类型" clearable @change="pageParams.pageNum = 1;getGoodsList()">
+          <el-option label="全部" value=""/>
+          <el-option label="实物商品" value="1"/>
+          <el-option label="卡密商品" value="2"/>
+        </el-select>
         <div style="margin:0 0 10px 20px">盲豆兑换数量:</div>
         <el-input type="number" style="width: 220px" v-model="queryParams.minExchange" @clear="pageParams.pageNum = 1;getGoodsList()"
                   placeholder="最低盲豆数量" clearable @keyup.enter.native="pageParams.pageNum = 1;getGoodsList()"/>
@@ -91,7 +97,13 @@
             <div>¥{{ $numberFormat(scope.row.cost) }}</div>
           </template>
         </el-table-column>
-
+        <el-table-column label="商品类型" prop="type" min-width="85">
+          <template slot-scope="scope">
+            <div v-if="scope.row.type == 1">实物商品</div>
+            <div v-else-if="scope.row.type == 2">卡密商品</div>
+            <div v-else-if="scope.row.type == 3">采购商品</div>
+          </template>
+        </el-table-column>
         <el-table-column label="是否支持兑换" prop="exchangeShow" min-width="85">
           <template slot-scope="scope">
             <div v-if="scope.row.exchangeShow == 1">支持兑换</div>
@@ -174,6 +186,8 @@ export default {
           maxExchange:this.queryParams.maxExchange,
           minCost: this.queryParams.minCost ? accMul(this.queryParams.minCost, 100) : this.queryParams.minCost,
           maxCost: this.queryParams.maxCost ? accMul(this.queryParams.maxCost, 100) : this.queryParams.maxCost,
+          isExcludePurchaseGoods: true,
+          type: this.queryParams.type,
       }
       if(this.ticket == "ticketGoods") {
         data.exchangeShow = 2

+ 180 - 0
src/views/order/store/components/ExpressEdit.vue

@@ -0,0 +1,180 @@
+<template>
+  <div>
+    <el-dialog
+      title="修改快递信息"
+      :visible.sync="editShow"
+      width="500px"
+      :before-close="close"
+    >
+      <el-form
+        :model="shipForm"
+        ref="shipForm"
+        :rules="rules"
+        label-width="100px"
+      >
+        <el-form-item label="配送方式:" prop="deliveryId">
+          <el-radio @change="radioDistribution" v-model="shipForm.deliveryType" label="1">快递发货</el-radio>
+          <el-radio @change="radioDistribution" v-model="shipForm.deliveryType" label="2">无需物流</el-radio>
+        </el-form-item>
+        <el-form-item v-if="shipForm.deliveryType == 1" label="快递单号:" prop="deliveryFlowId">
+          <el-input
+            v-model="shipForm.deliveryFlowId"
+            @blur="InputBlur()"
+            placeholder="输入快递单号"
+            clearable
+            size="small"
+            style="width: 300px"
+          />
+        </el-form-item>
+        <el-form-item v-if="shipForm.deliveryType == 1" label="快递公司:" prop="deliveryId">
+          <el-select
+            v-model="shipForm.deliveryId"
+            placeholder="请选择快递公司"
+            clearable
+            size="small"
+            style="width: 300px"
+          >
+            <el-option
+              v-for="item in companyData"
+              :key="item.areaId"
+              :label="item.companyName"
+              :value="item.deliveryId"
+            />
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <!-- 按钮 -->
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="close">取 消</el-button>
+        <el-button type="primary" :disabled="loading" @click="saveClick"
+          >确 定</el-button
+        >
+      </div>
+    </el-dialog>
+  </div>
+</template>
+<script>
+import CustomFieldsMixin from "@/mixins/CustomFields";
+import { companyList, storeOrderShipUpdate, automaticRecognition} from "@/api/business/order";
+export default {
+  mixins: [CustomFieldsMixin],
+  props: {
+    // 发货弹框显示
+    editShow: {
+      type: Boolean,
+      default: false,
+    },
+    // 订单详情
+    goodsInfo: {
+      type: Object,
+      default: {},
+    },
+    // 订单ID
+    orderId: {
+      type: String,
+      default: ''
+    }
+  },
+  data() {
+    return {
+      loading: false,
+      shipForm: {
+        deliveryId: "",
+        deliveryFlowId: "",
+        deliveryType: "1",//配送方式
+      },
+      // 快递下拉列表
+      companyData: [],
+      rules: {
+        deliveryId: [
+          { required: false, message: "请选择快递公司", trigger: "change" },
+        ],
+        deliveryFlowId: [
+          { required: false, message: "请输入快递单号", trigger: "blur" },
+        ],
+      },
+    };
+  },
+  created() {
+    this.getCompanyList();
+    this.getFormData()
+  },
+  methods: {
+    getFormData(){
+      this.shipForm.deliveryId = this.goodsInfo.deliveryId
+      this.shipForm.deliveryFlowId = this.goodsInfo.deliveryFlowId
+      this.shipForm.deliveryType = this.goodsInfo.deliveryFlowId?"1":"2"
+    },
+
+    // 关闭发货弹框
+    close() {
+      this.$emit("close");
+      this.loading = false;
+      this.$refs["shipForm"].resetFields();
+    },
+
+    //切换配送方式时清空另一个方式所选项
+    radioDistribution(){
+      if(this.shipForm.deliveryType == '2'){
+        this.shipForm.deliveryId = '';
+        this.shipForm.deliveryFlowId = '';
+      }
+    },
+
+    // 快递下拉列表
+    getCompanyList() {
+      companyList({}).then((res) => {
+        this.companyData = res.data;
+      });
+    },
+
+    //快递单号失去焦点时
+    InputBlur(){
+      if (this.shipForm.deliveryFlowId){
+        automaticRecognition(this.shipForm.deliveryFlowId).then((res)=>{
+          if (res.code == 0 && res.data){
+            this.shipForm.deliveryId = res.data.deliveryId
+          }
+        })
+      }
+    },
+
+    // 确认
+    saveClick() {
+      this.loading = true;
+      const subForm = this.$refs["shipForm"];
+      subForm.validate((valid) => {
+        if (valid) {
+          this.submitForm(this.shipForm);
+        } else {
+          this.loading = false;
+          // 提示第一个error
+          this.getFormErrorMessage(subForm);
+          return false;
+        }
+      });
+    },
+
+    // 提交
+    submitForm(form) {
+      let data = {
+        ...form,
+        orderId: this.orderId,
+        // itemIds: this.goodsInfo.items.map( item => item.itemId)
+      };
+      storeOrderShipUpdate(data)
+        .then((res) => {
+          if (res.code == 0) {
+            this.msgSuccess("修改成功");
+            this.close();
+          }
+        })
+        .catch(() => {
+          this.loading = false;
+        });
+    },
+  },
+};
+</script>
+<style scoped>
+</style>

+ 241 - 0
src/views/order/store/components/SendGoods.vue

@@ -0,0 +1,241 @@
+<template>
+  <div>
+    <el-dialog
+      title="订单发货"
+      :visible.sync="sendShow"
+      width="1000px"
+      :before-close="close"
+    >
+      <el-form
+        :model="shipForm"
+        ref="shipForm"
+        :rules="rules"
+        label-width="100px"
+      >
+        <el-form-item label="订单号:">
+          <span>{{ goodsInfo.orderId }}</span>
+        </el-form-item>
+        <el-form-item label="收货地址:">
+          <span>{{
+            `${goodsInfo.receiver},${goodsInfo.tel},${goodsInfo.province}${goodsInfo.city}${goodsInfo.area}${goodsInfo.address}`
+          }}</span>
+        </el-form-item>
+        <el-form-item label="配送方式:">
+          <!--单选框-->
+          <el-radio @change="radioDistribution" v-model="shipForm.deliveryType" label="1">快递发货</el-radio>
+          <el-radio @change="radioDistribution" v-model="shipForm.deliveryType" label="2">无需物流</el-radio>
+        </el-form-item>
+        <el-form-item v-if="shipForm.deliveryType == 1" label="快递单号:" prop="deliveryFlowId">
+          <el-input
+            @blur="InputBlur()"
+            v-model="shipForm.deliveryFlowId"
+            placeholder="输入快递单号"
+            clearable
+            size="small"
+            style="width: 300px"
+          />
+        </el-form-item>
+        <el-form-item v-if="shipForm.deliveryType == 1" label="快递公司:" prop="deliveryId">
+          <el-select
+            v-model="shipForm.deliveryId"
+            placeholder="请选择快递公司"
+            clearable
+            size="small"
+            style="width: 300px"
+          >
+            <el-option
+              v-for="item in companyData"
+              :key="item.areaId"
+              :label="item.companyName"
+              :value="item.deliveryId"
+            />
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <!-- 商品 -->
+      <el-table
+        ref="table"
+        :data="goodsInfo.items"
+        @selection-change="handleSelectionGoods"
+        class="ticket-table"
+      >
+        <el-table-column
+          type="selection"
+          width="55"
+          align="center"
+          fixed="left"
+        />
+        <el-table-column label="商品名称" prop="title" />
+        <el-table-column label="规格">
+          <template slot-scope="{ row }">
+            <div>{{ row.properties || "--" }}</div>
+          </template>
+        </el-table-column>
+        <el-table-column label="数量">
+          <template slot-scope="{ row }">
+            <div>{{ row.goodsNum }}件</div>
+          </template>
+        </el-table-column>
+        <el-table-column label="快递公司">
+          <template slot-scope="{ row }">
+            <div>{{ row.companyName || "--" }}</div>
+          </template>
+        </el-table-column>
+        <el-table-column label="快递单号">
+          <template slot-scope="{ row }">
+            <div>{{ row.deliveryFlowId || "--" }}</div>
+          </template>
+        </el-table-column>
+        <el-table-column label="发货状态">
+          <template slot-scope="{ row }">
+            <div>{{ row.deliveryTime ? "已发货" : "未发货" }}</div>
+          </template>
+        </el-table-column>
+      </el-table>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="close">取 消</el-button>
+        <el-button type="primary" :disabled="loading" @click="saveClick"
+          >确 定</el-button
+        >
+      </div>
+    </el-dialog>
+  </div>
+</template>
+<script>
+import CustomFieldsMixin from "@/mixins/CustomFields";
+import { companyList, storeOrderShip, automaticRecognition} from "@/api/business/order";
+export default {
+  mixins: [CustomFieldsMixin],
+  props: {
+    // 弹框显示
+    sendShow: {
+      type: Boolean,
+      default: false,
+    },
+    // 订单详情
+    goodsInfo: {
+      type: Object,
+      default: {},
+    },
+  },
+  created() {
+    this.getCompanyList();
+  },
+  data() {
+    return {
+      loading: false,
+      shipForm: {
+        deliveryId: "",
+        deliveryFlowId: "",
+        deliveryType: "1",
+      },
+      // 快递下拉列表
+      companyData: [],
+      // 选中sp
+      goodsList: [],
+      // 选中商品ID
+      ids: [],
+      rules: {
+        deliveryId: [
+          { required: true, message: "请选择快递公司", trigger: "change" },
+        ],
+        deliveryFlowId: [
+          { required: true, message: "请输入快递单号", trigger: "blur" },
+        ],
+      },
+    };
+  },
+  methods: {
+    // 关闭发货弹框
+    close() {
+      this.shipForm.deliveryType = "1";
+      this.$emit("close");
+      this.loading = false;
+      this.ids = [];
+      this.$refs["shipForm"].resetFields();
+    },
+
+    //切换配送方式时清空另一个方式所选项
+    radioDistribution(){
+      if(this.shipForm.deliveryType == '2'){
+        this.shipForm.deliveryId = '';
+        this.shipForm.deliveryFlowId = '';
+      }
+    },
+
+    // 快递下拉列表
+    getCompanyList() {
+      companyList({}).then((res) => {
+        this.companyData = res.data;
+      });
+    },
+
+    //快递单号失去焦点时
+    InputBlur(){
+      if (this.shipForm.deliveryFlowId){
+        automaticRecognition(this.shipForm.deliveryFlowId).then((res)=>{
+          if (res.code == 0 && res.data){
+            this.shipForm.deliveryId = res.data.deliveryId
+          }
+        })
+      }
+    },
+
+    // 选中商品
+    handleSelectionGoods(e) {
+      this.goodsList = e
+    },
+
+    // 确认
+    saveClick() {
+      this.loading = true;
+      const subForm = this.$refs["shipForm"];
+      subForm.validate((valid) => {
+        if (valid) {
+          this.submitForm(this.shipForm);
+        } else {
+          this.loading = false;
+          // 提示第一个error
+          this.getFormErrorMessage(subForm);
+          return false;
+        }
+      });
+    },
+
+    // 提交
+    submitForm(form) {
+      if (!this.goodsList.length) {
+        this.msgError("请选择发货的商品");
+        this.loading = false;
+        return;
+      }
+      let index = this.goodsList.findIndex(item=>{
+        return item.deliveryTime
+      })
+      if(index != -1){
+        this.msgError(`${ this.goodsList[index].title }已发货!`);
+        this.loading = false;
+        return
+      }
+      this.ids = this.goodsList.map((item) => item.itemId);
+      let data = {
+        ...form,
+        orderId: this.goodsInfo.orderId,
+        itemIds: this.ids,
+      };
+      storeOrderShip(data)
+        .then((res) => {
+          if (res.code == 0) {
+            this.msgSuccess("发货成功");
+            this.close();
+          }
+        })
+        .catch(() => {
+          this.loading = false;
+        });
+    },
+  },
+};
+</script>
+<style>
+</style>

+ 353 - 0
src/views/order/store/detail.vue

@@ -0,0 +1,353 @@
+<template>
+  <div class="app-container">
+    <!-- 订单信息 -->
+    <el-row :gutter="10">
+      <el-col :span="22" :offset="1">
+        <div class="info-title">订单信息</div>
+        <el-col :span="8" :offset="1" :xs="{span: 24, offset: 0}">
+          <div class="title">订单编号:{{ info.orderId }}</div>
+        </el-col>
+        <el-col :span="7" :xs="{span: 24, offset: 0}">
+          <div class="title">订单类型:门店采购订单</div>
+        </el-col>
+        <el-col :span="8" :xs="{span: 24, offset: 0}">
+          <div class="title">下单时间:{{ parseTime(info.createdTime) }}</div>
+        </el-col>
+        <!-- <el-col :span="8" :offset="1" :xs="{span: 24, offset: 0}">
+          <div class="title">付款方式:{{ info.payType == 1 || info.payType == 10 ? '支付宝支付': info.payType == 2 ? '微信支付': '--' }}</div>
+        </el-col> -->
+      </el-col>
+    </el-row>
+
+    <!-- 买家信息 -->
+    <el-row :gutter="10" >
+      <el-col :span="22" :offset="1">
+        <div class="info-title">买家信息</div>
+        <el-col :span="8" :offset="1" :xs="{span: 24, offset: 0}">
+          <div class="title">门店名称:{{ info.channelName || "--" }}</div>
+        </el-col>
+        <el-col :span="7" :xs="{span: 24, offset: 0}">
+          <div class="title">收货人:{{ info.receiver || "--" }}</div>
+        </el-col>
+        <el-col :span="8" :xs="{span: 24, offset: 0}">
+          <div class="title">联系电话:{{ info.tel || "--" }}</div>
+        </el-col>
+        <el-col :span="8" :offset="1" :xs="{span: 24, offset: 0}">
+          <div class="title">收货地址:{{
+              `${info.province || "--"}${info.city || "--"}${
+                info.area || "--"
+              }${info.address || "--"}`
+            }}</div>
+        </el-col>
+      </el-col>
+    </el-row>
+
+    <!-- 买家留言 -->
+    <el-row :gutter="10">
+      <el-col :span="22" :offset="1">
+        <div class="info-title">备注信息</div>
+        <el-col :span="8" :offset="1" :xs="{span: 24, offset: 0}">
+          <div class="title">买家留言:{{ info.memo || "--" }}</div>
+        </el-col>
+      </el-col>
+    </el-row>
+
+    <!-- 订单状态 -->
+    <el-row :gutter="10">
+      <el-col :span="22" :offset="1">
+        <div class="info-title">订单状态</div>
+        <el-col :span="8" :offset="1" :xs="{span: 24, offset: 0}">
+          <div class="title">订单状态:{{ status.value == 2 ? "已发货" : (status.desc || "--") }}</div>
+        </el-col>
+        <el-button
+          v-if="status.value === 1 || status.value === 4"
+          v-hasPermi="['channelGoods:channel:ship']"
+          type="primary"
+          @click="toGoods()"
+        >发货</el-button
+        >
+      </el-col>
+    </el-row>
+
+    <!-- 物流信息 -->
+    <el-row :gutter="10">
+      <el-col :span="22" :offset="1">
+        <div class="info" v-if="status.value === 2 || status.value === 3 || status.value === 4">
+      <div class="info-title">物流信息</div>
+      <el-col :span="24" :offset="1">
+        <div class="info-item-logistics" >
+          <div class="info">
+            <el-col :span="5" :xs="{span: 24, offset: 0}">
+              <div class="tit">配送方式:{{ (deliveryCompany && deliveryCompany.companyName) || (deliveryCompany && deliveryCompany.deliveryFlowId) ? "快递发货":"无需物流" }}</div>
+            </el-col>
+            <el-col :span="5" :xs="{span: 24, offset: 0}">
+              <div class="tit" v-if="deliveryCompany && deliveryCompany.companyName">快递公司:{{ (deliveryCompany && deliveryCompany.companyName) || "--" }}</div>
+              <div class="tit" v-else></div>
+            </el-col>
+            <el-col :span="5" :xs="{span: 24, offset: 0}">
+              <div class="tit" v-if="info && info.deliveryFlowId">快递单号:{{ (info && info.deliveryFlowId) || "--" }}</div>
+              <div class="tit" v-else></div>
+            </el-col>
+            <el-col :span="7" :xs="{span: 24, offset: 0}">
+              <div class="tit">发货时间:{{ parseTime(info && info.deliveryTime) || "--" }}</div>
+            </el-col>
+            <el-col :span="2" :xs="{span: 24, offset: 0}">
+              <div class="edit-express" @click="editExpress(deliveryCompany)" v-if="status.value === 2 || status.value === 4">修改</div>
+            </el-col>
+          </div>
+        </div>
+      </el-col>
+      </div>
+      </el-col>
+    </el-row>
+
+        <!-- 商品信息 -->
+    <el-row :gutter="10">
+      <el-col :span="22" :offset="1">
+         <div class="info">
+      <div class="info-title">商品信息</div>
+      <div class="info-table">
+        <el-table :data="list">
+          <el-table-column label="商品信息" min-width="200">
+            <div slot-scope="{ row }" class="flex">
+              <el-image
+                style="width: 100px; height: 100px"
+                :src="row.picUrl"
+                :preview-src-list="[row.picUrl]"
+              />
+              <div class="txt">{{ row.title }}</div>
+            </div>
+          </el-table-column>
+          <el-table-column label="规格" min-width="100">
+            <template slot-scope="{ row }">
+              <div>{{ row.properties || "--" }}</div>
+            </template>
+          </el-table-column>
+          <el-table-column label="数量" prop="orderNum">
+            <template slot-scope="{ row }">
+              <div>{{ row.goodsNum }}件</div>
+            </template>
+          </el-table-column>
+          <el-table-column label="状态">
+            <template>
+              <div>{{ info.deliveryTime ? "已发货" : "未发货" }}</div>
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+      <!-- 按钮 -->
+      <div class="info-amt">
+        <div class="info-amt-price">
+          <span>运费:</span>{{ $numberFormat(info.freightAmt) }}元
+        </div>
+        <div class="info-amt-price">
+          <span>共计金额:</span>{{ $numberFormat(info.payAmt) }}元
+        </div>
+      </div>
+    </div>
+      </el-col>
+    </el-row>
+    <!-- 发货 -->
+    <send-goods :send-show="goodsShow" :goods-info="info" @close="close" />
+
+    <!-- 修改快递信息 -->
+    <express-edit
+      v-if="editShow"
+      :edit-show="editShow"
+      :goods-info="expressInfo"
+      :order-id="info.orderId"
+      @close="close"
+    />
+  </div>
+</template>
+<script>
+import { storeDetail } from "@/api/business/order";
+import { publicFileGetUrl } from "@/api/common";
+import SendGoods from "./components/SendGoods";
+import ExpressEdit from "./components/ExpressEdit";
+export default {
+  name: "StoreDetail",
+  components: {
+    SendGoods,
+    ExpressEdit,
+  },
+  data() {
+    return {
+      // 订单ID
+      orderId: "",
+      // 订单详情
+      info: {},
+      // 订单状态
+      status: {},
+      // 商品信息列表
+      list: [],
+      // 物流信息性别
+      deliverList: [],
+      // 快递
+      deliveryCompany: {},
+      // 发货显示
+      goodsShow: false,
+      // 修改快递信息弹框
+      editShow: false,
+      // 快递信息
+      expressInfo: {}
+    };
+  },
+  created() {
+    this.orderId = this.$route.query.id;
+    this.getDetail();
+  },
+  activated() {
+    const orderId = this.$route.query.id;
+    if (orderId != null && orderId != this.orderId) {
+      this.orderId = orderId;
+      this.getDetail();
+    }
+  },
+  methods: {
+    // 订单详情
+    getDetail() {
+      storeDetail({ orderId: this.orderId }).then((res) => {
+        if (res.code == 0) {
+          this.info = res.data;
+          this.status = JSON.parse(res.data.status);
+          // res.data.deliverList &&
+          //   res.data.deliverList.forEach((item) => {
+          //     item.items.forEach((ele) => {
+          //       let picUrlArr = ele.picUrl.split(",");
+          //       ele.picUrl = publicFileGetUrl + picUrlArr[0];
+          //     });
+          //   });
+          // this.deliverList = res.data.deliverList;
+          this.deliveryCompany = res.data.deliveryCompany
+          res.data.items &&
+            res.data.items.forEach((item) => {
+              let picUrlArr = item.picUrl.split(",");
+              item.picUrl = publicFileGetUrl + picUrlArr[0];
+            });
+          this.list = res.data.items;
+        }
+      });
+    },
+
+    // 点击发货
+    toGoods() {
+      this.goodsShow = true;
+    },
+
+    // 发货关闭
+    close() {
+      this.goodsShow = false;
+      this.editShow = false;
+      this.getDetail();
+    },
+
+    // 修改快递信息
+    editExpress(item) {
+      this.expressInfo = item
+      this.editShow = true;
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+.title {
+  line-height: 30px;
+  text-align: left;
+}
+.edit-express {
+  color: #409eff;
+  cursor: pointer;
+}
+
+.info {
+  margin-bottom: 10px;
+  &-title {
+    font-size: 14px;
+    margin-bottom: 20px;
+    font-weight: bold;
+  }
+  &-item {
+    padding-left: 50px;
+    &-content {
+      display: flex;
+
+      &-one {
+        display: flex;
+        margin-bottom: 10px;
+
+        .title {
+          //width: 100px;
+        }
+
+        .txt {
+          //width: 200px;
+        }
+      }
+    }
+
+    &-logistics {
+      margin-bottom: 20px;
+      .logistics-title {
+        text-align: left;
+        font-weight: bold;
+        margin-bottom: 20px;
+      }
+      .info {
+        display: flex;
+        margin-bottom: 10px;
+        &-one {
+          display: flex;
+        }
+        .tit {
+          line-height: 22px;
+          //width: 100px;
+        }
+        .txt {
+          line-height: 22px;
+          //width: 200px;
+        }
+        .edit-express{
+          color: #409eff;
+          cursor: pointer;
+        }
+      }
+      .goods {
+        margin: 10px 0;
+        &-item {
+          display: flex;
+          border-bottom: 1px solid #f3eeee;
+          img {
+            width: 100px;
+            height: 100px;
+          }
+          .info {
+            padding-left: 20px;
+            display: flex;
+            flex-direction: column;
+            height: 100px;
+            justify-content: space-between;
+          }
+        }
+      }
+    }
+  }
+  &-amt {
+    margin-top: 10px;
+    &-price {
+      span {
+        display: inline-block;
+        width: 80px;
+        margin-bottom: 20px;
+      }
+    }
+  }
+}
+.flex {
+  display: flex;
+  align-items: center;
+  .txt {
+    margin-left: 20px;
+  }
+}
+</style>

+ 459 - 0
src/views/order/store/index.vue

@@ -0,0 +1,459 @@
+<template>
+  <div class="app-container">
+    <el-form
+      :model="queryParams"
+      ref="queryForm"
+      :inline="true"
+      v-show="showSearch"
+      label-width="90px"
+    >
+      <el-form-item label="门店" prop="channelId">
+        <el-select
+          v-model="queryParams.channelId"
+          placeholder="请选择门店"
+          style="width: 100%;"
+          filterable
+          clearable
+          :filter-method="dataFilter"
+          @change="pageParams.pageNum = 1;handleQuery()"
+        >
+          <el-option
+            v-for="(item) in siteList"
+            :key="item.channelId"
+            :label="item.name"
+            :value="item.channelId">
+            <div>
+              <span style="float: left;">{{item.name}} </span>
+              <span style="float: right;">{{item.mobile}}</span>
+            </div>
+          </el-option>
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="商品名称">
+        <el-input
+          v-model="queryParams.title"
+          placeholder="请输入商品名称"
+          clearable
+          size="small"
+          style="width: 240px"
+          @change="pageParams.pageNum = 1;handleQuery()"
+        />
+      </el-form-item>
+      <el-form-item label="订单号">
+        <el-input
+          v-model="queryParams.orderId"
+          placeholder="输入订单编号"
+          clearable
+          size="small"
+          style="width: 240px"
+          @change="pageParams.pageNum = 1;handleQuery()"
+        />
+      </el-form-item>
+      <el-form-item label="下单时间">
+        <el-date-picker
+          v-model="tradeTimeArr"
+          type="datetimerange"
+          size="small"
+          value-format="timestamp"
+          range-separator="至"
+          start-placeholder="时间选择"
+          end-placeholder="时间选择"
+          @change="tardeTime"
+        >
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item label="收货人手机">
+        <el-input
+          v-model="queryParams.tel"
+          placeholder="输入手机号"
+          clearable
+          size="small"
+          style="width: 240px"
+          @change="pageParams.pageNum = 1;handleQuery()"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button
+          type="primary"
+          icon="el-icon-search"
+          size="mini"
+          @click="pageParams.pageNum = 1;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="infor"
+          plain
+          icon="el-icon-download"
+          size="small"
+          @click="handleExportDraw"
+          v-hasPermi="['channelGoods:channel:export']"
+        >导出订单
+        </el-button
+        >
+      </el-col>
+      <right-toolbar
+        :showSearch.sync="showSearch"
+        @queryTable="getList"
+      ></right-toolbar>
+    </el-row>
+    <!-- 订单状态 -->
+    <el-tabs type="card" v-model="state" @tab-click="handleClick">
+      <el-tab-pane label="全部订单" name="no"></el-tab-pane>
+      <el-tab-pane label="待付款" name="0"></el-tab-pane>
+      <el-tab-pane label="待发货" name="1"></el-tab-pane>
+      <el-tab-pane label="已发货" name="2"></el-tab-pane>
+      <!-- <el-tab-pane label="部分发货" name="4"></el-tab-pane> -->
+      <el-tab-pane label="已完成" name="3"></el-tab-pane>
+      <el-tab-pane label="已取消" name="-1"></el-tab-pane>
+    </el-tabs>
+    <!-- 列表 -->
+    <el-table ref="table" v-loading="loading" :data="list">
+      <!-- 展开盲票组列表 -->
+      <el-table-column type="expand">
+        <template slot-scope="{ row }">
+          <el-table :data="row.items" row-key="itemId">
+            <el-table-column label="商品图片" min-width="80">
+              <div slot-scope="{ row }">
+                <el-image
+                  style="width: 100px; height: 100px"
+                  :src="row.picUrl"
+                  :preview-src-list="[row.picUrl]"
+                />
+              </div>
+            </el-table-column>
+            <el-table-column label="商品名称" prop="title" min-width="80"/>
+            <el-table-column label="规格" min-width="100">
+              <template slot-scope="{ row }">
+                <div>{{ row.properties || "--" }}</div>
+              </template>
+            </el-table-column>
+            <el-table-column label="数量" prop="orderNum" min-width="85">
+              <template slot-scope="{ row }">
+                <div>{{ row.goodsNum }}件</div>
+              </template>
+            </el-table-column>
+          </el-table>
+        </template>
+      </el-table-column>
+      <!-- 不展开列表 -->
+      <el-table-column label="订单号" prop="orderId" min-width="80"/>
+      <el-table-column label="下单时间" min-width="100">
+        <template slot-scope="{ row }">
+          <div>
+            {{ parseTime(row.createdTime) }}
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column label="数量" prop="pkgNum" min-width="85">
+        <template slot-scope="{ row }">
+          <div>{{ row.orderNum }}件</div>
+        </template>
+      </el-table-column>
+      <el-table-column label="实付金额(元)" min-width="85">
+        <template slot-scope="{ row }">
+          <div>{{ $numberFormat(row.payAmt) }}</div>
+        </template>
+      </el-table-column>
+      <el-table-column label="门店" prop="channelName" min-width="80"/>
+      <el-table-column label="收货人/收货地址" prop="addr" min-width="120">
+        <template slot-scope="{ row }">
+          <div>
+            {{
+              `${row.receiver},${row.tel},${row.province}${row.city}${row.area}${row.address}`
+            }}
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column label="订单状态" align="center">
+        <template slot-scope="{ row }">
+          <div>
+            <el-tag :type="row.status.value === 1 ? 'success' : 'info'" v-if="row.status.value !== 2">{{
+                row.status.desc
+              }}
+            </el-tag>
+            <el-tag type="info" v-else>已发货</el-tag>
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" width="80">
+        <template slot-scope="{ row }">
+          <div>
+            <el-button
+              v-hasPermi="['channelGoods:channel:query']"
+              type="text"
+              @click="getDetail(row)"
+            >查看详情
+            </el-button
+            >
+            <el-button
+              v-if="row.status.value === 1 || row.status.value === 4"
+              v-hasPermi="['channelGoods:channel:ship']"
+              type="text"
+              @click="toGoods(row)"
+            >发货
+            </el-button
+            >
+          </div>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <el-dialog
+      title="提示"
+      :visible.sync="dialogVisible"
+      width="60%"
+      :before-close="handleClose">
+      <div v-html="responseData"></div>
+      <span slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
+      </span>
+    </el-dialog>
+
+    <!-- 分页 -->
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="pageParams.pageNum"
+      :limit.sync="pageParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 发货 -->
+    <send-goods :send-show="goodsShow" :goods-info="goodsInfo" @close="close"/>
+  </div>
+</template>
+<script>
+import {
+  getStoreList,
+  storeOrderExport,
+} from "@/api/business/order";
+import { listAllSaleSite} from "@/api/admin/salesite";
+import {publicFileGetUrl} from "@/api/common";
+import SendGoods from "./components/SendGoods";
+export default {
+  name: "Store",
+  components: {
+    SendGoods,
+  },
+  data() {
+    return {
+      loading: false,
+      showSearch: true,
+      dialogVisible: false,
+      // 筛选
+      queryParams: {
+        channelId: "",
+        title: "",
+        orderId: "",
+        startTime: "",
+        endTime: "",
+        status: "",
+        tel: "",
+      },
+      // 分页
+      pageParams: {
+        pageNum: 1,
+        pageSize: 10,
+      },
+      // 总条数
+      total: 0,
+      list: [],
+      // 门店
+      merchantArr: [],
+      // 下单时间
+      tradeTimeArr: [],
+      // 订单列表状态
+      state: "no",
+      // 发货显示
+      goodsShow: false,
+      // 订单详情
+      goodsInfo: {},
+      fileSaveUrl: '',
+      reqData: {},
+      responseData:'',
+      siteList:[],
+      siteCopyList: [],
+    };
+  },
+  created() {
+    this.getList();
+    this.getSaleSiteList()
+  },
+  methods: {
+     // 获取门店下拉列表
+     getSaleSiteList(){
+      listAllSaleSite({}).then(response => {
+         this.siteList = response.data || [];
+         this.siteCopyList = response.data || [];
+      });
+    },
+    dataFilter(val) {
+      if (val) { //val存在
+        this.siteList = this.siteCopyList.filter((item) => {
+          if (!!~item.mobile.indexOf(val) || !!~item.mobile.toUpperCase().indexOf(val.toUpperCase())
+                 || !!~item.name.indexOf(val) || !!~item.name.indexOf(val)) {
+             return true
+          }
+        })
+      } else { //val为空时,还原数组
+        this.siteList = this.siteCopyList;
+      }
+    },
+    handleClose(done) {
+      this.$confirm('确认关闭?')
+        .then(_ => {
+          done();
+        })
+        .catch(_ => {
+        });
+    },
+      // 订单列表
+    getList() {
+      let data = {
+        ...this.queryParams,
+      }
+      this.loading = true;
+      getStoreList(
+        "pageNum=" +
+        this.pageParams.pageNum +
+        "&pageSize=" +
+        this.pageParams.pageSize +
+        "&",
+        data
+      )
+        .then((res) => {
+          this.loading = false;
+          if (res.code == 0) {
+            res.rows.forEach((item) => {
+              let items = item.items;
+              items.forEach((item) => {
+                let picUrlArr = item.picUrl.split(",");
+                item.picUrl = publicFileGetUrl + picUrlArr[0];
+              });
+              item.status = JSON.parse(item.status);
+            });
+            this.total = res.total;
+            this.list = res.rows;
+          }
+        })
+        .catch(() => {
+          this.loading = false;
+        });
+    },
+
+    //搜索
+    handleQuery() {
+      this.siteList = this.siteCopyList;
+      this.pageParams.pageNum = 1;
+      this.getList();
+    },
+
+    // 重置
+    resetQuery() {
+      this.queryParams = {
+        channelId: "",
+        title: "",
+        orderId: "",
+        startTime: "",
+        endTime: "",
+        status: "",
+        tel: "",
+      };
+      this.state = "no"
+      this.tradeTimeArr = [];
+      this.getList();
+    },
+
+    // 选择下单时间
+    tardeTime(e) {
+      if (e) {
+        this.queryParams.startTime = e[0];
+        this.queryParams.endTime = e[1];
+        this.pageParams.pageNum = 1
+        this.handleQuery();
+      } else {
+        this.queryParams.startTime = "";
+        this.queryParams.endTime = "";
+        this.pageParams.pageNum = 1
+        this.handleQuery();
+      }
+    },
+
+    // 订单切换
+    handleClick(e) {
+      if (e.name == "no") {
+        this.queryParams.status = "";
+      } else {
+        this.queryParams.status = Number(e.name);
+      }
+      this.getList();
+    },
+
+    // 查看详情
+    getDetail(row) {
+      this.$router.push({name: "StoreDetail", query: {id: row.orderId}});
+    },
+
+    // 点击发货
+    toGoods(row) {
+      this.goodsShow = true;
+      this.goodsInfo = row;
+    },
+
+    // 关闭发货
+    close() {
+      this.goodsShow = false;
+      this.getList();
+    },
+   
+    // 导出订单
+    handleExportDraw() {
+      let data = {
+        ...this.queryParams,
+      }
+      this.$confirm("是否确认导出订单?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.vloading = this.$loading({
+            lock: true,
+            text: "正在导出订单.....",
+            background: "rgba(0, 0, 0, 0.7)",
+          });
+          return storeOrderExport(data);
+        })
+        .then((response) => {
+          this.vloading.close();
+          this.download(response.msg);
+        })
+        .catch(() => {
+          this.vloading.close();
+        });
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+::v-deep .el-tabs--border-card > .el-tabs__content {
+  padding: 0;
+}
+
+</style>
+<style  lang="scss">
+.msgbox {
+  width: 60%;
+}
+</style>