|
|
@@ -120,6 +120,7 @@
|
|
|
<el-button size="mini" type="text" icon="el-icon-view" @click="handlePrescribe(scope.row)">查看处方</el-button>
|
|
|
<el-button size="mini" type="text" icon="el-icon-document" @click="handleCollection(scope.row)">查看信息采集</el-button>
|
|
|
<el-button size="mini" type="text" icon="el-icon-document-copy" @click="handleViewLog(scope.row)">认领记录</el-button>
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-folder-add" @click="handleCreateOrder(scope.row)">制单</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -292,6 +293,203 @@
|
|
|
<el-button type="primary" :loading="claimSubmitLoading" @click="submitClaim">确 认</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <el-dialog :title="createOrder.title" v-if="createOrder.open" :visible.sync="createOrder.open" width="1000px" append-to-body :close-on-click-modal ="false">
|
|
|
+ <el-form ref="createOrderForm" :model="createOrderForm" :rules="createOrderRules" label-width="120px">
|
|
|
+ <el-form-item label="收货人姓名" prop="realName">
|
|
|
+ <el-input v-model="createOrderForm.realName" placeholder="请输入收货人姓名" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="收货人电话" prop="phone">
|
|
|
+ <el-input v-model="createOrderForm.phone" placeholder="请输入收货人电话" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="收货地址" prop="district">
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-select @change="provinceChange" v-model="createOrderForm.province" placeholder="请选择">
|
|
|
+ <el-option
|
|
|
+ v-for="item in province"
|
|
|
+ :key="item.cityId"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.cityId">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-select @change="cityChange" v-model="createOrderForm.city" placeholder="请选择">
|
|
|
+ <el-option
|
|
|
+ v-for="item in city"
|
|
|
+ :key="item.cityId"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.cityId">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-select @change="districtChange" v-model="createOrderForm.district" placeholder="请选择">
|
|
|
+ <el-option
|
|
|
+ v-for="item in district"
|
|
|
+ :key="item.cityId"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.cityId">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="详细地址" prop="detail">
|
|
|
+ <el-input v-model="createOrderForm.detail" placeholder="请输入收货人详细地址" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="商品列表" >
|
|
|
+ <el-select
|
|
|
+ v-model="createOrderForm.erpType"
|
|
|
+ placeholder="请选择ERP类型"
|
|
|
+ clearable
|
|
|
+ size="small"
|
|
|
+ filterable
|
|
|
+ @change="changeErp"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="dict in erpList"
|
|
|
+ :key="dict.dictValue"
|
|
|
+ :label="dict.dictLabel"
|
|
|
+ :value="dict.dictValue"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ <div style="float: right">
|
|
|
+ <el-button
|
|
|
+ plain
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ @click="handleAddProduct"
|
|
|
+ >添加商品</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ <!-- <el-row >
|
|
|
+ <el-col >
|
|
|
+ <el-button plain type="primary" icon="el-icon-plus" @click="handleAddProduct">添加商品</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row> -->
|
|
|
+ <el-table border :key = "tablekey" width="100%" style="margin-top:5px;" :data="products">
|
|
|
+ <el-table-column label="商品编号" align="center" prop="barCode" />
|
|
|
+ <el-table-column label="商品图片" align="center" width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-popover
|
|
|
+ placement="right"
|
|
|
+ itle=""
|
|
|
+ trigger="hover"
|
|
|
+ >
|
|
|
+ <img slot="reference" :src="scope.row.image" width="50">
|
|
|
+ <img :src="scope.row.image" style="max-width: 50px;">
|
|
|
+ </el-popover>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="商品名称" show-overflow-tooltip align="center" prop="productName" />
|
|
|
+ <el-table-column label="商品规格" align="center" prop="sku" />
|
|
|
+ <el-table-column label="库存" align="center" prop="stock" />
|
|
|
+ <el-table-column label="单价" align="center" prop="price" />
|
|
|
+ <el-table-column label="数量" align="center" prop="count" width="200px" :key="tablekey">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ <el-input-number v-model="scope.row.count" @change="handleProductCountChange(scope.row)" size="mini" :min="1" :max="scope.row.stock" ></el-input-number>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="小计" align="center" prop="money" />
|
|
|
+ <el-table-column label="操作" align="center" width="100px" >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ @click="handleDelete(scope.row)"
|
|
|
+ >删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <el-row>
|
|
|
+ <el-col>
|
|
|
+ <span>商品合计:{{products.length}}</span><span style="margin-left:10px;">商品总价:{{totalMoney.toFixed(2)}}</span>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="赠品列表" >
|
|
|
+
|
|
|
+ <div style="float: right">
|
|
|
+ <el-button
|
|
|
+ plain
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ @click="handleAddGiftProduct"
|
|
|
+ >添加商品</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ <el-table border width="100%" style="margin-top:5px;" :data="giftProducts">
|
|
|
+ <el-table-column label="商品编号" align="center" prop="barCode" />
|
|
|
+ <el-table-column label="商品图片" align="center" width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-popover
|
|
|
+ placement="right"
|
|
|
+ itle=""
|
|
|
+ trigger="hover"
|
|
|
+ >
|
|
|
+ <img slot="reference" :src="scope.row.image" width="50">
|
|
|
+ <img :src="scope.row.image" style="max-width: 50px;">
|
|
|
+ </el-popover>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="商品名称" show-overflow-tooltip align="center" prop="productName" />
|
|
|
+ <el-table-column label="商品规格" align="center" prop="sku" />
|
|
|
+ <el-table-column label="库存" align="center" prop="stock" />
|
|
|
+ <el-table-column label="单价" align="center" prop="price" />
|
|
|
+ <el-table-column label="数量" align="center" prop="count" width="200px" :key="tablekey">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ <el-input-number v-model="scope.row.count" @change="handleProductCountChange(scope.row)" size="mini" :min="1" :max="scope.row.stock" ></el-input-number>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="小计" align="center" prop="money" />
|
|
|
+ <el-table-column label="操作" align="center" width="100px" >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ @click="handleDelete(scope.row)"
|
|
|
+ >删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="支付方式" prop="payType">
|
|
|
+ <el-select v-model="createOrderForm.payType" placeholder="请选择支付方式" clearable size="small" >
|
|
|
+ <el-option
|
|
|
+ v-for="item in payTypeOptions"
|
|
|
+ :key="item.dictValue"
|
|
|
+ :label="item.dictLabel"
|
|
|
+ :value="item.dictValue"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="抵扣金额" prop="reduceAmount">
|
|
|
+ <el-input-number v-model="createOrderForm.reduceAmount" placeholder="抵扣金额" size="medium" :precision="2" :min=0.01 :step="0.1" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="createOrderSubmitForm">确 定</el-button>
|
|
|
+ <el-button @click="createOrderCancel">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog :title="product.title" v-if="product.open" :visible.sync="product.open" width="1000px" append-to-body>
|
|
|
+ <product-select ref="Details" @selectProduct="selectProduct" />
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog :title="giftProduct.title" v-if="giftProduct.open" :visible.sync="giftProduct.open" width="1000px" append-to-body>
|
|
|
+ <product-select ref="GiftDetails" @selectProduct="selectGiftProduct" />
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -301,12 +499,13 @@ import {
|
|
|
getCompanyUserAndDoctor, getPrescribeListByIdAndPhone, claimCustomer,getCustomerLogList
|
|
|
} from '@/api/qw/companyCustomer'
|
|
|
import {parseTime} from '@/utils/common'
|
|
|
-
|
|
|
+import {getCitys} from "@/api/hisStore/city";
|
|
|
import CollectionInfoDialog from './CollectionInfoDialog.vue'
|
|
|
+import productSelect from "../../hisStore/components/erpProductSelect";
|
|
|
|
|
|
export default {
|
|
|
name: "Customer",
|
|
|
- components: {CollectionInfoDialog},
|
|
|
+ components: {CollectionInfoDialog, productSelect},
|
|
|
data() {
|
|
|
const validatePhone = (rule, value, callback) => {
|
|
|
if (!value) {
|
|
|
@@ -387,6 +586,11 @@ export default {
|
|
|
{label: '男', value: '1'},
|
|
|
{label: '未知', value: '2'}
|
|
|
],
|
|
|
+ erpList:[
|
|
|
+ {dictLabel: '聚水潭', dictValue: '1'},
|
|
|
+ {dictLabel: '兔灵', dictValue: '2'},
|
|
|
+ {dictLabel: '京东云仓', dictValue: '3'}
|
|
|
+ ],
|
|
|
// 处方相关
|
|
|
prescribeOpen: false,
|
|
|
prescribeLoading: false,
|
|
|
@@ -433,13 +637,201 @@ export default {
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
companyCustomerId: null // 当前查看的客户ID
|
|
|
- }
|
|
|
+ },
|
|
|
+ createOrder:{
|
|
|
+ open: false,
|
|
|
+ title: '创建订单',
|
|
|
+ },
|
|
|
+ createOrderForm: {
|
|
|
+
|
|
|
+ },
|
|
|
+ createOrderRules: {
|
|
|
+ },
|
|
|
+
|
|
|
+ citys:[],
|
|
|
+ province:[],
|
|
|
+ city:[],
|
|
|
+ district:[],
|
|
|
+
|
|
|
+ products:[],
|
|
|
+ product:{
|
|
|
+ open:false,
|
|
|
+ title:"商品选择"
|
|
|
+ },
|
|
|
+
|
|
|
+ giftProducts:[],
|
|
|
+ giftProduct:{
|
|
|
+ open:false,
|
|
|
+ title:"赠品选择"
|
|
|
+ },
|
|
|
+ tablekey:false,
|
|
|
+ totalMoney:0.00,
|
|
|
+
|
|
|
+ payTypeOptions:[],
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- this.getList()
|
|
|
+ this.getList();
|
|
|
+ this.getCityList();
|
|
|
+ this.getDicts("sys_store_pay_type").then((response) => {
|
|
|
+ this.payTypeOptions = response.data;
|
|
|
+ });
|
|
|
},
|
|
|
methods: {
|
|
|
+ createOrderSubmitForm(){
|
|
|
+
|
|
|
+ this.$refs["createOrderForm"].validate(valid => {
|
|
|
+ if(this.products.length==0){
|
|
|
+ this.msgError("请选择商品");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.createOrderForm.products=this.products;
|
|
|
+ if(this.giftProducts.length > 0) {
|
|
|
+ this.createOrderForm.giftProducts=this.giftProducts;
|
|
|
+ }
|
|
|
+ console.log(this.createOrderForm);
|
|
|
+ return;
|
|
|
+ if (valid) {
|
|
|
+ createUserOrder(this.createOrderForm).then(response => {
|
|
|
+ if (response.code === 200) {
|
|
|
+ this.msgSuccess("创建成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 取消按钮
|
|
|
+ createOrderCancel() {
|
|
|
+ this.open = false;
|
|
|
+ this.createOrderReset();
|
|
|
+ },
|
|
|
+ // 表单重置
|
|
|
+ createOrderReset() {
|
|
|
+ this.createOrderForm = {
|
|
|
+ products:null,
|
|
|
+ giftProducts:null,
|
|
|
+ };
|
|
|
+ this.resetForm("createOrderForm");
|
|
|
+ },
|
|
|
+ handleAddGiftProduct() {
|
|
|
+ if (this.createOrderForm.erpType== null || this.createOrderForm.erpType== '') {
|
|
|
+ return this.$message({
|
|
|
+ message: "请先选择ERP",
|
|
|
+ type: "warning",
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$refs.GiftDetails.getDetails(this.createOrderForm.erpType,1);
|
|
|
+ }, 1);
|
|
|
+ this.giftProduct.open = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ selectGiftProduct(row){
|
|
|
+ for(var i=0;i<this.products.length;i++){
|
|
|
+ if(this.products[i].id==row.id){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ row.count=1;
|
|
|
+ row.money=row.count*row.price;
|
|
|
+ this.products.push(row);
|
|
|
+ this.$message.success("商品"+ row.productName + "添加成功")
|
|
|
+ this.compute();
|
|
|
+ },
|
|
|
+
|
|
|
+ changeErp(){
|
|
|
+ this.products = [];
|
|
|
+ this.giftProducts=[];
|
|
|
+ },
|
|
|
+ /** 删除按钮操作 */
|
|
|
+ handleDelete(row) {
|
|
|
+ this.products.splice(this.products.findIndex(item => item.id === row.id), 1)
|
|
|
+ this.compute();
|
|
|
+
|
|
|
+ },
|
|
|
+ handleAddProduct(){
|
|
|
+ if(this.createOrderForm.erpType== null || this.createOrderForm.erpType== '') {
|
|
|
+ return this.$message({
|
|
|
+ message: "请先选择ERP",
|
|
|
+ type: "warning",
|
|
|
+ });
|
|
|
+ } else{
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$refs.Details.getDetails(this.createOrderForm.erpType);
|
|
|
+ }, 1);
|
|
|
+ this.product.open=true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ compute(){
|
|
|
+ this.totalMoney=0;
|
|
|
+ var that=this;
|
|
|
+ this.products.forEach (function (value) {
|
|
|
+ that.totalMoney += value.money;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleProductCountChange(row){
|
|
|
+ this.tablekey = !this.tablekey
|
|
|
+ row.money=row.count*row.price;
|
|
|
+ this.$forceUpdate();
|
|
|
+ this.compute();
|
|
|
+ },
|
|
|
+ selectProduct(row){
|
|
|
+ for(var i=0;i<this.products.length;i++){
|
|
|
+ if(this.products[i].id==row.id){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ row.count=1;
|
|
|
+ row.money=row.count*row.price;
|
|
|
+ this.products.push(row);
|
|
|
+ this.$message.success("商品"+ row.productName + "添加成功")
|
|
|
+ this.compute();
|
|
|
+ },
|
|
|
+ convertCityData(array) {
|
|
|
+ return array.map(item => {
|
|
|
+ return {
|
|
|
+ 'cityId': item.value,
|
|
|
+ 'name': item.label,
|
|
|
+ 'parentId': item.pid,
|
|
|
+ 'children': item.children && this.convertCityData(item.children)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ districtChange(val){
|
|
|
+ const item = this.district.find(i => i.cityId === val)
|
|
|
+ this.createOrderForm.district=item.name;
|
|
|
+ },
|
|
|
+ cityChange(val){
|
|
|
+ const item = this.city.find(i => i.cityId === val)
|
|
|
+ this.district = item.children
|
|
|
+ this.createOrderForm.district=null;
|
|
|
+ this.createOrderForm.city=item.name;
|
|
|
+ this.createOrderForm.cityId=val;
|
|
|
+ },
|
|
|
+ provinceChange(val){
|
|
|
+ const item = this.citys.find(i => i.cityId === val)
|
|
|
+ this.city = item.children
|
|
|
+ this.district=[];
|
|
|
+ this.createOrderForm.city=null;
|
|
|
+ this.createOrderForm.district=null;
|
|
|
+ this.createOrderForm.province=item.name;
|
|
|
+ },
|
|
|
+ getCityList(){
|
|
|
+ getCitys().then(res => {
|
|
|
+ this.loading = false;
|
|
|
+ this.citys = this.convertCityData(res.data)
|
|
|
+ this.province=this.citys.filter(item => item.parentId===0 )
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleCreateOrder(row){
|
|
|
+ this.createOrderReset();
|
|
|
+ this.createOrder.open = true;
|
|
|
+ this.createOrderForm.companyCustomerId = row.id;
|
|
|
+ },
|
|
|
// 认领状态格式化
|
|
|
claimStatusFormat(row) {
|
|
|
return row.claimStatus === 1 ? '已认领' : '未认领';
|