123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
- <link rel="stylesheet" href="../css/index.css">
- <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
- <script src="../js/babel.min.js"></script>
- <script src="../js/vue.js"></script>
- <script src="../js/axios.min.js"></script>
- <script src="../js/index.js"></script>
- <title>大卫博士-退货信息登记</title>
- <script type="text/javascript">
- document.addEventListener('plusready', function() {
- //console.log("所有plus api都应该在此事件发生后调用,否则会出现plus is undefined。")
- });
- </script>
- <style>
- * {
- margin: 0;
- padding: 0;
- }
- #app {
- /* width: 100%; */
- /* padding-top: 36px ; */
- height: 100%;
- color: #333;
- }
- .flex {
- display: flex;
- align-items: center;
- }
- .flexS {
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
- .flexC {
- display: flex;
- justify-content: space-between;
- flex-direction: column;
- }
- .sanzhuang {
- font-size: 18px;
- font-weight: bold;
- padding: 0 15px;
- margin-top: 12px;
- }
- .sanzhuang-item {
- font-size: 15px;
- font-weight: 400;
- }
- .sanzhuang-bg {
- margin: 9px 15px 12px 15px;
- padding: 9px 15px 12px 15px;
- background: #F9F9FB;
- border-radius: 6px 6px 6px 6px;
- height: 168px;
- font-size: 15px;
- font-weight: bold;
- }
- .step {
- width: 90px;
- height: 27px;
- background: #F9F9FB;
- border-radius: 3px 3px 3px 3px;
- border: 1px solid #999999;
- }
- .countNum {
- flex: 1;
- overflow: hidden;
- border: none;
- text-align: center;
- line-height: 72rpx;
- height: 100%;
- }
- .step-one {
- width: 30%;
- line-height: 27px;
- text-align: center;
- border-right: 1px solid #999999;;
- }
- .step-two {
- width: 40%;
- line-height: 27px;
- text-align: center;
- }
- .step-three {
- width: 30%;
- line-height: 27px;
- border-left: 1px solid #999999;;
- text-align: center;
- }
- .bottom {
- padding: 12px 30px 72px 15px;
- }
- .bottom-item {
- margin-bottom: 12px;
- font-size: 15px;
- font-weight: bold;
- }
- .title {
- height: 42px;
- padding: 0 15px;
- display: flex;
- align-items: flex-end;
- }
- .title-span {
- font-size: 21px;
- font-weight: bold;
- margin-left: 5px;
- }
- .el-message-box {
- width: 350px
- }
- .el-message {
- width: 350px
- }
- .fixed {
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- background-color: #fff;
- }
- .tabBar {
- height: 40px;
- display: flex;
- align-items: center;
- padding: 0 15px;
- }
- .tabBar-span {
- font-size: 15px;
- margin-left: 5px;
- }
- .topFlex {
- display: flex;
- align-items: center;
- }
- .bg {
- background: #FFF4F3;
- }
- .topFlex-item {
- width: 20%;
- line-height: 42px;
- font-size: 18px;
- font-weight: bold;
- text-align: center;
- }
- .height {
- line-height: 50px !important;
- }
- .scollH {
- height: 210px;
- overflow: scroll;
- }
- .list {
- padding: 175px 0 0px 0;
- border-bottom: 9px solid #F2F2F2;
- }
- .list-item {
- display: flex;
- justify-content: space-between;
- align-items: center;
- line-height: 42px;
- padding: 0 15px 0 0;
- }
- .list-span {
- font-size: 15px;
- font-weight: bold;
- width: 20%;
- text-align: center;
- }
- .list-del {
- width: 57px;
- line-height: 28px;
- background: linear-gradient(93deg, #FF5824 0%, #FF4444 100%);
- border-radius: 15px;
- text-align: center;
- color: #fff;
- font-size: 15px;
- }
- .back {
- background-color: #F8F8F8;
- }
- .flexBotom {
- position: fixed;
- bottom: 0;
- left: 0;
- width: 100%;
- height: 61px;
- background: #FFFFFF;
- box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.16);
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .flexBotom-btn {
- width: 327px;
- line-height: 47px;
- background: linear-gradient(93deg, #A080FF 0%, #5D6BFF 100%);
- border-radius: 33px;
- text-align: center;
- color: #fff;
- font-size: 18px;
- }
- </style>
- </head>
- <body>
- <div id="app">
- <div v-loading.fullscreen.lock="loadingFull" />
- <div class="fixed">
- <div class="tabBar">
- <img src="../img/back.png" style="width: 17px;height: 12px;">
- <span class="tabBar-span" @click="goBack">返回</span>
- </div>
- <div class="title">
- <div style="display: flex;align-items: center;">
- <img src="../img/bao.png" style="width: 20px;height: 17px;">
- <span class="title-span" @click="goBack">整套</span>
- </div>
- </div>
- <div class="topFlex">
- <div class="topFlex-item height" v-for="(item, index) in list" :key="index">
- {{item}}
- </div>
- </div>
- <div class="topFlex bg">
- <div class="topFlex-item" v-for="(item, index) in numList" :key="index">
- {{ item }}
- </div>
- </div>
- </div>
- <div class="list" :class="productList.length>4 ? 'scollH' : ''">
- <div class="list-item" :class="(index + 1)%2 == 0 ? 'back' : ''" v-for="(item, index) in productList" :key="index">
- <div class="list-span">{{ item.name }}</div>
- <div class="list-span">{{ item.type }}</div>
- <div class="list-span">{{ item.size }}</div>
- <div class="list-span">{{ item.num }}</div>
- <div class="list-del" @click="del(index)">
- 删除
- </div>
- </div>
- </div>
- <div class="title">
- <div style="display: flex;align-items: center;">
- <img src="../img/neiku.png" style="width: 21px;height: 21px;">
- <span class="title-span" @click="goBack">散装</span>
- </div>
- </div>
- <div class="sanzhuang flexS" @click="showChuan=!showChuan">
- <span>已穿</span>
- <div class="sanzhuang-item flex">
- <span>{{ allchuanNum }}条</span>
- <img :src="showChuan?image[0]:image[1]" style="width: 20px;height: 17px;margin-left: 12px;" >
- </div>
- </div>
- <div v-show="showChuan" class="sanzhuang-bg flexC">
- <div v-for="(item,i) in list" :key="i" class="flexS">
- <div class="sanzhuang-name">{{ item }}版(条)</div>
- <div class="step flexS">
- <div class="step-one" @click="minus(1, i)">-</div>
- <input
- v-model="chuanNum[i]"
- class="countNum"
- @focus="inputClear(0, i)"
- @blur="inputCountNum(0, i)"
- type="number"
- onkeyup="this.value=this.value.replace(/\D/g,'')" onpaste="this.value=this.value.replace(/\D/g,'')"
- />
- <div class="step-three" @click="add(1, i)">+</div>
- </div>
- </div>
- </div>
- <div class="sanzhuang flexS" @click="showWei=!showWei">
- <span>未穿</span>
- <div class="sanzhuang-item flex">
- <span>{{ allWeiNum }}条</span>
- <img :src="showWei?image[0]:image[1]" style="width: 20px;height: 17px;margin-left: 12px;" >
- </div>
- </div>
- <div v-show="showWei" class="sanzhuang-bg flexC">
- <div v-for="(item,i) in list" :key="i" class="flexS">
- <div class="sanzhuang-name">{{ item }}版(条)</div>
- <div class="step flexS">
- <div class="step-one" @click="minus(0, i)">-</div>
- <input
- v-model="weiNum[i]"
- class="countNum"
- @focus="inputClear(1, i)"
- @blur="inputCountNum(1, i)"
- type="number"
- onkeyup="this.value=this.value.replace(/\D/g,'')" onpaste="this.value=this.value.replace(/\D/g,'')"
- />
- <div class="step-three" @click="add(0, i)">+</div>
- </div>
- </div>
- </div>
- <div class="title">
- <div style="display: flex;align-items: center;">
- <img src="../img/peijian.png" style="width: 22px;height: 22px;">
- <span class="title-span" @click="goBack">配件</span>
- </div>
- </div>
- <div class="bottom">
- <div class="bottom-item flexS">
- <div>缺少肥皂(块)</div>
- <div class="step flexS">
- <div class="step-one" @click="minus(2, 0)">-</div>
- <input
- v-model="zaoNum"
- class="countNum"
- @focus="inputClear(2)"
- @blur="inputCountNum(2)"
- type="number"
- onkeyup="this.value=this.value.replace(/\D/g,'')" onpaste="this.value=this.value.replace(/\D/g,'')"
- />
- <div class="step-three" @click="add(2, 0)">+</div>
- </div>
- </div>
- <div class="bottom-item flexS">
- <div>缺少手提袋(个)</div>
- <div class="step flexS">
- <div class="step-one" @click="minus(3, 0)">-</div>
- <input
- v-model="daiNum"
- class="countNum"
- @focus="inputClear(3)"
- @blur="inputCountNum(3)"
- type="number"
- onkeyup="this.value=this.value.replace(/\D/g,'')" onpaste="this.value=this.value.replace(/\D/g,'')"
- />
- <div class="step-three" @click="add(3, 0)">+</div>
- </div>
- </div>
- </div>
- <div class="flexBotom">
- <div class="flexBotom-btn" @click="noMultipleClicks(submit)">
- 提交
- </div>
- </div>
- </div>
- <script type="text/babel">
- var app = new Vue({
- el: '#app',
- data() {
- return {
- loadingFull: false,
- type: 0,
- num: '',
- mask: true,
- noClick: true,
- list: ['精装', '简约', '纯棉', '高腰', '青春'],
- productList: [],
- numList: [0, 0, 0, 0, 0],
- image: [
- '../img/xia.png',
- '../img/right.png'
- ],
- num: 4,
- showWei: false,
- showChuan: false,
- allWeiNum: 0,
- allchuanNum: 0,
- weiNum: [0, 0, 0, 0, 0],
- chuanNum: [0, 0, 0, 0, 0],
- zaoNum: 0,
- daiNum: 0
- }
- },
- mounted() {
- var url = location.search //获取url中"?"符后的字串
- if (url.indexOf("?") != -1) {
- var str = url.substr(1)
- var strs = str.split("=")
- this.id = strs[1]
- }
- this.productList = JSON.parse(window.localStorage.getItem("productList"))
- if(this.productList) {
- this.countNum(this.productList)
- }
- },
- methods: {
- inputCountNum(type, i) {
- if (type == 0) {
- this.chuanNum[i] = this.chuanNum[i] == ''?0:this.chuanNum[i]
- this.chuanNum = JSON.parse(JSON.stringify(this.chuanNum))
- this.allchuanNum = eval(this.chuanNum.join("+"))
- } else if (type == 1) {
- this.weiNum[i] = this.weiNum[i] == ''?0:this.weiNum[i]
- this.weiNum = JSON.parse(JSON.stringify(this.weiNum))
- this.allWeiNum = eval(this.weiNum.join("+"))
- } else if (type == 2) {
- this.zaoNum = this.zaoNum == ''?0:this.zaoNum
- this.zaoNum = JSON.parse(JSON.stringify(this.zaoNum))
- } else if (type == 3) {
- this.daiNum = this.daiNum == ''?0:this.daiNum
- this.daiNum = JSON.parse(JSON.stringify(this.daiNum))
- }
- },
- inputClear(type, i) {
- if (type == 0) {
- this.chuanNum[i] = ''
- this.chuanNum = JSON.parse(JSON.stringify(this.chuanNum))
- } else if (type == 1) {
- this.weiNum[i] = ''
- this.weiNum = JSON.parse(JSON.stringify(this.weiNum))
- } else if (type == 2) {
- this.zaoNum= ''
- } else if (type == 3) {
- this.daiNum= ''
- }
- },
- minus(type, i) {
- if (type == 0) {
- if (this.weiNum[i] == 0) {
- return
- }
- this.weiNum[i] --
- this.allWeiNum --
- this.weiNum = JSON.parse(JSON.stringify(this.weiNum))
- } else if (type == 1) {
- if (this.chuanNum[i] == 0) {
- return
- }
- this.chuanNum[i] --
- this.allchuanNum --
- this.chuanNum = JSON.parse(JSON.stringify(this.chuanNum))
- } else if (type == 2) {
- if (this.zaoNum == 0) {
- return
- }
- this.zaoNum --
- } else {
- if (this.daiNum == 0) {
- return
- }
- this.daiNum --
- }
- },
- add(type, i) {
- if (type == 0) {
- this.weiNum[i] ++
- this.allWeiNum ++
- this.weiNum = JSON.parse(JSON.stringify(this.weiNum))
- } else if (type == 1) {
- this.chuanNum[i] ++
- this.allchuanNum ++
- this.chuanNum = JSON.parse(JSON.stringify(this.chuanNum))
- } else if (type == 2) {
- this.zaoNum ++
- } else {
- this.daiNum ++
- }
- },
- preventKeyBord(e) {
- e.target.setAttribute("readonly", true);
- setTimeout(() => {
- e.target.removeAttribute("readonly")
- }, 100)
- },
- goBack() {
- window.history.back()
- },
- countNum(list) {
- let numList = [0, 0, 0, 0, 0]
- list.forEach(v => {
- if (v.name === '精装版') {
- numList[0] += v.num
- } else if (v.name === '简约版') {
- numList[1] += v.num
- } else if (v.name === '纯棉版') {
- numList[2] += v.num
- } else if (v.name === '高腰版') {
- numList[3] += v.num
- } else if (v.name === '青春版') {
- numList[4] += v.num
- }
- })
- this.numList = numList
- },
- del(i) {
- this.productList.splice(i, 1)
- this.countNum(this.productList)
- if (this.productList.length === 0) {
- window.localStorage.removeItem('productList')
- } else {
- window.localStorage.setItem('productList', JSON.stringify(this.productList))
- }
- },
- submit(row) {
- if(!this.productList || this.productList.length === 0) {
- this.$message.error('未登记信息')
- return
- }
- let data = this.productList
- let oldData = []
- data.forEach(item => {
- var oldObj = {
- good_name: item.name,
- list: []
- }
- oldObj.list.push({
- num: Number(item.num),
- size: item.size,
- sex: item.type === '男款' || item.type === '男'? 1 : 0,
- time: item.time
- })
- oldData.push(oldObj)
- })
- var newData = []
- var newObj = {}
- oldData.forEach((el, i) => {
- if (!newObj[el.good_name]) {
- newData.push(el);
- newObj[el.good_name] = true;
- } else {
- newData.forEach(el => {
- if (el.good_name === oldData[i].good_name) {
- let data = el.list.concat(oldData[i].list)
- // 重复合并,num相加
- for(let i=0; i<data.length; i++){
- for(let j=i+1; j<data.length; j++){
- if(data[i].size === data[j].size && data[i].sex === data[j].sex && data[i].time === data[j].time){
- // console.log('重复',data[i],data[j])
- data[i].num = data[i].num + data[j].num
- data.splice(j,1)
- }
- }
- }
- el.list = data
- }
- })
- }
- })
- console.log(newData)
- const arr = this.chuanNum
- const brr = this.weiNum
- const wear = {
- hard: arr[0],
- simple: arr[1],
- old_new: arr[2],
- old: arr[3],
- youth: arr[4]
- }
- const not_wear = {
- hard: brr[0],
- simple: brr[1],
- old_new: brr[2],
- old: brr[3],
- youth: brr[4]
- }
- this.$confirm('确定要提交吗 ?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- this.loadingFull = true
- let _this = this
- let total = eval(_this.numList.join("+"))
- axios.post('http://api.admin.app.cliu.cc/api/ReturnGood/InsertGoodInfo', {
- id: _this.id,
- total: total,
- info: newData,
- wear,
- not_wear,
- lack_soap: _this.zaoNum,
- lack_tote: _this.daiNum
- }).then(res => {
- _this.loadingFull = false
- if (res.code === 200) {
- window.ELEMENT.Message.success({
- message : '提交成功',
- duration: 800,
- offset: 80,
- onClose: () => {
- window.localStorage.removeItem('productList')
- window.location.href = "../index.html"
- }
- })
- } else {
- _this.$message.error(res.message || '提交失败')
- }
- }).catch((err) => {
- _this.$message.error('提交失败')
- _this.loadingFull = false
- })
- })
- .catch(() => {})
- },
- // 防连点
- noMultipleClicks(methods) {
- let that = this;
- if (that.noClick) {
- that.noClick= false;
- methods();
- setTimeout(function () {
- that.noClick= true;
- }, 1500)
- }
- },
- }
- })
- </script>
- </body>
- </html>
|