Browse Source

代码上传

zhangqi 1 year ago
parent
commit
bde8c92263

+ 688 - 0
src/DRP/HDrpManagement/orderManage/detail/index copy.vue

@@ -0,0 +1,688 @@
+<template>
+  <div>
+    <detail-template 
+    :headData="mainAreaData" 
+    :title="'订单号:'+orderData.sonum" 
+    :tabs="['订单明细','订单进度','发货单','收支明细','出库单','物流单']" 
+    :delParam="{id:'20221108152102',content:{sa_orderids:[router.currentRoute.value.query.id]}}" 
+    ownertable="sa_order" 
+    :disable="utils.isDisabled(orderData.status,[],(orderData.status !== '新建'))"
+    >
+      <template #operation>
+        <a-space>
+          <a-button v-if="canPrintBoolean" type="primary" size="mini" @click="printData">打印</a-button>
+          <edit v-if="utils.hasPermission('update')" :disabled="utils.isDisabled(orderData.status,[''],(orderData.status !=='新建'))"  :data="orderData" @onSuccess="mianData"></edit>
+          <a-space v-if="utils.isDisabled(orderData.status,[''],(orderData.type =='特殊订单'))">
+            <a-button v-if="utils.hasPermission('preSubmissionBack')" type="primary" :disabled="utils.isDisabled(orderData.status,[''],(orderData.status !=='预提交'))" @click="onSpcialSubmit(20230331152503,'预提交撤回',false)">预提撤回</a-button>
+            <a-button v-if="utils.hasPermission('preSubmissionConfirm')" type="primary" :disabled="utils.isDisabled(orderData.status,['提交','审核','确认','关闭','手工关闭'])" @click="onSpcialSubmit(20230331102503,'预提交确认',true)">预提交确认</a-button>
+            <a-button v-if="utils.hasPermission('preSubmissionConfirmBack')" type="primary" :disabled="utils.isDisabled(orderData.status,[''],(orderData.status !=='确认'))" @click="onSpcialSubmit(20230331102503,'反确认',false)">反确认</a-button>
+          </a-space>
+          <a-button v-if="utils.hasPermission('submit')" :disabled="utils.isDisabled(orderData.status,[''],canSubmit)" type="primary" size="mini" @click="onSubmit('提交')">提 交</a-button>
+          <returnBill :data="orderData" :enddate="enddate" :disabled="utils.isDisabled(orderData.status,['新建','预提交','确认','审核','关闭','手工关闭'])" @onSuccess="mianData"></returnBill>
+          <a-button v-if="utils.hasPermission('examine')" type="primary" :disabled="utils.isDisabled(orderData.status,[''],(orderData.status !=='提交'))" @click="checkBill(20221108153502,'审核')">审核</a-button>
+          <a-button v-if="utils.hasPermission('unExamine')" type="primary" :disabled="utils.isDisabled(orderData.status,[''],(orderData.status !=='审核'))" @click="checkBill(20230102141502,'反审核')">反审核</a-button>
+          <a-button v-if="utils.hasPermission('cancel')" type="primary" :disabled="utils.isDisabled(orderData.status,[''],(orderData.status !== '审核'))" @click="checkBill(20230406155202,'手工关闭')">关闭</a-button>
+          <a-button v-if="utils.hasPermission('copy')" type="primary" :disabled="utils.isDisabled(orderData.status,[''],(orderData.type === '促销订单'))">
+            <selectEnterprise :disabled="utils.isDisabled(orderData.status,[''],(orderData.type === '促销订单'))" :param="{id:20230219195002,content:{ismanage :1,pageNumber:1,pageSize:20,where:{condition:''}}}" @onSelect="copyOrder">
+              <template #text>复制</template>
+            </selectEnterprise>
+          </a-button>
+        </a-space>
+      </template>
+      <template v-if="orderData.sa_accountclassinfos" #customContent>
+        <a-divider orientation="left" orientation-margin="0px"><span class="almm">支付信息</span></a-divider>
+        <div class="account-item-panel" v-for="item in orderData.sa_accountclassinfos" :key="item.index">
+          <div class="account-item-panel-content">
+            <p style="color:red;font-weight: bold;">{{item.accountname}}</p><a-divider type="vertical" />
+            <p>实时余额: ¥<span class="accountAmount">{{utils.formatAmount(item.realbalance)}}</span></p><a-divider type="vertical" />
+            <p>当时余额: ¥<span class="accountAmount">{{utils.formatAmount(item.balance)}}</span></p><a-divider type="vertical" />
+            <p>信用额度: ¥{{utils.formatAmount(item.creditquota)}}</p><a-divider type="vertical" />
+            <div>本单支出: <span style="color:red">¥{{utils.formatAmount(item.amount)}}</span></div>
+          </div>
+        </div>
+      </template>
+      <template #tab0>
+        <normalTable :tableRowStyle="formatter" rowKey="sa_orderitemsid" ref="prodlist" :columns="utils.TBLayout('orderMxTable')" :tableid="utils.TBLayoutID('orderMxTable')" tableName="orderMxTable" size="small" :param="param" @onSelect="onSelectChange">
+          <template v-if="utils.hasPermission('orderMxedit')" #operation>
+            <a-space class="mt-10">
+              <a-button :disabled="utils.isDisabled(orderData.status,['确认','提交','审核','关闭'])" :type="isEditDisabled?'primary':'dashed'" @click="editRowProd">{{isEditDisabled?'行编辑':'保存'}}</a-button>
+              <tableImport :disabled="utils.isDisabled(orderData.status,['确认','提交','审核','关闭'])" :bindData="{ownerid:router.currentRoute.value.query.id,ownertable:'sa_order',usetype:'default'}" :failedData="failedData" :modeParam="{id:20230227194703,content:{}}" @uploadSuccess="importSuccess">
+              </tableImport>
+              <select-product :columns="utils.TBLayout('orderAddTable')" :tableid="utils.TBLayoutID('orderAddTable')" :disabled="utils.isDisabled(orderData.status,['确认','提交','审核','关闭'])"  :param="{id:20221109153502,content:{sa_orderid:orderData.sa_orderid,pageNumber:1,pageSize:20,where:{condition:''}}}" @onSelectChange="addProductToBody">
+                <template #tb_cell="{data}">
+                  <template v-if="data.column.dataIndex === 'qty'">
+                    <a-input-number style="width:100%" id="inputNumber" :precision="2" v-model:value="data.record.qty" :min="data.record.orderminqty" :step="data.record.orderaddqty"/>
+                  </template>
+                  <!-- <template v-if="data.column.dataIndex === 'length' && data.record.iscustomsize == 1">
+                    <a-select v-if="data.record.lengthschemedetails.length > 0" v-model:value="data.record.length" style="width: 150px" placeholder="选择长度">
+                      <a-select-option v-for="item in data.record.lengthschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
+                    </a-select>
+                    <a-input v-else style="width:200px;" v-model:value="data.record.length" :placeholder="`输入${data.record.lengthmin}到${data.record.lengthmax}长度`" @blur="validInput(data.record,data.record.lengthmin,data.record.lengthmax,'length')">
+                    </a-input>
+                  </template> -->
+                  <template v-if="data.column.dataIndex === 'iscustom' && data.record.iscustomsize == 1">
+                    <a-button type="link" @click="openCustom(data)">定制信息</a-button>
+                  </template>
+                  <!-- <template v-if="data.column.dataIndex === 'width' && data.record.iscustomsize == 1">
+                    <a-select v-if="data.record.widthschemedetails.length > 0" v-model:value="data.record.width" style="width: 150px" placeholder="选择宽度">
+                      <a-select-option v-for="item in data.record.widthschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
+                    </a-select>
+                    <a-input v-else style="width:200px;" v-model:value="data.record.width" :placeholder="`输入${data.record.widthmin}到${data.record.widthmax}宽度`" @blur="validInput(data.record,data.record.widthmin,data.record.widthmax,'width')">
+                    </a-input>
+                  </template> -->
+                  <template v-if="data.column.dataIndex === 'remarks'">
+                    <a-tooltip>
+                      <template #title>{{data.record.remarks}}</template>
+                      <a-input style="width:100%" :disabled="utils.isDisabled(orderData.status,['提交','审核','关闭'],isEditDisabled)" v-model:value="data.record.remarks" :min="1"  @change="inputChange(data.record,'remarks')"/>
+                    </a-tooltip>
+                  </template>
+                </template>
+              </select-product>
+              <a-button :disabled="utils.isDisabled(orderData.status,['确认','提交','审核','关闭'],(selectProductList.length == 0))" type="primary" @click="deleteProd">删除商品</a-button>
+              <order-discount :id="router.currentRoute.value.query.id" :data="selectProductList" :disabled="utils.isDisabled(orderData.status,['确认','提交','审核','关闭'])" @onSuccess="onSuccess"></order-discount>
+              <a-button :disabled="utils.isDisabled(orderData.status,['新建','确认','提交','关闭'],(selectProductList.length == 0))" type="primary" @click="quickSendProduct">一键发货</a-button>
+              <a-button :disabled="utils.isDisabled(orderData.status,['新建','确认','提交','关闭'],(selectProductList.length == 0))" type="primary" @click="freezeRows(true)">行冻结</a-button>
+              <a-button :disabled="utils.isDisabled(orderData.status,['新建','确认','提交','关闭'],(selectProductList.length == 0))" type="primary" @click="freezeRows(false)">解冻行</a-button>
+              <hasSelected :columns="utils.TBLayout('orderMxTable')"></hasSelected>
+            </a-space>
+          </template>
+          <template v-if="utils.hasPermission('orderMxedit')" #tb_cell="{data}">
+            <template  v-if="data.column.dataIndex === 'qty'">
+              <a-input-number v-model:value="data.record.qty" :precision="2" :disabled="utils.isDisabled(orderData.status,['提交','审核','关闭'],isEditDisabled)" :min="data.record.orderminqty" :step="data.record.orderaddqty" @change="inputChange(data.record,'qty')"></a-input-number>
+            </template>
+            <template v-if="data.column.dataIndex === 'price'">
+              <a-input v-if="canEdit" v-model:value="data.record.price" :disabled="utils.isDisabled(orderData.status,['提交','审核','关闭'],isEditDisabled)"  @change="inputChange(data.record,'price')"></a-input>
+            </template>
+            <template v-if="data.column.dataIndex === 'amount'">
+              <a-input v-if="canEdit" v-model:value="data.record.amount" :disabled="utils.isDisabled(orderData.status,['提交','审核','关闭'],isEditDisabled)"  @change="inputChange(data.record,'amount')"></a-input>
+            </template>
+            <template v-if="data.column.dataIndex === 'remarks'">
+              <a-tooltip>
+                <template #title>{{data.record.remarks}}</template>
+                <a-input style="width:100%" :disabled="utils.isDisabled(orderData.status,['提交','审核','关闭'],isEditDisabled)" v-model:value="data.record.remarks" :min="1"  @change="inputChange(data.record,'remarks')"/>
+              </a-tooltip>            
+            </template>
+          </template>
+        </normalTable>
+      </template>
+      <template #tab1>
+        <od-progress></od-progress>
+      </template>
+      <template #tab2>
+        <dispatch-temp></dispatch-temp>
+      </template>
+      <template #tab3>
+        <income-mx></income-mx>
+      </template>
+      <template #tab4>
+        <sale-out-bill></sale-out-bill>
+      </template>
+      <template #tab5>
+        <logistics-order></logistics-order>
+      </template>
+    </detail-template>
+    <print ref="printRef" :list="reportList" @onModeClick="onModeClick"></print>
+    <a-modal v-model:open="open" title="定制信息" @ok="handleOk" style="text-align:center">
+      <div class="mt-10" v-if="prod.record.cheekschemeid > 0">
+        <span class="label">工艺</span>
+        <a-select v-model:value="prod.record.customcheek" style="width: 200px" placeholder="选择长度">
+          <a-select-option v-for="item in prod.record.cheekschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
+        </a-select>
+      </div>
+      <div class="mt-10" v-if="prod.record.colorschemeid > 0">
+        <span class="label">颜色</span>
+        <a-select v-model:value="prod.record.customcolors" style="width: 200px" placeholder="选择长度">
+          <a-select-option v-for="item in prod.record.colorsschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
+        </a-select>
+      </div>
+      <div class="mt-10" v-if="prod.record.materialschemeid > 0">
+        <span class="label">选项</span>
+        <a-select v-model:value="prod.record.custommaterial" style="width: 200px" placeholder="选择长度">
+          <a-select-option v-for="item in prod.record.materialschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
+        </a-select>
+      </div>
+      <div class="mt-10" v-if="prod.record.spec == '自定义' || prod.record.spec == 'custom'">
+        <span class="label">长度</span>
+        <a-select v-if="prod.record.lengthschemedetails.length > 0" v-model:value="prod.record.length" style="width: 200px" placeholder="选择长度">
+          <a-select-option v-for="item in prod.record.lengthschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
+        </a-select>
+        <a-input v-else style="width:200px;" v-model:value="prod.record.length" :placeholder="`输入${prod.record.lengthmin}到${prod.record.lengthmax}长度`" @blur="validInput(prod.record,prod.record.lengthmin,prod.record.lengthmax,'length')">
+        </a-input>
+      </div>
+      <div class="mt-10" v-if="prod.record.spec == '自定义' || prod.record.spec == 'custom'">
+        <span class="label">宽度</span>
+        <a-select v-if="prod.record.widthschemedetails.length > 0" v-model:value="prod.record.width" style="width: 200px" placeholder="选择宽度">
+          <a-select-option v-for="item in prod.record.widthschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
+        </a-select>
+        <a-input v-else style="width:200px;" v-model:value="prod.record.width" :placeholder="`输入${prod.record.widthmin}到${prod.record.widthmax}宽度`" @blur="validInput(prod.record,prod.record.widthmin,prod.record.widthmax,'width')">
+        </a-input>
+      </div>
+    </a-modal>
+  </div>
+</template>
+
+<script setup>
+import Api from '@/api/api'
+import utils  from '@/utils/utils'
+import orderDiscount from './modules/orderDiscount.vue'
+import normalTable from '@/template/normalTable/index.vue'
+import tableImport from '@/components/tableImport/index.vue'
+import hasSelected from '@/template/hasTableSelect/index.vue'
+import SelectProduct from '@/template/selectProduct/index.vue'
+import selectEnterprise from '@/template/selectEnterprise/index.vue'
+import detailTemplate from '@/components/detailTemplate/index.vue'
+import edit from './modules/edit.vue'
+import returnBill from './modules/returnBill.vue'
+import OdProgress from './tabs/progress.vue'
+import DispatchTemp from './tabs/dispatch.vue'
+import saleOutBill from './tabs/saleOutBill.vue'
+import logisticsOrder from './tabs/logisticsOrder.vue'
+import IncomeMx from './tabs/income.vue'
+import print from '@/components/print/index.vue'
+
+import { Modal } from 'ant-design-vue'
+import { message } from 'ant-design-vue';
+import { storeToRefs } from 'pinia'
+import { useAuthStore } from '@/stores/modules/auth'
+import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
+import { useRouter } from "vue-router";
+import { onMounted,ref,createVNode,computed,onBeforeUnmount } from "vue";
+const store = useAuthStore()
+let { app } = storeToRefs(store)
+const router = useRouter()
+const mainAreaData = ref([])
+const current = ref(0)
+const isEditDisabled = ref(true)
+const param = ref({
+  "id": 20221109093902,
+  "content": {
+    "nocache":true,
+    "sa_orderid": router.currentRoute.value.query.id, //订单ID
+    "pageNumber": 1,
+    "pageSize": 20,
+    "where": {
+      "condition": ""
+    }
+  },
+})
+const canSubmit = computed(()=>{
+  if (orderData.value.type == '特殊订单' && orderData.value.status !=='确认') {
+    return true
+  }
+  if (orderData.value.type == '标准订单' && orderData.value.status !== '新建') {
+    return true
+  }
+  if (orderData.value.type == '促销订单' && orderData.value.status !== '新建') {
+    return true
+  }
+})
+const canEdit = computed(()=>{
+  if (orderData.value.type == '特殊订单') {
+    return true
+  } else {
+    return false
+  }
+})
+const orderData = ref({})
+const mianData = async (...args)=>{
+  const res = await Api.requested({
+    "id":'20221108151302',
+    "content": {
+      "nocache":true,
+      "sa_orderid":router.currentRoute.value.query.id,
+    }
+  })
+  orderData.value = res.data
+
+  changeDataStructure(res.data)
+  if (orderData.value.type == '促销订单') {
+    promotion()
+  }
+}
+const changeDataStructure = (data) => {
+  mainAreaData.value = utils.FormLayout('orderBillHead',data)
+  if (data.type === '促销订单') {
+    mainAreaData.value.splice(0,0,{
+      label:'活动名称',
+      value:data.promname,
+      span:4
+    })
+    mainAreaData.value.splice(1,0,{
+      label:'方案编码',
+      value:data.promnum,
+      span:2
+    })
+  }
+}
+const selectProductList = ref([])
+const onSelectChange = (val) =>{
+  selectProductList.value = val
+}
+const prodlist = ref()
+const hasChangeData = ref([])
+const inputChange = (val,type) =>{
+  switch (type){
+    case 'qty':
+      val.amount = val.qty * val.price
+      break;
+    case 'price':
+      val.amount = val.qty * val.price
+      break;
+    case 'amount':
+       val.price = val.amount / val.qty
+      break;
+    default:
+      break;
+  }
+  if (hasChangeData.value.some(e=>e.sa_orderitemsid == val.sa_orderitemsid)) {
+    hasChangeData.value.filter(e=>{
+      if (e.sa_orderitemsid == val.sa_orderitemsid) {
+        e = val
+        return false
+      }
+    })
+  } else {
+    hasChangeData.value = [...hasChangeData.value,...[val]]
+  }
+}
+const editRowProd = ()=>{
+  if (isEditDisabled.value) {
+    isEditDisabled.value = !isEditDisabled.value
+    return false
+  }
+  if (hasChangeData.value.length == 0) {
+    isEditDisabled.value = true
+  } else {
+    updateProd(hasChangeData.value,'修改成功',()=>{
+      hasChangeData.value = []
+      isEditDisabled.value = true
+    })
+  }
+ 
+}
+const updateProd = async (data,msg,fn) =>{
+  const res = await Api.post({
+    id:20221109093602,
+    content:{
+      sa_orderid:orderData.value.sa_orderid,
+      sys_enterpriseid:orderData.value.sys_enterpriseid,
+      type:orderData.value.type,
+      sa_order_v:orderData.value.sa_order_v,
+      sa_contractid: orderData.value.sa_contractid,
+      items:data.map(e=>{
+        return {
+          sa_orderitemsid:e.sa_orderitemsid,
+          itemid:e.itemid,
+          qty:e.qty,
+          price:e.price,
+          amount:0,
+          sa_orderitems_v:e.sa_orderitems_v,
+          defaultprice:e.defaultprice,
+          remarks:e.remarks,
+          length:e.length ? e.length:0,
+          width:e.width ? e.width:0,
+          sa_promotion_itemsid:e.sa_promotion_itemsid,
+          customcolors:e.customcolors ? e.customcolors:0,
+          customcheek:e.customcheek ? e.customcheek:0,
+          custommaterial:e.custommaterial ? e.custommaterial:0
+        }
+      })
+    }
+  })
+  utils.message(res,msg,()=>{
+    mianData()
+    prodlist.value.listData()
+    fn ? fn(): ''
+  })
+ 
+}
+const validInput = async (record,min,max,type)=>{
+  if (record[type] > max) {
+    record[type] = max
+  } else if (record[type] < min) {
+    record[type] = min
+  } else {
+    record[type] = record[type]
+  }
+}
+const addProductToBody = async (val) =>{
+  const allowAdd = (e) => {
+    if (e.cheekschemeid > 0 && e.customcheek) {
+      return true
+    } else if (e.colorschemeid > 0 && e.customcolors) {
+      return true
+    } else if (e.materialschemeid > 0 && e.custommaterial) {
+      return true
+    } else {
+      message.error(e.itemname + '定制信息不完整,请检查!')
+      return false
+    }
+  }
+  let data = val.map(e=>{
+    if (e.iscustomsize == 1 && e.length && e.width) {
+      console.log(allowAdd(e))
+      if (!allowAdd(e)) return false
+      return {
+        sa_orderitemsid:0,
+        itemid:e.itemid,
+        qty:e.qty,
+        length:e.length ? e.length:0,
+        width:e.width ? e.width:0,
+        customcolors:e.customcolors ? e.customcolors:0,
+        customcheek:e.customcheek ? e.customcheek:0,
+        custommaterial:e.custommaterial ? e.custommaterial:0
+      }
+    } else if (e.iscustomsize == 0) {
+      return {
+        sa_orderitemsid:0,
+        itemid:e.itemid,
+        qty:e.qty,
+        length:0,
+        width:0
+      }
+    } else {
+      message.error(e.itemname + '定制信息有误,请检查!')
+    }
+  })
+  data.filter(e=>e !== undefined).length > 0 ? updateProd(data.filter(e=>e !== undefined),'添加成功',()=>{
+    prodlist.value.tableRecord = []
+  }):''
+}
+const deleteProd = ()=>{
+  Modal.confirm({
+    title: '删除商品',
+    icon: createVNode(ExclamationCircleOutlined),
+    content: `当前选中${selectProductList.value.length}个商品,删除${selectProductList.value.length}个商品!`,
+    okText: '确认',
+    cancelText: '取消',
+    async onOk() {
+      const res = await Api.post({
+        id:20221109093702,
+        content:{
+          sa_orderid:orderData.value.sa_orderid,
+          sa_orderitemsids:selectProductList.value.map(e=>{
+            return e.sa_orderitemsid
+          })
+        }
+      })
+      utils.message(res,'删除成功',()=>{
+        prodlist.value.reloadSelect()
+        selectProductList.value = []
+        prodlist.value.listData()
+        mianData()
+      })
+    },
+    onCancel() {},
+  })
+}
+const onSuccess = ()=>{
+  prodlist.value.listData()
+}
+const onSpcialSubmit = async (id,msg,value)=>{
+  Modal.confirm({
+    title: '提示',
+    icon: createVNode(ExclamationCircleOutlined),
+    content: `确定${msg}该订单吗!`,
+    okText: '确认',
+    cancelText: '取消',
+    async onOk() {
+      const res = await Api.post({
+        id:id,
+        content:{
+          "sa_orderid": orderData.value.sa_orderid,
+          "isrecheck":value
+        }
+      })
+      utils.message(res,msg + '成功',()=>{
+        mianData()
+      })
+    },
+    onCancel() {},
+  })
+}
+const checkBill = async (id,msg)=>{
+  Modal.confirm({
+    title: '提示',
+    icon: createVNode(ExclamationCircleOutlined),
+    content: `确定${msg}该订单吗?`,
+    okText: '确认',
+    cancelText: '取消',
+    async onOk() {
+      const res = await Api.post({
+        id:id,
+        content:{
+          "sa_orderid": orderData.value.sa_orderid,
+          "reviewtype":''
+        }
+      })
+      utils.message(res,`${msg}成功`,()=>{
+        mianData()
+      })
+    },
+    onCancel() {},
+  })
+}
+const onSubmit = async (id,msg)=>{
+  Modal.confirm({
+    title: '提示',
+    icon: createVNode(ExclamationCircleOutlined),
+    content: `确定提交该订单吗?`,
+    okText: '确认',
+    cancelText: '取消',
+    async onOk() {
+      const res = await Api.post({
+        id:20221108153402,
+        content:{
+          "sa_orderid": orderData.value.sa_orderid,
+          "reviewtype":''
+        }
+      })
+      utils.message(res,`提交成功`,()=>{
+        mianData()
+      })
+    },
+    onCancel() {},
+  })
+}
+const quickSendProduct = ()=>{
+  Modal.confirm({
+    title: '一键发货',
+    icon: createVNode(ExclamationCircleOutlined),
+    content: `当前选中${selectProductList.value.length}个商品!`,
+    okText: '确认',
+    cancelText: '取消',
+    async onOk() {
+      const res = await Api.post({
+        id:20230220100604,
+        content:{
+          sa_orderid:orderData.value.sa_orderid,
+          sa_orderitemsids:selectProductList.value.map(e=>{
+            return e.sa_orderitemsid
+          })
+        }
+      })
+      utils.message(res,'创建成功',()=>{
+        prodlist.value.reloadSelect()
+        selectProductList.value = []
+        router.push({path:'/dispatchDetail',query:{id:res.data.sa_dispatchid}})
+      })
+    },
+    onCancel() {},
+  })
+}
+const formatter = (_record, index) => {
+  if (_record.undeliqty > 0 && orderData.value.status == '审核') {
+    return 'table-striped-red'
+  } else {
+    return null
+  }
+}
+/**
+ * 获取促销订单方案详情
+ */
+const enddate = ref('')
+const promotion = async () =>{
+  const res = await Api.requested({
+    id:20221230144703,
+    content:{
+      nocache:true,
+      sa_promotionid:orderData.value.sa_promotionid
+    }
+  })
+  enddate.value = res.data.enddate
+}
+
+const freezeRows = (bool)=>{
+  if (bool && selectProductList.value.some(e=>e.isfreeze == 1)) {
+    return message.error('存在已经冻结的行数据,请重新选择!')
+  } 
+  if (!bool && selectProductList.value.some(e=>e.isfreeze == 0)) {
+    return message.error('存在未冻结的行数据,请重新选择!')
+  }
+  Modal.confirm({
+    title: '是否冻结行',
+    icon: createVNode(ExclamationCircleOutlined),
+    content: `当前选中${selectProductList.value.length}行!`,
+    okText: '确认',
+    cancelText: '取消',
+    async onOk() {
+      const res = await Api.post({
+        id:20230508093003,
+        content:{
+          isfreeze:bool,
+          sa_orderid:orderData.value.sa_orderid,
+          sa_orderitemsids:selectProductList.value.map(e=>{
+            return e.sa_orderitemsid
+          })
+        }
+      })
+      utils.message(res,`${bool?'冻结':'解冻'}成功`,()=>{
+        prodlist.value.reloadSelect()
+        selectProductList.value = []
+        prodlist.value.listData()
+      })
+    },
+    onCancel() {},
+  })
+}
+const copyOrder = async (val)=>{
+  const res = await Api.requested({
+    id:20230102144502,
+    content:{
+      sa_orderid:orderData.value.sa_orderid,
+      sys_enterpriseid:val.sys_enterpriseid
+    }
+  })
+  utils.message(res,'复制成功',()=>{
+    Modal.confirm({
+    title: '提示',
+    icon: createVNode(ExclamationCircleOutlined),
+    content: `是否跳转到新订单?`,
+    okText: '确认',
+    cancelText: '取消',
+    async onOk() {
+      router.replace({path:'/orderdetail',query:{id:res.data.sa_orderid}})
+    },
+    onCancel() {},
+  })
+  })
+}
+const failedData = ref(null)
+const importSuccess = async (res)=>{
+  const rs = await Api.requested({
+    id:20230227194803,
+    content:{
+      sa_orderid:orderData.value.sa_orderid,
+      attachmentid:res.data.attachmentids[0]
+    }
+  })
+  utils.message(rs,'导入成功',()=>{
+    prodlist.value.listData()
+    mianData()
+    if (rs.data !== '成功') {
+      failedData.value = rs.data
+    }
+  })
+}
+const canPrintBoolean = ref(false)
+const reportList = ref([])
+const canPrint = async ()=>{
+  const res = await Api.requested({
+    id:20221213094401,
+    content:{
+      systemappid:app.value.systemappid,
+    }
+  })
+  res.data.length > 0 ? canPrintBoolean.value = true : canPrintBoolean.value = false
+  reportList.value = res.data
+}
+const printUrl = async (data)=>{
+  const res = await Api.requested({
+      id:20221213094501,
+      content:{
+        sys_reportid:data.sys_reportid,
+        dataid: router.currentRoute.value.query.id
+      }
+    })
+    if (res.code == 1) {
+      window.open(process.env.BASE_API+res.data)
+    }
+}
+const record = ref({})
+const printRef = ref()
+const printData = ()=>{
+  if (reportList.value.length == 1) {
+    printUrl(reportList.value[0])
+  } else {
+    printRef.value.open = true
+  }
+  
+}
+
+const onModeClick = async (data)=>{
+  printUrl(data)
+}
+const open = ref(false)
+const prod = ref({})
+const openCustom = (data)=>{
+  open.value = true
+  prod.value = data
+}
+const handleOk = ()=>{
+  prodlist.value.data.some((item)=>{
+    if (item.itemid == prod.value.itemid) {
+      item = prod.value
+    }
+  })
+  open.value = false
+}
+onMounted (()=>{
+  mianData()
+  canPrint()
+})
+onBeforeUnmount (()=>{
+  prodlist.value.reloadSelect()
+})
+</script>
+<style scoped>
+.account-item-panel-content{
+  display: flex;
+  align-items: center;
+}
+.account-item-panel-content p{
+  margin: 0;
+}
+/deep/.ant-input {
+  color:#000000 !important;
+}
+input::placeholder {
+  color: #000000 !important;
+}
+.label{
+  display:inline-block;
+  margin-right:10px
+}
+.mt-10{
+  margin-bottom:20px
+}
+</style>

