购物车历史订单增加,代码优化
This commit is contained in:
@@ -27,13 +27,12 @@
|
||||
<up-button type="primary" style="background-color: #318AFE;color: #fff;" @tap="sumbit" :plain="true"
|
||||
text="保存"></up-button>
|
||||
</view>
|
||||
<!-- 消息提示 -->
|
||||
<up-toast ref="uToastRef"></up-toast>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, getCurrentInstance } from 'vue';
|
||||
import { ref, reactive } from 'vue';
|
||||
import { addVendor } from '@/http/api/vendor.js';
|
||||
|
||||
|
||||
@@ -42,7 +41,6 @@
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
},
|
||||
})
|
||||
const currentInstance = getCurrentInstance()
|
||||
|
||||
function sumbit() {
|
||||
if (!datas.form.name || !datas.form.telephone || !datas.form.address) {
|
||||
@@ -53,10 +51,7 @@
|
||||
return
|
||||
}
|
||||
addVendor(datas.form).then(res => {
|
||||
currentInstance.ctx.$refs.uToastRef.show({
|
||||
message: "添加成功",
|
||||
type: 'default',
|
||||
})
|
||||
uni.$utils.showToast("添加成功")
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1000)
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted, reactive, getCurrentInstance } from 'vue';
|
||||
import { ref, computed, onMounted, reactive } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import go from '@/commons/utils/go.js';
|
||||
|
||||
|
||||
@@ -58,13 +58,11 @@
|
||||
<up-button type="primary" style="background-color: #318AFE;color: #fff;" @tap="sumbit" :plain="true"
|
||||
text="保存"></up-button>
|
||||
</view>
|
||||
<!-- 消息提示 -->
|
||||
<up-toast ref="uToastRef"></up-toast>
|
||||
</template>
|
||||
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, reactive, onMounted, getCurrentInstance } from 'vue';
|
||||
import { ref, computed, reactive, onMounted } from 'vue';
|
||||
import { onShow, onLoad } from '@dcloudio/uni-app';
|
||||
import go from '@/commons/utils/go.js';
|
||||
import dayjs from 'dayjs';
|
||||
@@ -73,7 +71,6 @@
|
||||
import { stockOut } from '@/http/api/cons.js';
|
||||
|
||||
let showStatus = ref(false)
|
||||
const refs = getCurrentInstance()
|
||||
let datas = reactive({
|
||||
show: false,
|
||||
// 供应商列表
|
||||
@@ -144,17 +141,11 @@
|
||||
let sumbit = uni.$utils.debounce(() => {
|
||||
|
||||
if (!datas.form.bodyList.inOutNumber) {
|
||||
refs.ctx.$refs.uToastRef.show({
|
||||
type: 'default',
|
||||
message: "请输入必填项",
|
||||
})
|
||||
uni.$utils.showToast("请输入必填项")
|
||||
return
|
||||
}
|
||||
if (!datas.form.bodyList.purchasePrice) {
|
||||
refs.ctx.$refs.uToastRef.show({
|
||||
type: 'default',
|
||||
message: "请输入必填项",
|
||||
})
|
||||
uni.$utils.showToast("请输入必填项")
|
||||
return
|
||||
}
|
||||
datas.form.bodyList.conId = datas.item.id
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, getCurrentInstance, ref, reactive } from 'vue';
|
||||
import { onMounted, ref, reactive } from 'vue';
|
||||
import dayjs from 'dayjs';
|
||||
import go from '@/commons/utils/go.js'
|
||||
import datePickerview from './components/my-date-pickerview.vue'
|
||||
@@ -139,7 +139,7 @@
|
||||
PopUp: false,
|
||||
form: {}
|
||||
})
|
||||
const currentInstance = getCurrentInstance()
|
||||
const datePicker = ref()
|
||||
const props = defineProps({
|
||||
id: {
|
||||
type: Number
|
||||
@@ -256,7 +256,7 @@
|
||||
function changeTime(e) {
|
||||
selected.value = e
|
||||
if (e == 'custom') {
|
||||
currentInstance.ctx.$refs.datePicker.toggle()
|
||||
datePicker.value.toggle()
|
||||
} else {
|
||||
getlist()
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, reactive, ref, computed, getCurrentInstance } from 'vue';
|
||||
import { onMounted, reactive, ref, computed } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { stockFlow,consStatistics } from '@/http/api/cons.js';
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, reactive, getCurrentInstance } from 'vue';
|
||||
import { ref, computed, reactive } from 'vue';
|
||||
import { onShow, onLoad } from '@dcloudio/uni-app';
|
||||
import go from '@/commons/utils/go.js';
|
||||
import dayjs from 'dayjs';
|
||||
@@ -94,7 +94,6 @@
|
||||
console.log(options)
|
||||
datas.item = JSON.parse(options.item)
|
||||
datas.form = Object.assign(datas.form, datas.item)
|
||||
console.log(datas.form)
|
||||
// 单位列表
|
||||
datas.unitList = [ datas.form.conUnit, datas.form.conUnitTwo]
|
||||
datas.form.bodyList.unit = datas.form.defaultUnit
|
||||
@@ -104,8 +103,6 @@
|
||||
onShow(() => {
|
||||
getList()
|
||||
})
|
||||
|
||||
const refs = getCurrentInstance()
|
||||
|
||||
function toggle() {
|
||||
go.to('PAGES_ADD_SUPPLIER')
|
||||
@@ -149,17 +146,11 @@
|
||||
|
||||
let sumbit = uni.$utils.debounce(() => {
|
||||
if (!datas.form.bodyList.inOutNumber) {
|
||||
refs.ctx.$refs.uToastRef.show({
|
||||
type: 'default',
|
||||
message: "请输入必填项",
|
||||
})
|
||||
uni.$utils.showToast("请输入必填项")
|
||||
return
|
||||
}
|
||||
if (!datas.form.bodyList.purchasePrice) {
|
||||
refs.ctx.$refs.uToastRef.show({
|
||||
type: 'default',
|
||||
message: "请输入必填项",
|
||||
})
|
||||
uni.$utils.showToast("请输入必填项")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -172,10 +163,7 @@
|
||||
vendorId: datas.list[nowStatusIndex.value].id,
|
||||
amountPayable: datas.form.bodyList[0].inOutNumber * datas.form.bodyList[0].purchasePrice,
|
||||
}).then(res => {
|
||||
refs.ctx.$refs.uToastRef.show({
|
||||
type: 'default',
|
||||
message: "保存成功",
|
||||
})
|
||||
uni.$utils.showToast("保存成功")
|
||||
setTimeout(() => {
|
||||
go.back()
|
||||
}, 1000)
|
||||
|
||||
Reference in New Issue
Block a user