Jelajahi Sumber

帮机构下单版本

zhengjinyi 1 tahun lalu
induk
melakukan
5271f31863

+ 72 - 48
src/main/resources/static/js/supplier-center/order/order-create.js

@@ -59,7 +59,9 @@ const seeDetail = new Vue({
             townList:[],
             productsArr:[],
             isLoading:true,
+            abnormalProductList:[],// 成本异常商品
             goodsDialogVisible:false,
+            abnormalDialogVisible:false,
             productRadio:null,
             checkedProductList:[],
             total:0,
@@ -98,7 +100,12 @@ const seeDetail = new Vue({
     computed: {
         disabled() {
             return this.productRadio === null
-        }
+        },
+        checkedConfirmFlag(){
+            if(this.confirmParam.cityId && this.checkedProductList.length > 0 ){
+                return true
+            }
+        },
     },
     methods: {
         // 计算总运费
@@ -126,38 +133,38 @@ const seeDetail = new Vue({
             }
         },
         getProvinceOptions(){ // 获取全部省份
-            const _self = this;
+            const _this = this;
             OrderApi.GetAddressSelect({},function(res){
                 if(res.code === 0 && res.data){
-                    _self.provinceList = res.data;
+                    _this.provinceList = res.data;
                 }else{
                     CAIMEI.Alert(res.msg,'确定',false);
                 }
             });
         },
         getCityList(parentId){// 获取地区
-            const _self = this;
+            const _this = this;
             this.cityList = [];
             this.townList = [];
             this.addressForm.cityId = '';
             this.addressForm.townId = '';
             OrderApi.GetAddressSelect({ parentId: parentId,type:1 },function(res){
                 if(res.code === 0 && res.data){
-                    _self.cityList = res.data;
+                    _this.cityList = res.data;
                 }else{
                     CAIMEI.Alert(res.msg,'确定',false);
                 }
             });
         },
         getTownList(parentId){
-            const _self = this;
+            const _this = this;
             this.townList = [];
             this.addressForm.townId = '';
             this.confirmParam.cityId = this.prosParams.cityId = this.addressForm.cityId
             console.log('cityId',this.confirmParam.cityId)
             OrderApi.GetAddressSelect({parentId: parentId,type:2},function(res){
                 if(res.code === 0 && res.data){
-                    _self.townList = res.data;
+                    _this.townList = res.data;
                 }else{
                     CAIMEI.Alert(res.msg,'确定',false);
                 }
@@ -170,8 +177,34 @@ const seeDetail = new Vue({
             }
         },
         handleConfirm(){
-            this.checkedDataForm()
-            this.checkedInvoiceForm()
+            // 校验收货信息
+            this.$refs['dataForm'].validate(async valid => {
+                if (valid) {
+                    if(this.productsArr.length === 0){
+                        this.$alert('请添加商品~', '提示', {
+                            type: 'warning',
+                            confirmButtonText: '确定',
+                        });
+                    }
+                }
+            })
+            // 校验发票
+            if(this.invoiceForm.type!==0){
+                this.$refs['invoiceForm'].validate(async valid => {
+                    if (valid) {
+                        if(this.checkedConfirmFlag){
+                            this.initializationParams()
+                        }
+                    }
+                })
+            }else {
+                if(this.checkedConfirmFlag){
+                    this.initializationParams()
+                }
+            }
+        },
+        //统一处理
+        initializationParams(){
             // 发票信息
             if(this.invoiceForm.type!==0){
                 this.invoiceForm.type = parseInt(this.invoiceForm.type)
@@ -220,8 +253,13 @@ const seeDetail = new Vue({
             SupplierApi.shopGenerateOrder(params,function(response){
                 if(response.code === 0){
                     const data = response.data
-                    _this.$message({  message: '订单提交成功~',type: 'success'})
+                    _this.$notify({
+                        title: '成功',
+                        message: '订单已提交~',
+                        type: 'success'
+                    });
                     setTimeout(()=>{
+                        _this.formatConfirmParam()
                         window.location.href = '/supplier/order/detail.html?shopOrderId='+data.shopOrderId
                     },2000)
                 }else{
@@ -238,27 +276,7 @@ const seeDetail = new Vue({
             this.confirmParam.orderInvoice = JSON.parse(this.confirmParam.orderInvoice);
             console.log('payInfo',this.confirmParam.payInfo)
         },
-        // 校验地址
-        checkedDataForm(){
-            this.$refs['dataForm'].validate(async valid => {
-                if (valid) {
-                    if(this.productsArr.length === 0){
-                        this.$alert('请添加商品~', '提示', {
-                            type: 'warning',
-                            confirmButtonText: '确定',
-                        });
-                    }
-                }
-            })
-        },
-        // 校验发票
-        checkedInvoiceForm(){
-            this.$refs['invoiceForm'].validate(async valid => {
-                if (valid) {
-                  return true
-                }
-            })
-        },
+        // 添加商品弹窗显示
         handleShowVisible(){
             this.getProductList()
             this.goodsDialogVisible = true
@@ -285,13 +303,11 @@ const seeDetail = new Vue({
         // 删除确认商品
         handleDelete(index){
             this.checkedProductList.splice(index, 1)
-            console.log('checkedProductList',this.checkedProductList)
             if(this.checkedProductList.length === 0){
                 this.productsArr = []
             }
             if(this.checkedProductList.length > 0){
                 this.prosParams.productInfo = this.handleProStringify(this.checkedProductList)
-                console.log('prosParams',this.prosParams)
                 this.getSettlement(this.prosParams)
             }
         },
@@ -299,9 +315,7 @@ const seeDetail = new Vue({
         handleAddProConfirm(){
             this.checkedProductList = [...this.checkedProductList,...this.productRadio]
             this.prosParams.productInfo = this.handleProStringify(this.checkedProductList)
-            console.log('prosParams',this.prosParams)
             this.getSettlement(this.prosParams)
-            this.handleCanle()
         },
         // 统一格式化确认订单商品信息参数
         handleProStringify(productInfo){
@@ -320,19 +334,29 @@ const seeDetail = new Vue({
             this.orderInfoArray =[]
             SupplierApi.getSettlement(params,function(response){
                 if(response.code === 0){
-                    let data = response.data.shop
-                    _this.supplier = data
-                    console.log('supplier', _this.supplier)
-                    _this.orderInfoArray.push(_this.supplier)
-                    console.log('orderInfoArray', _this.orderInfoArray)
-                    _this.hanldShouldPayFee = data.totalPrice;
-                    _this.supplier.handlePostageFlag = data.postageFlag
-                    _this.productsArr = data.cartList
+                    let data = response.data
+                    if(data.abnormalProductList.length > 0){
+                        _this.abnormalProductList = data.abnormalProductList
+                        _this.abnormalDialogVisible = true
+                    }else{
+                        _this.supplier = data.shop
+                        _this.orderInfoArray.push(_this.supplier)
+                        _this.hanldShouldPayFee = data.shop.totalPrice;
+                        _this.supplier.handlePostageFlag = data.shop.postageFlag
+                        _this.productsArr = data.shop.cartList
+                        _this.handleCanle()
+                    }
                 }else{
-
+                    _this.$message.error(response.msg)
                 }
             })
         },
+        // 隐藏提示
+        handleAbnormalDialogVisible(){
+            // this.productRadio = null
+            // this.checkedProductList = []
+            this.abnormalDialogVisible = false
+        },
         // 选择商品
         handleSelectionChange(row) {
             this.productRadio = row
@@ -355,10 +379,10 @@ const seeDetail = new Vue({
         },
     },
     mounted () {
-        const _self = this;
+        const _this = this;
         this.getProvinceOptions();
         if (isPC) {
-            _self.open = true;
+            _this.open = true;
         }
         if(globalUserData){
             this.listQuery.shopId = this.confirmParam.shopId =  globalUserData.shopId;
@@ -369,9 +393,9 @@ const seeDetail = new Vue({
             var isCSS1Compat = ((document.compatMode || "") === "CSS1Compat"); // 判断渲染模式是不是标准模式
             var scrollHeight = supportPageOffset ? window.pageYOffset : isCSS1Compat ? document.documentElement.scrollTop : document.body.scrollTop;
             if (scrollHeight < 100) {
-                _self.isFiexd = true
+                _this.isFiexd = true
             } else {
-                _self.isFiexd = false
+                _this.isFiexd = false
             }
         });
     },

+ 2 - 6
src/main/resources/static/js/supplier-center/order/order-share-detail.js

@@ -123,9 +123,7 @@ const orderPage = new Vue({
                     _self.voucherList = data.voucher;
                     _self.isRequset = false;
                 } else {
-                    CAIMEI.Alert(response.msg, '确定', true, function () {
-                        location.href = '/user/dashboard.html';
-                    });
+                    _self.$message.error(response.msg)
                 }
             })
         },
@@ -135,9 +133,7 @@ const orderPage = new Vue({
             if(this.isWeChatBrowser && !isPC){
                 this.handleWechatMinLink()
             }else{
-                this.$alert('请在手机微信内打开本页面进行确认订单操作。', '提示', {
-                    confirmButtonText: '确定',
-                });
+                CAIMEI.Alert('请在手机微信内打开本页面进行确认订单操作。', '确定');
             }
         },
         // 获取小程序路径并跳转

+ 2 - 2
src/main/resources/static/js/supplier/index.js

@@ -129,7 +129,7 @@ var supplierHome = new Vue({
                         }
                         _self.mainProducts = res.data;
                     } else {
-                        CAIMEI.Alert(res.msg, '确定');
+                        _self.$message.error(res.msg)
                     }
                 }
             );
@@ -161,7 +161,7 @@ var supplierHome = new Vue({
                         console.log('productLists',_self.productLists)
                         _self.requestFlag = true;
                     } else {
-                        CAIMEI.Alert(res.msg, '确定');
+                        _self.$message.error(res.msg)
                     }
                 }
             );

+ 38 - 15
src/main/resources/templates/supplier-center/order/order-create.html

@@ -225,21 +225,23 @@
               <el-form-item label="发票抬头:" label-position="left" prop="invoiceTitle" :rules="rules.invoiceTitle" label-width="98px">
                 <el-input v-model="invoiceForm.invoiceTitle" placeholder="请填写发票抬头"  maxlength="20"></el-input>
               </el-form-item>
-              <el-form-item v-show="invoiceForm.headingType==1" label="单位税号:" label-position="left" prop="corporationTaxNum" :rules="rules.corporationTaxNum" label-width="98px">
-                <el-input v-model="invoiceForm.corporationTaxNum" placeholder="请填写单位税号"  maxlength="20"></el-input>
-              </el-form-item>
-              <el-form-item v-show="invoiceForm.headingType==1" label="注册地址:" label-position="left" label-width="98px">
-                <el-input v-model="invoiceForm.registeredAddress" placeholder="请填写注册地址"  maxlength="40"></el-input>
-              </el-form-item>
-              <el-form-item v-show="invoiceForm.headingType==1" label="注册电话:" label-position="left" label-width="98px">
-                <el-input v-model="invoiceForm.registeredPhone" placeholder="请填写注册电话"  maxlength="15"></el-input>
-              </el-form-item>
-              <el-form-item v-show="invoiceForm.headingType==1" label="开户银行:" label-position="left" label-width="98px">
-                <el-input  v-model="invoiceForm.openBank" placeholder="请填写开户银行"  maxlength="15"></el-input>
-              </el-form-item>
-              <el-form-item v-show="invoiceForm.headingType==1" label="银行账号:" label-position="left" label-width="98px">
-                <el-input v-model="invoiceForm.bankAccountNo" placeholder="请填写银行账号"  maxlength="19"></el-input>
-              </el-form-item>
+              <template v-if="invoiceForm.headingType===1">
+                <el-form-item label="单位税号:" label-position="left" prop="corporationTaxNum" :rules="rules.corporationTaxNum" label-width="98px">
+                  <el-input v-model="invoiceForm.corporationTaxNum" placeholder="请填写单位税号"  maxlength="20"></el-input>
+                </el-form-item>
+                <el-form-item label="注册地址:" label-position="left" label-width="98px">
+                  <el-input v-model="invoiceForm.registeredAddress" placeholder="请填写注册地址"  maxlength="40"></el-input>
+                </el-form-item>
+                <el-form-item label="注册电话:" label-position="left" label-width="98px">
+                  <el-input v-model="invoiceForm.registeredPhone" placeholder="请填写注册电话"  maxlength="15"></el-input>
+                </el-form-item>
+                <el-form-item label="开户银行:" label-position="left" label-width="98px">
+                  <el-input  v-model="invoiceForm.openBank" placeholder="请填写开户银行"  maxlength="15"></el-input>
+                </el-form-item>
+                <el-form-item v-show="invoiceForm.headingType==1" label="银行账号:" label-position="left" label-width="98px">
+                  <el-input placeholder="请填写银行账号"  maxlength="19"></el-input>
+                </el-form-item>
+              </template>
             </template>
             <template v-if="invoiceForm.type===2">
               <el-form-item label="发票抬头:" label-position="left" prop="invoiceTitle" :rules="rules.invoiceTitle" label-width="98px">
@@ -337,6 +339,27 @@
         <el-button type="primary" :disabled="disabled" @click="handleAddProConfirm">确 定</el-button>
       </div>
     </el-dialog>
+    <!-- 商品价格异常弹窗  -->
+    <el-dialog
+            title="提示"
+            :visible.sync="abnormalDialogVisible"
+            width="700px"
+            :close-on-click-modal="false"
+            :show-close="false"
+    >
+      <el-tag type="danger" style="margin: 5px 0;">以下商品修改后的单价会导致不能覆盖成本和平台服务费,请重新修改。</el-tag>
+      <el-table ref="table" :data="abnormalProductList" height="300px" border >
+        <el-table-column prop="image" label="商品图片" align="center">
+          <template slot-scope="{ row }">
+            <img :src="row.image" :alt="row.name" style="width: 40px;height: 40px;">
+          </template>
+        </el-table-column>
+        <el-table-column prop="name" label="商品名称" align="center"></el-table-column>
+      </el-table>
+      <div slot="footer">
+        <el-button type="primary" @click="handleAbnormalDialogVisible">确定</el-button>
+      </div>
+    </el-dialog>
   </div>
   <!-- 引入底部 -->
   <template th:replace="components/footer"></template>