| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- <template>
- <view>
- <my-add-button @handleClick="handleClick" />
- <!-- <view class="border-bottom">
- <u-tabs
- class="p-fixed left0 right0 zIndex"
- :list="list"
- :name="'label'"
- :is-scroll="false"
- :current="current"
- @change="change"
- ></u-tabs>
- </view> -->
- <common-tabs :list='list' :current="current" @change='change' />
- <view>
- <my-page
- :loadData="loadData"
- :swipe-action="true"
- :row-show-params="{statusMap: statusMap,statusValue: $DictCache.VALUE.IN_STORE_FORM_STATUS,
- statusColor: $DictCache.COLOR.IN_STORE_FORM_STATUS}"
- @rowClick="handleDetail"
- :page-size="10"
- ref="myPage"
- >
- <template #pageRow="{ recordModel,rowShowParams }">
- <view class="mx3 my2 p3 bg-color-white box p-relative"
- @longpress="showMask(recordModel.id,$event)">
- <common-mask :item="recordModel" :maskId="maskId" @hide='maskId = 0' @del='handleDel(recordModel)' />
- <view class="d-flex j-between border-bottom pb-2 a-center">
- <view class="text-color-b f-size-26">{{ recordModel.updateTime }}</view>
- <my-badge
- :text="rowShowParams.statusMap[recordModel.status]"
- :status="rowShowParams.statusColor[recordModel.status]"
- />
- </view>
- <view class="mt-2 d-flex j-between pr-3">
- <view class="text-color-3 f-size-32 f-weight-bold">{{
- recordModel.storeName
- }}</view>
- <view class="text-color-y f-size-32 f-weight-bold">{{
- recordModel.totalPrice
- }}</view>
- </view>
- <view class="d-flex j-end edit-box">
- <view
- class="text-color-3 f-size-32 edit"
- v-if="recordModel.status === rowShowParams.statusValue.NOT_EXECUTE">
- <view @click.stop="confirmHandle(recordModel)">提交</view>
- </view>
- </view>
- <view class="d-flex j-end edit-box">
- <view
- class="text-color-3 f-size-32 edit"
- v-if="recordModel.status === rowShowParams.statusValue.EXECUTING">
- <view @click.stop="updateStoreBack(recordModel)">撤销</view>
- </view>
- </view>
- </view>
- </template>
- </my-page>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- list: [],
- current: 0,
- statusMap: {},
- maskId: 0
- };
- },
- onPullDownRefresh() {
- this.$refs.myPage.pagePullDownRefresh();
- },
- onReachBottom() {
- this.$refs.myPage.pageReachBottom();
- },
- created() {
- const formStatusList = this.$DictCache.getChildrenList(this.$DictCache.TYPE.IN_STORE_FORM_STATUS);
- const statusList = [{ label: '全部', value: '' }]
- this.list = statusList.concat(formStatusList);
- this.statusMap = this.$DictCache.getLabelByValueMapByType(
- this.$DictCache.TYPE.IN_STORE_FORM_STATUS
- );
- },
- onShow() {
- this.$nextTick(() => {
- this.$refs.myPage.initPage();
- })
- },
- onLoad() {},
- onHide() {
- this.maskId = 0
- },
- methods: {
- showMask(id, e) {
- this.maskId = id
- // #ifdef H5
- e.preventDefault()
- // #endif
- },
- // tab
- change(index, e) {
- this.current = index;
- this.$refs.myPage.initPage();
- },
- // 删除
- handleDel(recordModel) {
- let that = this
- let params = []
- params.push(recordModel.id)
- uni.showModal({
- title: '提示',
- content: '您确认删除吗?',
- success: (res)=> {
- if (res.confirm) {
- this.$Http.deleteOutStoreForms(params).then(res=>{
- uni.showToast({ title:'删除成功' })
- that.$refs.myPage.listData = []
- that.$refs.myPage.loadMore = true
- that.$refs.myPage.pageNum = 1
- that.$refs.myPage.initPage();
- })
- } else if (res.cancel) { }
- }
- });
- },
- loadData(parameter) {
- // filter: 1,
- // status: this.list[this.current].value
- return this.$Http
- .getInStoreFormPage({
- ...parameter,
- status: this.list[this.current].value,
- dataScope:{
- sortBy:'desc',
- sortName:'update_time'
- }
- })
- .then(res => {
- const data = res.data;
- if (this.$BaseTool.Object.isNotBlank(data)) {
- const rows = data.rows;
- if (this.$BaseTool.Object.isNotBlank(rows) && rows.length > 0) {
- rows.forEach(item => {
- item.totalPrice = this.$BaseTool.Amount.formatter(item.totalPrice);
- })
- }
- }
- return res.data;
- })
- },
- confirmHandle(item) {
- const that = this;
- uni.showModal({
- title: "提示",
- content: "确认提交入库?",
- success: function (res) {
- if (res.confirm) {
- that.$Http.updateInStore(item).then((res) => {
- that.page = 1;
- that.loadMore = true;
- that.listData = [];
- that.$refs.myPage.initPage();
- });
- }
- },
- });
- },
- updateStoreBack(item) {
- const that = this;
- uni.showModal({
- title: "提示",
- content: "确认撤销该入库单?",
- success: function (res) {
- if (res.confirm) {
- that.$Http.updateInStoreBack(item).then((res) => {
- that.page = 1;
- that.loadMore = true;
- that.listData = [];
- that.$refs.myPage.initPage();
- });
- }
- },
- });
- },
- handleClick() {
- uni.navigateTo({
- url: '/pages/in-store/in-store-add-new'
- });
- },
- // 跳转详情
- handleDetail(recordModel) {
- if (this.maskId != 0) return this.maskId = 0
- uni.navigateTo({
- url: '/pages/in-store/in-store-detail?id=' + recordModel.id
- });
- }
- }
- };
- </script>
- <style lang="less">
- page {
- background-color: #f4f4f4;
- }
- .box {
- border-radius: 20rpx;
- padding-right: 0;
- }
- .edit-box {
- padding: 0 30rpx;
- margin-top: 40rpx;
- .edit {
- padding: 8rpx 40rpx;
- border: 1px solid #ddd;
- border-radius: 20rpx;
- font-size: 26rpx;
- color: #666;
- margin-left: 30rpx;
- }
- }
- </style>
|