ship.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <template>
  2. <view class="app-content">
  3. <view class="order-info_box">
  4. <view class="order-info-list">
  5. <view class="list-item">
  6. <text>订单号</text>
  7. <text>{{orderInfo.orderSn}}</text>
  8. </view>
  9. <view class="list-item">
  10. <text>下单时间</text>
  11. <text>{{orderInfo.addTime}}</text>
  12. </view>
  13. <!-- <view class="list-item">
  14. <text>商品名称</text>
  15. <text>{{2929323}}</text>
  16. </view> -->
  17. <view class="list-item">
  18. <text>金额</text>
  19. <text>{{orderInfo.actPrice}}</text>
  20. </view>
  21. </view>
  22. <image
  23. src="/static/images/default-img.png" mode="scaleToFill">
  24. </image>
  25. </view>
  26. <view class="step-content_box">
  27. <stepShip
  28. @sendConfirm="sendConfirm"
  29. @affirmSend="affirmSend"
  30. @selfSend="selfSend"
  31. @sendParcel="sendParcel"
  32. :orderComData="orderComData">
  33. </stepShip>
  34. </view>
  35. <!-- 快递送 -->
  36. <modal-module
  37. :show="showSubmitModel"
  38. @cancel="modalCancel"
  39. @click="submitEvent"
  40. :title="titText"
  41. color="#333"
  42. :size="32"
  43. padding="30rpx 30rpx"
  44. >
  45. </modal-module>
  46. </view>
  47. </template>
  48. <script>
  49. import stepShip from './components/stepShip'
  50. import { getDetB, orderSendDet, freight, thirdSend, selfSend, reachOrder,sendReach } from '@/api/order'
  51. import ModalModule from "@/components/plugin/modal";
  52. export default {
  53. name: 'admin-ship',
  54. components: {
  55. stepShip,
  56. ModalModule
  57. },
  58. data() {
  59. return {
  60. showSubmitModel: false,
  61. titText:'',
  62. orderInfo: {},
  63. orderComData: [],
  64. shipModal: false,
  65. form:{
  66. sendTime:'',
  67. sendSide: 2,
  68. sendCost: 0
  69. },
  70. sendSideText:'达达配送',
  71. deliveryList: [
  72. {
  73. text: "达达配送",
  74. key: 2
  75. },
  76. {
  77. text: "顺丰同城",
  78. key: 3
  79. },
  80. {
  81. text: "闪送",
  82. key: 4
  83. },
  84. {
  85. text: "美团",
  86. key: 5
  87. }
  88. ],
  89. timeList: [
  90. [
  91. "1",
  92. "2",
  93. "3",
  94. "4",
  95. "5",
  96. "6",
  97. "7",
  98. "8",
  99. "9",
  100. "10",
  101. "11",
  102. "12",
  103. "13",
  104. "14",
  105. "15",
  106. "16",
  107. "17",
  108. "18",
  109. "19",
  110. "20",
  111. "21",
  112. "22",
  113. "23",
  114. "24"
  115. ],
  116. ["00", "10", "20", "30", "40", "50"]
  117. ],
  118. currentTitType: {}
  119. }
  120. },
  121. onLoad() {
  122. // uni.showLoading({
  123. // title: '加载中...',
  124. // mask: true
  125. // })
  126. // this.init()
  127. },
  128. onShow(){
  129. this.init()
  130. },
  131. methods: {
  132. init() {
  133. // this.showIndex = this.option.pageStatus || 0
  134. this._getDet()
  135. this._orderComDet()
  136. // this.freightCount()
  137. },
  138. sendConfirm(type){
  139. console.log(type)
  140. return sendReach({ id: this.option.id }).then(res => {
  141. this.init();
  142. })
  143. },
  144. _getDet() {
  145. // this.option.id
  146. return getDetB({ id: this.option.id }).then(res => {
  147. this.orderInfo = res.data
  148. })
  149. },
  150. _orderComDet() {
  151. orderSendDet({ id: this.option.id }).then(res => {
  152. this.orderComData = res.data
  153. })
  154. },
  155. // 快递送
  156. sendParcel(){
  157. this.pageTo({url: "/pagesOrder/shipInfo",query: {orderId:this.option.id,id: this.orderInfo.customId}});
  158. console.error('快递送')
  159. // this.shipModal = true;
  160. },
  161. // 计算运费
  162. freightCount(){
  163. freight({
  164. id: this.option.id,
  165. sendSide: this.form.sendSide,
  166. }).then(res=>{
  167. this.form.sendCost = res.data.sndCost
  168. })
  169. },
  170. //发货
  171. shipModalClick(e){
  172. if (e.index === 0){
  173. this.modalCancel()
  174. }else{
  175. thirdSend({
  176. id:this.option.id,
  177. ...this.form
  178. }).then(res=>{
  179. this.$msg('发货成功')
  180. this.init()
  181. this.modalCancel();
  182. })
  183. }
  184. },//关闭
  185. modalCancel(){
  186. this.shipModal = false;
  187. this.showSubmitModel = false
  188. }, // 自己送
  189. selfSend(val){
  190. let self = this;
  191. uni.showModal({
  192. title: '提示',
  193. content: '确定自己送货?',
  194. success: function (res) {
  195. if (res.confirm) {
  196. selfSend({
  197. id:self.option.id
  198. }).then(res=>{
  199. self.modalCancel()
  200. self.$msg('发货状态已更新')
  201. self.init()
  202. })
  203. }
  204. }
  205. });
  206. // // return;
  207. // this.currentTitType = val
  208. // this.titText = val.text;
  209. // this.showSubmitModel = true
  210. }, // 确认
  211. affirmSend(val){
  212. this.currentTitType = val
  213. this.titText = val.text;
  214. this.showSubmitModel = true
  215. }, // 确认送达 和 本店送
  216. submitEvent(e){
  217. if(e.index === 0) {
  218. this.modalCancel()
  219. }else{
  220. let updateStatue = this.currentTitType.type == 0? selfSend:reachOrder
  221. updateStatue({
  222. id:this.option.id
  223. }).then(res=>{
  224. this.modalCancel()
  225. this.$msg('发货状态已更新')
  226. this.init()
  227. })
  228. }
  229. },
  230. changeTimeFn(e){
  231. let oneIndex = e.detail.value[0] || 0;
  232. let twoIndex = e.detail.value[1] || 0;
  233. this.form.sendTime = this.timeList[0][oneIndex] + ":" + this.timeList[1][twoIndex];
  234. },
  235. changeDeliveryFn(e){
  236. this.form.sendSide = this.deliveryList[e.detail.value].key;
  237. this.sendSideText = this.deliveryList[e.detail.value].text;
  238. // 平台不同运费重新计算
  239. this.freightCount()
  240. },
  241. }
  242. }
  243. </script>
  244. <style lang="scss" scoped>
  245. .app-content {
  246. // background-color: #fff;
  247. .ship-modal {
  248. .line-label {
  249. width: 140px;
  250. }
  251. }
  252. }
  253. .order-info_box {
  254. display: flex;
  255. padding: 30px;
  256. background-color: #FFFFFF;
  257. align-items: center;
  258. & .order-info-list {
  259. flex: 1;
  260. & .list-item {
  261. font-size: 28px;
  262. font-weight: 400;
  263. & > text:nth-child(1) {
  264. color: #666666;
  265. display: inline-block;
  266. width: 140px;
  267. }
  268. & > text:nth-child(1) {
  269. color: #333333;
  270. }
  271. }
  272. }
  273. & image {
  274. width: 146px;
  275. height: 146px;
  276. }
  277. }
  278. .order-fa_box {
  279. padding:20upx;
  280. border: 1upx solid #DDDDDD;
  281. border-radius: 4upx;
  282. margin-bottom: 20upx;
  283. & > .order-fa_info {
  284. padding-left: 20upx;
  285. & > .order-fa_top {
  286. display: flex;
  287. align-items: center;
  288. & > view:nth-child(1) {
  289. width: 40upx;
  290. height: 40upx;
  291. line-height: 40upx;
  292. text-align: center;
  293. background-color: #3385FF;
  294. color: #FFFFFF;
  295. font-size: 24upx;
  296. margin-right: 20upx;
  297. border-radius: 50%;
  298. }
  299. & > view:nth-child(2) {
  300. color: #333333;
  301. font-size: 32upx;
  302. font-weight: 600;
  303. color: #333333;
  304. }
  305. }
  306. & > view:nth-child(2) {
  307. padding-left: 60upx;
  308. text-align: left;
  309. color: #999999;
  310. font-size: 24upx;
  311. font-weight: 400;
  312. margin:25upx 0 19upx;
  313. }
  314. & > view:nth-child(3) {
  315. padding-left: 60upx;
  316. text-align: left;
  317. color: #333333;
  318. font-size: 24upx;
  319. font-weight: 400;
  320. margin:25upx 0 19upx;
  321. }
  322. }
  323. }
  324. </style>