|
|
@@ -3,115 +3,119 @@
|
|
|
<el-dialog
|
|
|
v-model="dialogVisible"
|
|
|
:title="dialogTitle"
|
|
|
- width="480"
|
|
|
+ width="500px"
|
|
|
@close="closeDialog()"
|
|
|
>
|
|
|
- <el-form
|
|
|
- ref="formRef"
|
|
|
- :model="formData"
|
|
|
- :rules="rules"
|
|
|
- label-width="120px"
|
|
|
- >
|
|
|
- <el-row>
|
|
|
- <el-col :span="24">
|
|
|
- <el-form-item prop="clientName" label="客户名称">
|
|
|
- <el-input v-model="formData.clientName"/>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
-
|
|
|
- </el-form>
|
|
|
-
|
|
|
- <template #footer>
|
|
|
- <div class="dialog-footer">
|
|
|
- <el-button v-throttle type="primary" @click="handleSubmit">确 定</el-button>
|
|
|
- <el-button @click="closeDialog()">取 消</el-button>
|
|
|
+ <div>
|
|
|
+ <div
|
|
|
+ v-for="(order, index) in offerList"
|
|
|
+ :key="index"
|
|
|
+ class="order-item flex items-center justify-between"
|
|
|
+ >
|
|
|
+ <div>
|
|
|
+ {{order.platformName}}
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <div style="color: #E6A23C" v-if="order.errCode!=0">
|
|
|
+ {{order.errMsg}}
|
|
|
+ </div>
|
|
|
+ <div v-else>
|
|
|
+ <div>
|
|
|
+ <span style="font-weight: bold;margin: 5px;color: #F56C6C">{{order.totalPrice*0.001}}</span>元
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <span style="font-weight: bold;margin: 5px;color: #409EFF">{{(order.distanceMeter*0.001).toFixed(2)}}</span>公里
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <el-button @click="handleSubmit(order)" v-throttle type="primary">
|
|
|
+ 确定发单
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </template>
|
|
|
+ </div>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script setup lang="ts">
|
|
|
-import {getRoleInfo, getRoleMenuTreeData,updateRole} from "@/api/system";
|
|
|
-import type {FormInstance} from 'element-plus'
|
|
|
-
|
|
|
+import {callExpress,expressFormToken} from "@/api/order";
|
|
|
let dialogVisible = ref(false)
|
|
|
let dialogTitle = ref("")
|
|
|
-const formRef = ref<FormInstance>()
|
|
|
+let offerList = ref(new Array<any>())
|
|
|
+let formToken = ref('')
|
|
|
const emit = defineEmits(['dialogChange'])
|
|
|
-const formData = reactive({
|
|
|
- clientName:'',
|
|
|
- id: ""
|
|
|
-})
|
|
|
-const rules = reactive({
|
|
|
- clientName: [{required: true, message: "请输入客户名称", trigger: "blur"}],
|
|
|
-});
|
|
|
-function handleSubmit() {
|
|
|
- formRef.value.validate((valid: any) => {
|
|
|
- if (valid) {
|
|
|
- const itemId = formData.id;
|
|
|
- if (itemId) {
|
|
|
- //修改
|
|
|
- const postData = JSON.stringify(formData)
|
|
|
- const params = {
|
|
|
- "clientInfo": postData
|
|
|
- }
|
|
|
- updateClientInfo(params).then((response) => {
|
|
|
- dialogVisible.value = false
|
|
|
- if (response.httpCode == 200) {
|
|
|
- emit('dialogChange');
|
|
|
- ElMessage.success("操作成功");
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- //增加
|
|
|
- const postData = JSON.stringify(formData)
|
|
|
- const params = {
|
|
|
- "clientInfo": postData
|
|
|
- }
|
|
|
- addClientInfo(params).then((response) => {
|
|
|
- dialogVisible.value = false
|
|
|
- if (response.httpCode == 200) {
|
|
|
- emit('dialogChange');
|
|
|
- ElMessage.success("操作成功");
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+//确定发单
|
|
|
+function handleSubmit(order) {
|
|
|
+ const params = {
|
|
|
+ "businessMethod": "Express_CreateOrder_" + order.platformCode,
|
|
|
+ "token": formToken.value,
|
|
|
+ "params": JSON.stringify({
|
|
|
+ idOrder: order.id
|
|
|
+ })
|
|
|
+ }
|
|
|
+ callExpress(params).then((response) => {
|
|
|
+ dialogVisible.value = false
|
|
|
+ if (response.httpCode == 200) {
|
|
|
+ ElMessage.success("发单成功");
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
}
|
|
|
-
|
|
|
-function getItemData(item) {
|
|
|
- const data = {
|
|
|
- id: item
|
|
|
+async function getPreOrder(item,optionsList) {
|
|
|
+ var offerArray = []
|
|
|
+ for (let i = 0; i < optionsList.length; i++) {
|
|
|
+ const datas = optionsList[i]
|
|
|
+ const params = {
|
|
|
+ "businessMethod": "Express_PreCreateOrder_" + datas.platformCode,
|
|
|
+ "params": JSON.stringify({
|
|
|
+ idOrder: item.id
|
|
|
+ })
|
|
|
+ }
|
|
|
+ await callExpress(params).then((response) => {
|
|
|
+ if (response.httpCode == 200) {
|
|
|
+ var offerParams = {
|
|
|
+ platformName:"",
|
|
|
+ id:item.id,
|
|
|
+ platformCode:"",
|
|
|
+ errCode:"",
|
|
|
+ errMsg:"",
|
|
|
+ totalPrice:"",
|
|
|
+ distanceMeter:"",
|
|
|
+ }
|
|
|
+ const data =JSON.parse(response.data)
|
|
|
+ offerParams.platformName = datas.platformName
|
|
|
+ offerParams.platformCode = datas.platformCode
|
|
|
+ offerParams.errCode = data.errCode
|
|
|
+ offerParams.errMsg = data.errMsg
|
|
|
+ offerParams.totalPrice = data.totalPrice
|
|
|
+ offerParams.distanceMeter = data.distanceMeter
|
|
|
+ offerArray.push(offerParams)
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
- getClientInfo(data).then(response => {
|
|
|
+ console.log(offerArray);
|
|
|
+ offerList.value = offerArray
|
|
|
+ const tokenParams = {}
|
|
|
+ expressFormToken(tokenParams).then((response) => {
|
|
|
if (response.httpCode == 200) {
|
|
|
- const data = response.data
|
|
|
- Object.assign(formData, {...data});
|
|
|
+ formToken.value = response.data
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
-/** 重置表单 */
|
|
|
-function resetForm() {
|
|
|
- formRef.value.resetFields();
|
|
|
- formData.id = ''
|
|
|
-}
|
|
|
-
|
|
|
/**关闭弹窗 */
|
|
|
function closeDialog() {
|
|
|
dialogVisible.value = false
|
|
|
- formRef.value.resetFields();
|
|
|
- formData.id = undefined;
|
|
|
+ emit('dialogChange');
|
|
|
}
|
|
|
defineExpose({
|
|
|
dialogVisible,
|
|
|
dialogTitle,
|
|
|
- getItemData,
|
|
|
- resetForm
|
|
|
+ getPreOrder
|
|
|
})
|
|
|
</script>
|
|
|
<style scoped lang="scss">
|
|
|
-
|
|
|
+.order-item{
|
|
|
+ padding: 10px 0;
|
|
|
+ border-bottom: 1px solid #ddd;
|
|
|
+}
|
|
|
</style>
|