+ 32 - 18
src/DRP/HDrpManagement/orderManage/detail/index.vue

@@ -125,19 +125,19 @@
     <a-modal v-model:open="open" title="定制信息" @ok="handleOk" style="text-align:center">
       <div class="mt-10" v-if="prod.record.cheekschemeid > 0">
         <span class="label">工艺</span>
-        <a-select v-model:value="prod.record.cheek" style="width: 200px" placeholder="选择长度">
+        <a-select v-model:value="prod.record.customcheek" style="width: 200px" placeholder="选择长度">
           <a-select-option v-for="item in prod.record.cheekschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
         </a-select>
       </div>
       <div class="mt-10" v-if="prod.record.colorschemeid > 0">
         <span class="label">颜色</span>
-        <a-select v-model:value="prod.record.colors" style="width: 200px" placeholder="选择长度">
+        <a-select v-model:value="prod.record.customcolors" style="width: 200px" placeholder="选择长度">
           <a-select-option v-for="item in prod.record.colorsschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
         </a-select>
       </div>
       <div class="mt-10" v-if="prod.record.materialschemeid > 0">
         <span class="label">选项</span>
-        <a-select v-model:value="prod.record.material" style="width: 200px" placeholder="选择长度">
+        <a-select v-model:value="prod.record.custommaterial" style="width: 200px" placeholder="选择长度">
           <a-select-option v-for="item in prod.record.materialschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
         </a-select>
       </div>
