123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317 |
- <template>
- <view class="orderScanCode-digitalShel flex flex_column">
- <view class="info-body">
- <view class="flex align-center orderTj" v-if="info">
- <view>
- <view class="redText">{{ info.totalQty }}</view>
- <view>总数量</view>
- </view>
- <view>
- <view>{{ info.confirmQty }}</view>
- <view>已扫码</view>
- </view>
- </view>
- <view class="info partList" v-if="partList.length">
- <view class="infoList">
- <view class="title">配件列表</view>
- <view>
- {{ partList.length }}款,共
- <text class="redText">{{ totalNums }}</text>
- 件
- </view>
- </view>
- <view v-for="item in partList" :key="item.productSn" class="flex align-center item-list">
- <view><u-image :src="item.images" border-radius="16" width="130" height="130" bg-color="#EBEBEB"></u-image></view>
- <view>
- <view class="item-name">
- <text>{{ item.productName }}</text>
- </view>
- <view class="item-nums">
- <text>{{ item.productCode }}</text>
- </view>
- <view class="item-head">
- <view>
- 数量:
- <text class="redText">{{ item.totalQty }}</text>
- 已扫:
- <text>{{ item.confirmQty }}</text>
- </view>
- <text class="item-no">{{ item.shelfPlaceCode }}</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="footer flex align_center justify_center" v-if="info">
- <u-button v-if="!hasScanFinish" :throttle-time="100" @click="scanCode" :custom-style="{ background: '#066cff', color: '#fff',width:'400rpx' }" shape="circle" type="info">
- <u-icon name="scan" color="#fff" size="32"></u-icon>
- 点击扫码
- </u-button>
- <u-button v-else :throttle-time="100" @click="outShelfOrder" :custom-style="{ background: '#066cff', color: '#fff',width:'400rpx' }" shape="circle" type="info">
- 确认取货
- </u-button>
- </view>
- </view>
- </template>
- <script>
- import { findBySnShelfOrder, outShelfOrder, scanConfirmShelfOrder } from '@/api/shelf.js'
- export default {
- data() {
- return {
- barcode:null,
- shelfOrderSn: null,
- info: null,
- partList: [],
- mpaasScanModule: null
- }
- },
- computed: {
- totalNums(){
- let ret = 0
- this.partList.map(item => {
- ret += item.totalQty
- })
- return ret
- },
- hasScanFinish(){
- return this.info&&this.info.totalQty == this.info.confirmQty
- }
- },
- onReady() {
- },
- onLoad(options) {
- this.shelfOrderSn = options.shelfOrderSn
- this.getDetail(0)
- },
- methods: {
- // 扫码
- scanCode(){
- const _this = this
- // 允许从相机和相册扫码
- uni.scanCode({
- success: function (res) {
- _this.scanResult(res.result)
- }
- });
- },
- // 获取详情
- getDetail(type){
- findBySnShelfOrder({sn: this.shelfOrderSn}).then(res => {
- if(res.status == 200){
- this.info = res.data
- this.partList = res.data.shelfOrderDetailList
- // 此单已全部扫码,是否确认取货
- if(this.hasScanFinish){
- uni.showModal({
- title: '扫码成功',
- content: '此单已全部扫码,是否确认取货?',
- success: (ret) => {
- if(ret.confirm){
- this.outShelfOrder()
- }
- }
- })
- }else{
- if(type){
- this.confimInfo('是否继续扫码',1)
- }
- }
- }
- })
- },
- // 确认取货
- outShelfOrder(){
- if(this.hasScanFinish){
- outShelfOrder({sn:this.shelfOrderSn}).then(res => {
- console.log(res,'确认取货')
- if(res.status == 200){
- uni.$emit("refreshOrder")
- uni.navigateBack()
- }
- })
- }else{
- this.message("请先扫码取货")
- }
- },
- confimInfo(msg,type){
- const _this = this
- uni.showModal({
- title: type?'扫码成功':'扫码失败',
- content: msg,
- confirmText:'继续扫码',
- success: (ret) => {
- if(ret.confirm){
- _this.scanCode()
- }
- }
- })
- },
- // 扫码结果
- scanResult(qrCode){
- const _this = this
- console.log(qrCode)
- const params = {
- shelfSn: qrCode.split("&")[0],
- productCode: qrCode.split("&")[1]
- }
- console.log(params)
- if(params.shelfSn != this.info.shelfSn){
- _this.confimInfo('该配件不属于此数字货架',0)
- return
- }
- scanConfirmShelfOrder({
- shelfOrderSn: _this.shelfOrderSn,
- shelfOrderDetailList:[
- {
- "productCode": params.productCode,
- "confirmQty": 1
- }
- ]
- }).then(res => {
- if(res.status == 200){
- // 刷新列表
- _this.getDetail(1)
- }else{
- _this.confimInfo(res.message,0)
- }
- })
- },
- message(title){
- uni.showToast({
- icon:'none',
- title: title
- })
- },
- }
- }
- </script>
- <style lang="less">
- page {
- height: 100vh;
- }
- .orderScanCode-digitalShel {
- height: 100%;
- .barCode {
- background-color: #333;
- height: 20%;
- display: flex;
- align-items: center;
- justify-content: center;
- color: #fff;
- }
- > view {
- padding: 20rpx;
- }
- .info-body {
- flex-flow: 1;
- overflow: auto;
- height: 100%;
- }
- .redText {
- color: #fb1e1e;
- }
- .orderTj {
- padding: 20rpx;
- background-color: #fff;
- > view {
- text-align: center;
- border-right: 2rpx solid #eee;
- width: 50%;
- color: #666e75;
- .redText {
- color: #fb1e1e;
- }
- &:last-child {
- border: 0;
- }
- > view {
- color: #666e75;
- &:first-child {
- font-size: 56rpx;
- }
- }
- }
- border-radius: 20rpx;
- }
- .info {
- background-color: #ffffff;
- padding: 10rpx 30upx;
- font-size: 32rpx;
- margin-top: 20rpx;
- .infoList {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 20rpx 0;
- border-bottom: 2rpx solid #f2f2f2;
- .title {
- font-weight: bold;
- }
- > text {
- &:first-child {
- color: #666e75;
- }
- }
- }
- .item-list {
- border-bottom: 2rpx solid #f2f2f2;
- &:last-child {
- border: none;
- }
- > view {
- padding: 20rpx 0;
- &:first-child {
- margin-right: 20rpx;
- margin-top: 18rpx;
- }
- &:last-child {
- flex-grow: 1;
- }
- }
- .item-name {
- word-wrap: break-word;
- font-size: 32rpx;
- color: #333;
- font-weight: bold;
- margin-top: 10rpx;
- }
- .item-nums {
- padding: 10rpx 0;
- text {
- font-size: 32rpx;
- color: #222222;
- }
- }
- .item-head {
- display: flex;
- align-items: center;
- justify-content: space-between;
- color: #666;
- > view {
- &:first-child {
- font-size: 28rpx;
- text {
- margin-right: 30rpx;
- }
- }
- }
- .item-no {
- font-size: 28rpx;
- background: rgba(3, 54, 146, 0.15);
- color: #033692;
- border-radius: 100rpx;
- padding: 2rpx 30rpx;
- margin-right: 20rpx;
- display: block;
- }
- }
- }
- }
- .footer {
- padding: 20upx 40upx;
- background: #ffffff;
- }
- }
- </style>
|