loadOrderModal.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. <template>
  2. <vxe-modal v-model="value" id="synchronousOrderModal" width="500" height="400" @hide="hide" transfer show-footer v-loading="load">
  3. <template #title>
  4. <span>下载订单</span>
  5. </template>
  6. <template #default>
  7. <div class="type">
  8. <el-radio-group v-model="type">
  9. <el-radio :label="1">按线上订单号</el-radio>
  10. <el-radio :label="2">按时间段</el-radio>
  11. <!-- <el-radio :label="3">按订单状态</el-radio> -->
  12. </el-radio-group>
  13. </div>
  14. <div class="cont">
  15. <div class="title"><span>* </span>上游平台:</div>
  16. <div class="right-cont">
  17. <el-select v-model="sourceId" size="mini" style="width:100%" placeholder="请选择" clearable @change="shopChange">
  18. <el-option
  19. v-for="item in sourceOptions"
  20. :key="item.value"
  21. :label="item.label"
  22. :value="item.value">
  23. </el-option>
  24. </el-select>
  25. </div>
  26. </div>
  27. <template v-if="type == 1">
  28. <div class="cont">
  29. <div class="title"><span>* </span>线上订单:</div>
  30. <div class="right-cont">
  31. <el-input v-model="sourceIds" type="textarea" rows="4" size="mini" placeholder="每行一个单号,换行输入"></el-input>
  32. </div>
  33. </div>
  34. </template>
  35. <template v-if="type == 2">
  36. <div class="cont">
  37. <div class="title"><span>* </span>时间类型:</div>
  38. <div class="right-cont">
  39. <el-select v-model="dateType" size="mini" style="width:100%" placeholder="请选择" clearable>
  40. <el-option
  41. v-for="item in dateTypeOptions"
  42. :key="item.value"
  43. :label="item.label"
  44. :value="item.value">
  45. </el-option>
  46. </el-select>
  47. </div>
  48. </div>
  49. <div class="cont">
  50. <div class="title"><span>* </span>时间:</div>
  51. <div class="right-cont">
  52. <el-date-picker
  53. v-model="time"
  54. style="width: 100%;"
  55. size="mini"
  56. type="datetimerange"
  57. clearable
  58. value-format="yyyy-MM-dd HH:mm:ss"
  59. range-separator="-"
  60. start-placeholder="开始日期"
  61. @change="change"
  62. end-placeholder="结束日期">
  63. </el-date-picker>
  64. </div>
  65. </div>
  66. <div class="cont">
  67. <div class="title"><span></span>店铺名称:</div>
  68. <div class="right-cont">
  69. <el-select v-model="shopid" size="mini" style="width:100%" placeholder="请选择" clearable @change="shopChange">
  70. <el-option
  71. v-for="item in shopOpions"
  72. :key="item.value"
  73. :label="item.label"
  74. :value="item.value">
  75. </el-option>
  76. </el-select>
  77. </div>
  78. </div>
  79. <div class="cont">
  80. <div class="title">订单状态:</div>
  81. <div class="right-cont">
  82. <el-select v-model="status" size="mini" style="width:100%" placeholder="请选择" clearable>
  83. <el-option
  84. v-for="item in statusOptions"
  85. :key="item.value"
  86. :label="item.label"
  87. :value="item.value">
  88. </el-option>
  89. </el-select>
  90. </div>
  91. </div>
  92. </template>
  93. <!-- <template v-if="type == 3">
  94. <div class="cont">
  95. <div class="title"><span>* </span>订单状态:</div>
  96. <div class="right-cont">
  97. <el-select v-model="status" size="mini" style="width:100%" placeholder="请选择" clearable>
  98. <el-option
  99. v-for="item in statusOptions"
  100. :key="item.value"
  101. :label="item.label"
  102. :value="item.value">
  103. </el-option>
  104. </el-select>
  105. </div>
  106. </div>
  107. </template> -->
  108. </template>
  109. <template #footer>
  110. <div class="btn">
  111. <el-button plain size="small" @click="value = false">取消</el-button>
  112. <el-button type="primary" size="small" plain @click="clear">清空</el-button>
  113. <el-button type="primary" size="small" @click="btn">确定</el-button>
  114. </div>
  115. </template>
  116. </vxe-modal>
  117. </template>
  118. <script lang="ts">
  119. import { Component, Prop, Vue, Watch } from "vue-property-decorator";
  120. import { pullOrder } from '@/api/omsOrder'
  121. import { query,queryShop } from '@/api/sourceShop'
  122. @Component
  123. export default class LoadOrderModal extends Vue {
  124. load = false;
  125. value = false;
  126. type=1;
  127. sourceName = '';
  128. sourceId:any = null;
  129. sourceOptions:Array<any>=[
  130. // {
  131. // label:'犇云聚水潭店铺',
  132. // value:2
  133. // }
  134. ]
  135. shopid=''
  136. shopOpions:Array<any>=[]
  137. sourceIds=''; //线上订单号
  138. dateType:any='';
  139. dateTypeOptions=[{
  140. label:'修改时间',
  141. value:1
  142. },{
  143. label:'订单日期',
  144. value:3
  145. },{
  146. label:'发货时间',
  147. value:4
  148. }]
  149. beginDate='';
  150. endDate='';
  151. time:any=null;
  152. status='';
  153. statusOptions:Array<any>=[{
  154. label:'待付款',
  155. value:'WaitPay'
  156. },{
  157. label:'发货中',
  158. value:'Delivering'
  159. },{
  160. label:'被合并',
  161. value:'Merged'
  162. },{
  163. label:'异常',
  164. value:'Question'
  165. },{
  166. label:'被拆分',
  167. value:'Split'
  168. },{
  169. label:'等供销商|外仓发货',
  170. value:'WaitOuterSent'
  171. },{
  172. label:'已付款待审核',
  173. value:'WaitConfirm'
  174. },{
  175. label:'已客审待财审',
  176. value:'WaitFConfirm'
  177. },{
  178. label:'已发货',
  179. value:'Sent'
  180. },{
  181. label:'取消',
  182. value:'Cancelled'
  183. }]
  184. setShow(v:boolean){
  185. this.value = v;
  186. }
  187. change(v:any){
  188. if(v){
  189. this.beginDate = v[0];
  190. this.endDate = v[1];
  191. }else{
  192. this.beginDate = '';
  193. this.endDate = '';
  194. }
  195. }
  196. shopChange(v:any){
  197. if(v){
  198. for(const item of this.sourceOptions){
  199. if(item.value == v){
  200. this.sourceName = item.label
  201. break;
  202. }
  203. }
  204. this.getSourceShopList()
  205. }else{
  206. this.sourceName=''
  207. this.shopid=''
  208. this.shopOpions=[]
  209. }
  210. }
  211. btn(){
  212. let value:any={};
  213. let msg = '';
  214. if(!this.sourceId){
  215. msg = '上游平台'
  216. }
  217. value.sourceId = this.sourceId;
  218. value.soueceName = this.sourceName;
  219. value.type = this.type;
  220. if(this.type == 1){
  221. if(!this.sourceIds){
  222. if(msg){
  223. msg = msg + ',线上订单'
  224. }else{
  225. msg = '线上订单'
  226. }
  227. }
  228. value.sourceIds = this.sourceIds.split('\n');
  229. }else if(this.type == 2){
  230. let isS=false;
  231. value.shopId = this.shopid
  232. for(const item of this.dateTypeOptions){
  233. if(item.value == this.dateType){
  234. isS = true;
  235. break
  236. }
  237. }
  238. // if(!this.status){
  239. // if(msg){
  240. // msg = msg + ',订单状态'
  241. // }else{
  242. // msg = '订单状态'
  243. // }
  244. // }
  245. value.status = this.status;
  246. if(!isS){
  247. if(msg){
  248. msg = msg + ',时间类型'
  249. }else{
  250. msg = '时间类型'
  251. }
  252. }
  253. if(!this.time){
  254. if(msg){
  255. msg = msg + ',时间'
  256. }else{
  257. msg = '时间'
  258. }
  259. }
  260. value.dateType = Number(this.dateType) - 1;
  261. value.beginDate = this.beginDate;
  262. value.endDate = this.endDate;
  263. }
  264. if(msg){
  265. this.$message({
  266. message:msg + '不能为空!',
  267. type: 'warning'
  268. })
  269. return
  270. }
  271. this.load = true;
  272. pullOrder(value).then((res:any) => {
  273. this.load = false;
  274. this.value = false;
  275. if(res.data > 0){
  276. (this as any).$message({
  277. message: '成功更新' + res.data + '条数据!',
  278. type: 'success',
  279. });
  280. this.$emit('handleSuccess');
  281. }else{
  282. (this as any).$message({
  283. message: '未更新数据!',
  284. type: 'warning',
  285. });
  286. }
  287. }).catch((err:any) => {
  288. this.load = false;
  289. })
  290. }
  291. hide(){
  292. this.clear()
  293. }
  294. clear(){
  295. this.type = 1;
  296. this.sourceName = '';
  297. this.sourceId = '';
  298. this.sourceIds = '';
  299. this.dateType = '';
  300. this.beginDate = '';
  301. this.endDate = '';
  302. this.time = null;
  303. this.status = '';
  304. this.shopid = ''
  305. }
  306. //上游平台
  307. getSourceList() {
  308. this.sourceOptions = []
  309. this.load = true
  310. query({
  311. pageNo: 1,
  312. pageSize: 50
  313. }).then((res:any) => {
  314. this.load = false
  315. if (res.data && res.data.records) {
  316. for(const item of res.data.records) {
  317. this.sourceOptions.push({
  318. label: item.sourceName,
  319. value: item.id
  320. })
  321. }
  322. }
  323. }).catch(()=>{
  324. this.load = false
  325. })
  326. }
  327. //店铺
  328. getSourceShopList(){
  329. this.shopOpions = []
  330. queryShop({
  331. sourceId:this.sourceId
  332. }).then((res:any) => {
  333. this.load = false
  334. if (res.data) {
  335. for(const item of res.data) {
  336. this.shopOpions.push({
  337. label: item.shopName,
  338. value: item.shopId
  339. })
  340. }
  341. }
  342. }).catch(()=>{
  343. this.load = false
  344. })
  345. }
  346. created() {
  347. this.getSourceList()
  348. }
  349. }
  350. </script>
  351. <style lang="scss" scoped>
  352. .btn{
  353. width: 100%;
  354. display: flex;
  355. justify-content: flex-end;
  356. }
  357. .type{
  358. width: 100%;
  359. padding: 8px 0;
  360. }
  361. .cont{
  362. width: 100%;
  363. display: flex;
  364. align-items: center;
  365. padding: 8px 0;
  366. .title{
  367. width: 100px;
  368. text-align: right;
  369. margin: 0 !important;
  370. >span{
  371. color: #F00;
  372. }
  373. }
  374. .right-cont{
  375. width: calc(100% - 100px);
  376. }
  377. }
  378. </style>