@@ -321,7 +321,10 @@ const updateProd = async (data,msg,fn) =>{
           remarks:e.remarks,
           length:e.length ? e.length:0,
           width:e.width ? e.width:0,
-          sa_promotion_itemsid:e.sa_promotion_itemsid
+          sa_promotion_itemsid:e.sa_promotion_itemsid,
+          customcolors:e.customcolors ? e.customcolors:0,
+          customcheek:e.customcheek ? e.customcheek:0,
+          custommaterial:e.custommaterial ? e.custommaterial:0
         }
       })
     }
@@ -343,19 +346,29 @@ const validInput = async (record,min,max,type)=>{
   }
 }
 const addProductToBody = async (val) =>{
-  let data = val.map(e=>{
-    if (e.iscustomsize == 1 && e.length && e.width) {
-      return {
-        sa_orderitemsid:0,
-        itemid:e.itemid,
-        qty:e.qty,
-        length:e.length ? e.length:0,
-        width:e.width ? e.width:0,
-        colors:e.colors ? e.colors:0,
-        cheek:e.cheek ? e.cheek:0,
-        material:e.material ? e.material:0
+  const allowAdd = (e)=>{
+    if (e.iscustomsize == 1) {
+      if (!e.length || !e.width) {
+        message.error(e.itemname + '定制信息有误,请检查!')
+      } else if (e.cheekschemeid > 0 && !e.customcheek) {
+        message.error(e.itemname + '工艺定制信息有误,请检查!')
+      } else if (e.colorschemeid > 0 && !e.customcolors) {
+        message.error(e.itemname + '颜色定制信息有误,请检查!')
+      } else if (e.materialschemeid > 0 && !e.custommaterial) {
+        message.error(e.itemname + '选项定制信息有误,请检查!')
+      } else {
+        return {
+          sa_orderitemsid:0,
+          itemid:e.itemid,
+          qty:e.qty,
+          length:e.length ? e.length:0,
+          width:e.width ? e.width:0,
+          customcolors:e.customcolors ? e.customcolors:0,
+          customcheek:e.customcheek ? e.customcheek:0,
+          custommaterial:e.custommaterial ? e.custommaterial:0
+        }
       }
-    } else if (e.iscustomsize == 0) {
+    } else {
       return {
         sa_orderitemsid:0,
         itemid:e.itemid,
@@ -363,9 +376,10 @@ const addProductToBody = async (val) =>{
         length:0,
         width:0
       }
-    } else {
-      message.error(e.itemname + '定制信息有误,请检查!')
     }
+  }
+  let data = val.map(e=>{
+    return allowAdd(e)
   })
   data.filter(e=>e !== undefined).length > 0 ? updateProd(data.filter(e=>e !== undefined),'添加成功',()=>{
     prodlist.value.tableRecord = []

+ 68 - 17
src/DRP/SDrpManagement/order/detail/index.vue

@@ -33,7 +33,10 @@
                 <template v-if="data.column.dataIndex === 'qty'">
                   <a-input-number style="width:100%" id="inputNumber" :precision="2" v-model:value="data.record.qty" :min="data.record.orderminqty" :step="data.record.orderaddqty" @blur="onAddQtyChange(data.record)"/>
                 </template>
-                <template v-if="data.column.dataIndex === 'length' && data.record.iscustomsize == 1">
+                <template v-if="data.column.dataIndex === 'iscustom' && data.record.iscustomsize == 1">
+                  <a-button type="link" @click="openCustom(data)">定制信息</a-button>
+                </template>
+                <!-- <template v-if="data.column.dataIndex === 'length' && data.record.iscustomsize == 1">
                   <a-select v-if="data.record.lengthschemedetails.length > 0" v-model:value="data.record.length" style="width: 150px" placeholder="选择长度">
                     <a-select-option v-for="item in data.record.lengthschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
                   </a-select>
@@ -52,7 +55,7 @@
                       <span style="color:#999">{{data.record.widthmax}}</span>
                     </template>
                   </a-input>
-                </template>
+                </template> -->
               </template>
             </select-product>
             <a-button v-if="utils.hasPermission('orderMxedit')" :disabled="utils.isDisabled(orderData.status,['提交','审核','关闭'],(selectProductList.length == 0))" type="primary" @click="deleteProd">删除商品</a-button>
@@ -96,6 +99,42 @@
         <logistics-order></logistics-order>
       </template>
     </detail-template>
+    <a-modal v-model:open="open" title="定制信息" @ok="handleOk" style="text-align:center">
+      <div class="mt-10" v-if="prod.record.cheekschemeid > 0">
+        <span class="label">工艺</span>
+        <a-select v-model:value="prod.record.customcheek" style="width: 200px" placeholder="选择长度">
+          <a-select-option v-for="item in prod.record.cheekschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
+        </a-select>
+      </div>
+      <div class="mt-10" v-if="prod.record.colorschemeid > 0">
+        <span class="label">颜色</span>
+        <a-select v-model:value="prod.record.customcolors" style="width: 200px" placeholder="选择长度">
+          <a-select-option v-for="item in prod.record.colorsschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
+        </a-select>
+      </div>
+      <div class="mt-10" v-if="prod.record.materialschemeid > 0">
+        <span class="label">选项</span>
+        <a-select v-model:value="prod.record.custommaterial" style="width: 200px" placeholder="选择长度">
+          <a-select-option v-for="item in prod.record.materialschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
+        </a-select>
+      </div>
+      <div class="mt-10" v-if="prod.record.spec == '自定义' || prod.record.spec == 'custom'">
+        <span class="label">长度</span>
+        <a-select v-if="prod.record.lengthschemedetails.length > 0" v-model:value="prod.record.length" style="width: 200px" placeholder="选择长度">
+          <a-select-option v-for="item in prod.record.lengthschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
+        </a-select>
+        <a-input v-else style="width:200px;" v-model:value="prod.record.length" :placeholder="`输入${prod.record.lengthmin}到${prod.record.lengthmax}长度`" @blur="validInput(prod.record,prod.record.lengthmin,prod.record.lengthmax,'length')">
+        </a-input>
+      </div>
+      <div class="mt-10" v-if="prod.record.spec == '自定义' || prod.record.spec == 'custom'">
+        <span class="label">宽度</span>
+        <a-select v-if="prod.record.widthschemedetails.length > 0" v-model:value="prod.record.width" style="width: 200px" placeholder="选择宽度">
+          <a-select-option v-for="item in prod.record.widthschemedetails" :key="item.sa_sizeschemedetailid" :value="item.num">{{item.num}}</a-select-option>
+        </a-select>
+        <a-input v-else style="width:200px;" v-model:value="prod.record.width" :placeholder="`输入${prod.record.widthmin}到${prod.record.widthmax}宽度`" @blur="validInput(prod.record,prod.record.widthmin,prod.record.widthmax,'width')">
+        </a-input>
+      </div>
+    </a-modal>
   </div>
 </template>
 
@@ -259,31 +298,43 @@ const validInput = async (record,min,max,type)=>{
   }
 }
 const addProductToBody = async (val) =>{
-  let data = val.map(e=>{
-    if (e.iscustomsize == 1 && e.length && e.width) {
-      return {
-        sa_orderitemsid:0,
-        itemid:e.itemid,
-        qty:e.qty,
-        length:e.length ? e.length:0,
-        width:e.width ? e.width:0,
-        sa_promotion_itemsid:e.sa_promotion_itemsid
+  const allowAdd = (e)=>{
+    if (e.iscustomsize == 1) {
+      if (!e.length || !e.width) {
+        message.error(e.itemname + '定制信息有误,请检查!')
+      } else if (e.cheekschemeid > 0 && !e.customcheek) {
+        message.error(e.itemname + '工艺定制信息有误,请检查!')
+      } else if (e.colorschemeid > 0 && !e.customcolors) {
+        message.error(e.itemname + '颜色定制信息有误,请检查!')
+      } else if (e.materialschemeid > 0 && !e.custommaterial) {
+        message.error(e.itemname + '选项定制信息有误,请检查!')
+      } else {
+        return {
+          sa_orderitemsid:0,
+          itemid:e.itemid,
+          qty:e.qty,
+          length:e.length ? e.length:0,
+          width:e.width ? e.width:0,
+          customcolors:e.customcolors ? e.customcolors:0,
+          customcheek:e.customcheek ? e.customcheek:0,
+          custommaterial:e.custommaterial ? e.custommaterial:0
+        }
       }
-    } else if (e.iscustomsize == 0 || !e.iscustomsize) {
+    } else {
       return {
         sa_orderitemsid:0,
         itemid:e.itemid,
         qty:e.qty,
         length:0,
-        width:0,
-        sa_promotion_itemsid:e.sa_promotion_itemsid
+        width:0
       }
-    } else {
-      message.error(e.itemname + '定制信息有误,请检查!')
     }
+  }
+  let data = val.map(e=>{
+    return allowAdd(e)
   })
   data.filter(e=>e !== undefined).length > 0 ? updateProd(data.filter(e=>e !== undefined),'添加成功',()=>{
-    prodlist.value.reloadSelect()
+    prodlist.value.tableRecord = []
   }):''
 }